File: update_mirrors.py

package info (click to toggle)
update-manager 0.68.debian-7
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 6,796 kB
  • ctags: 814
  • sloc: python: 5,646; xml: 1,571; sh: 433; makefile: 356; ansic: 264
file content (22 lines) | stat: -rwxr-xr-x 487 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/python

import feedparser
import sys

# read what we have
current_mirrors = set()
for line in open(sys.argv[1], "r"):
    current_mirrors.add(line.strip())

    
outfile = open(sys.argv[1],"a")
d = feedparser.parse("https://launchpad.net/ubuntu/+archivemirrors-rss")

#import pprint
#pp  = pprint.PrettyPrinter(indent=4)
#pp.pprint(d)

for entry in d.entries:
    for link in entry.links:
        if not link.href in current_mirrors:
            outfile.write(link.href+"\n")