]> diplodocus.org Git - flac-archive/commitdiff
Grab Amazon artwork, but don't do anything with it yet.
authorepg <>
Sat, 28 Oct 2006 09:11:22 +0000 (09:11 +0000)
committerepg <>
Sat, 28 Oct 2006 09:11:22 +0000 (09:11 +0000)
fa-flacd
fa-rip

index 59e9c26..84714b2 100755 (executable)
--- a/fa-flacd
+++ b/fa-flacd
@@ -190,8 +190,10 @@ def flac(dir, artist, album, discnum, tracknum, track_tags, disc_artist, tags):
     # Clean up if we're the last job for dir; for multi-file dirs,
     # it's possible for more than one job to run cleanup at once, so
     # don't fail if things are already clean.
-    if os.listdir(dir) == ['using-tags']:
+    ld = os.listdir(dir)
+    if ld == ['using-tags'] or sorted(ld) == ['cover.front', 'using-tags']:
         try:
+            os.unlink(dir + '/cover.front')
             os.unlink(dir + '/using-tags')
             os.rmdir(dir)
         except EnvironmentError:
diff --git a/fa-rip b/fa-rip
index cf0e9e8..33fcc0d 100755 (executable)
--- a/fa-rip
+++ b/fa-rip
@@ -69,6 +69,7 @@ it under the same terms as Perl itself.
 
 import os, sys, tempfile, traceback
 from optparse import OptionParser
+import urllib
 
 import musicbrainz2.disc
 import musicbrainz2.webservice
@@ -137,6 +138,12 @@ def tags_file(fn, trackcount, various, artist=None, album=None,
 
     c(fp.close)
 
+def cover_art(i, asin):
+    url = 'http://images.amazon.com/images/P/%s.01.MZZZZZZZ.jpg' % (asin,)
+    fp = file('cover.front-' + i, 'w')
+    fp.write(urllib.urlopen(url).read())
+    fp.close()
+
 def tags(disc, trackcount, mb=True):
     results = []
     seen_various = False
@@ -164,6 +171,8 @@ def tags(disc, trackcount, mb=True):
                   album.release.getReleaseEventsAsDict(),
                   q.getReleaseById(album.release.id, include).tracks)
 
+        cover_art(str(i), album.release.asin)
+
 def rip(device, trackcount, single_file):
     if device == None:
         device = '/dev/cdrom'