From e9bccd701eedf6c35fe2b1c54d61434dc99178bb Mon Sep 17 00:00:00 2001 From: epg <> Date: Sat, 28 Oct 2006 09:11:22 +0000 Subject: [PATCH] Grab Amazon artwork, but don't do anything with it yet. --- fa-flacd | 4 +++- fa-rip | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/fa-flacd b/fa-flacd index 59e9c26..84714b2 100755 --- 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 --- 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' -- 2.56.0