]> diplodocus.org Git - flac-archive/blobdiff - fa-flacd
Commit a bunch of state sitting around in the old bzr checkout!
[flac-archive] / fa-flacd
index 6488ef536e73169f47ac8056ec77d35c285cc2ab..5716223f8c5b360c4e5fa58e1760fca23fd69fae 100755 (executable)
--- a/fa-flacd
+++ b/fa-flacd
@@ -1,4 +1,4 @@
-#! /usr/bin/env python2.4
+#! /usr/bin/python2
 
 """
 =head1 NAME
 
 """
 =head1 NAME
@@ -126,7 +126,11 @@ def flac(dir, tracknum, tags):
     flac files represent individual tracks or whole discs."""
 
     separator = ' '
     flac files represent individual tracks or whole discs."""
 
     separator = ' '
-    artist = (tags.gets('ARTIST', separator=', ') or '').replace('/', '_')
+    if len(tags.get('ALBUMARTIST')) > 0:
+        artist_tag = tags.gets('ALBUMARTIST', separator=', ')
+    else:
+        artist_tag = tags.gets('ARTIST', separator=', ')
+    artist = (artist_tag or '').replace('/', '_')
     album = (tags.gets('ALBUM', separator=separator) or '').replace('/', '_')
     discnum = tags.gets('DISCNUMBER')
 
     album = (tags.gets('ALBUM', separator=separator) or '').replace('/', '_')
     discnum = tags.gets('DISCNUMBER')
 
@@ -154,7 +158,12 @@ def flac(dir, tracknum, tags):
         run_flac('wav', 'cue', '/'.join(['..', artist, outfile]), tags.all())
         files = ['%s/%s.flac' % (artist, outfile)]
 
         run_flac('wav', 'cue', '/'.join(['..', artist, outfile]), tags.all())
         files = ['%s/%s.flac' % (artist, outfile)]
 
-        c(os.unlink, 'cue')
+        try:
+            c(os.unlink, 'cue')
+        except EnvironmentError, error:
+            if error.errno != ENOENT:
+                raise error
+
         outlog = '/'.join(['..', artist, outfile + '.log'])
         c(os.rename, 'log', outlog)
     else:
         outlog = '/'.join(['..', artist, outfile + '.log'])
         c(os.rename, 'log', outlog)
     else: