Change 118
Change 118 by ksimpson@ksimpson-tibook on 2005/01/15 17:21:48
podgrab 1.0. keep only the newest 3 episodes per feed so the 4GB mini doesn't fill up.
gave podgrab its own section in the opml.
Affected files ...| //depot/projects/podgrab/podgrab.py#5 | xtext | |
| //depot/projects/podgrab/README#2 | text | |
| //depot/projects/podgrab/feeds.opml#5 | text |
==== //depot/projects/podgrab/podgrab.py#5 (xtext) ====
| @@ -6,6 +6,8 @@ | ||
| 6 | 6 | ksimpson, oct 2004. needs Python 2.3. |
| 7 | 7 | """ |
| 8 | 8 | |
| 9 | __version__ = "1.0" | |
| 10 | ||
| 9 | 11 | import os |
| 10 | 12 | import shutil |
| 11 | 13 | import sys |
| @@ -15,7 +17,8 @@ | ||
| 15 | 17 | IPOD = "/Volumes/IPOD" |
| 16 | 18 | CACHE = os.path.expanduser("~/.podgrab") |
| 17 | 19 | SEEN = os.path.join(CACHE, "seen") |
| 18 | UA = "podgrab/0.2 (+http://ttul.org/)" | |
| 20 | UA = "podgrab/%s (+http://ttul.org/)" % __version__ | |
| 21 | MAX_PER_FEED = 3 | |
| 19 | 22 | |
| 20 | 23 | |
| 21 | 24 | def fetch(url): |
| @@ -57,7 +60,7 @@ | ||
| 57 | 60 | for title, url in read_opml(opml): |
| 58 | 61 | print "==>", title |
| 59 | 62 | try: |
| 60 | encs = list(enclosures(url)) | |
| 63 | encs = list(enclosures(url))[:MAX_PER_FEED] | |
| 61 | 64 | except Exception, e: |
| 62 | 65 | print " feed broken:", e |
| 63 | 66 | continue |
==== //depot/projects/podgrab/README#2 (text) ====
| @@ -10,4 +10,6 @@ | ||
| 10 | 10 | Downloads go to ~/.podgrab. Already-fetched URLs are remembered in |
| 11 | 11 | ~/.podgrab/seen so you don't get the same episode twice. |
| 12 | 12 | |
| 13 | Only the newest 3 episodes of each feed are fetched (MAX_PER_FEED). | |
| 14 | ||
| 13 | 15 | Add feeds by editing feeds.opml. Yes, by hand. It's XML. You'll live. |
==== //depot/projects/podgrab/feeds.opml#5 (text) ====
| @@ -3,11 +3,13 @@ | ||
| 3 | 3 | <head> |
| 4 | 4 | <title>ttul podgrab subscriptions</title> |
| 5 | 5 | <dateCreated>Fri, 01 Oct 2004 21:12:00 PDT</dateCreated> |
| 6 | <dateModified>Sat, 15 Jan 2005 17:20:00 PST</dateModified> | |
| 6 | 7 | <ownerName>ksimpson</ownerName> |
| 7 | 8 | </head> |
| 8 | 9 | <body> |
| 9 | 10 | <outline text="The Geek Hour" type="rss" xmlUrl="http://geekhour.example.com/rss.xml"/> |
| 10 | 11 | <outline text="Kernel Panic Radio" type="rss" xmlUrl="http://kpr.example.net/podcast.xml"/> |
| 12 | <outline text="Radio Free Burnaby" type="rss" xmlUrl="http://rfb.example.org/rss.xml"/> | |
| 11 | 13 | <outline text="Pacific Northwest Hacker Hour" type="rss" xmlUrl="http://pnwhh.example.org/feed/"/> |
| 12 | 14 | <outline text="zz9 talks about stuff" type="rss" xmlUrl="http://ttul.org/~zz9/podcast/rss.xml"/> |
| 13 | 15 | </body> |