Change 91
Change 91 by ksimpson@ksimpson-tibook on 2004/10/14 07:58:22
copy to the ipod if it's mounted. one dead feed shouldn't kill the whole run.
Affected files ...| //depot/projects/podgrab/podgrab.py#2 | xtext |
==== //depot/projects/podgrab/podgrab.py#2 (xtext) ====
| @@ -7,6 +7,7 @@ | ||
| 7 | 7 | """ |
| 8 | 8 | |
| 9 | 9 | import os |
| 10 | import shutil | |
| 10 | 11 | import sys |
| 11 | 12 | import urllib |
| 12 | 13 | from xml.dom import minidom |
| @@ -50,13 +51,22 @@ | ||
| 50 | 51 | out = open(SEEN, "a") |
| 51 | 52 | for title, url in read_opml(opml): |
| 52 | 53 | print "==>", title |
| 53 | for enc in enclosures(url): | |
| 54 | try: | |
| 55 | encs = list(enclosures(url)) | |
| 56 | except Exception, e: | |
| 57 | print " feed broken:", e | |
| 58 | continue | |
| 59 | for enc in encs: | |
| 54 | 60 | if enc in seen: |
| 55 | 61 | continue |
| 56 | 62 | fname = os.path.join(CACHE, os.path.basename(enc)) |
| 57 | 63 | print " ", enc |
| 58 | 64 | urllib.urlretrieve(enc, fname) |
| 59 | 65 | out.write(enc + "\n") |
| 66 | if os.path.isdir(IPOD): | |
| 67 | # NB: this does not update the iTunesDB. use gtkpod, or | |
| 68 | # just play it from the notes folder like a caveman. | |
| 69 | shutil.copy(fname, os.path.join(IPOD, "Podcasts")) | |
| 60 | 70 | out.close() |
| 61 | 71 | |
| 62 | 72 | |