<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -10,37 +10,21 @@ $ ./grabber.sh # grab all Zero Punctuation episodes into current directory
 Use sanely
 &quot;&quot;&quot;
 import re
+from zp_grabber import ZpCacher
 
-def sort_nicely( l ): 
+def sort_nicely(l): 
     &quot;&quot;&quot;
     Sort the given list in the way that humans expect. 
     &quot;&quot;&quot; 
     convert = lambda text: int(text) if text.isdigit() else text 
-    alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ] 
-    l.sort( key=alphanum_key )
+    alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)]
+    l.sort(key=alphanum_key)
     return l
 
-fp = open(&quot;zp_cache.txt&quot;)
-lines = fp.readlines()
+zpc = ZpCacher()
+videos = zpc.cache
 
-videos = {}
-
-for current_line in lines:
-    try:
-        c_vid, c_flv_url, c_web_url, c_title = [x.strip() for x in current_line.split(&quot;|&quot;)]
-        videos[c_vid] = {
-            'flv':c_flv_url,
-            'web':c_web_url,
-            'vid':c_vid,
-            'title':c_title
-        }
-    except ValueError:
-        print &quot;invalid line %s&quot; % (current_line)
-        continue # Invalid line, skip
-
-counter = 1
-for vid in sort_nicely(videos.keys()):
+for counter, vid in enumerate(sort_nicely(videos.keys())):
     cur = videos[vid]
     new_name = &quot;Zero Punctuation - [%02d] - %s.flv&quot; % (counter, cur['title'])
     print &quot;wget -c %s -O \&quot;%s\&quot;&quot; % (cur['flv'], new_name)
-    counter += 1
\ No newline at end of file</diff>
      <filename>zp_wget_generator.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8f0eb1eef2617e93f9008f62608fd1db943b4705</id>
    </parent>
  </parents>
  <author>
    <name>dbr</name>
    <email>dbr.onix@gmail.com</email>
  </author>
  <url>http://github.com/dbr/zp_grabber/commit/a90f75adf1e44958502b98fed293d92fa43666b6</url>
  <id>a90f75adf1e44958502b98fed293d92fa43666b6</id>
  <committed-date>2009-09-01T12:12:04-07:00</committed-date>
  <authored-date>2009-09-01T12:12:04-07:00</authored-date>
  <message>Tidy up zp_wget_generator, use ZpCacher class rather than re-implimenting the cache parser</message>
  <tree>30eb30eaa9c6c0bb04441f176d6169b1eff99299</tree>
  <committer>
    <name>dbr</name>
    <email>dbr.onix@gmail.com</email>
  </committer>
</commit>
