]> diplodocus.org Git - flac-archive/commitdiff
add stupid hack for checking missing files
author <epg@pretzelnet.org> <>
Sun, 8 Dec 2013 20:22:03 +0000 (12:22 -0800)
committer <epg@pretzelnet.org> <>
Sun, 8 Dec 2013 20:22:03 +0000 (12:22 -0800)
flac2mp3

index d9f9f7b..e3dbc72 100755 (executable)
--- a/flac2mp3
+++ b/flac2mp3
@@ -106,6 +106,9 @@ def flac2mp3(fn, title, artist, album_artist, album, discnum, date,
 
     quoted_outfile = ('%s (%s) %02d %s.mp3' % (artist, outfile_album,
                                                track, title)).replace('/', '_')
 
     quoted_outfile = ('%s (%s) %02d %s.mp3' % (artist, outfile_album,
                                                track, title)).replace('/', '_')
+    # HACK! :(
+    if check_missing:
+        return quoted_outfile.replace(r"'\''", "'")
 
     pic_options = None
     if pics:
 
     pic_options = None
     if pics:
@@ -198,6 +201,8 @@ def main(argv):
         parser.add_option('--lame-options')
         parser.add_option('-q', '--quiet', action='store_true', default=False)
         parser.add_option('-v', '--verbose', action='store_true', default=False)
         parser.add_option('--lame-options')
         parser.add_option('-q', '--quiet', action='store_true', default=False)
         parser.add_option('-v', '--verbose', action='store_true', default=False)
+        parser.add_option('--check-missing-files', action='store_true',
+                          default=False)
     except:
         traceback.print_exc()
         return 2
     except:
         traceback.print_exc()
         return 2
@@ -214,6 +219,8 @@ def main(argv):
     separator = ' '
     try:
         global debug, flac_options, lame_options, quiet, verbose
     separator = ' '
     try:
         global debug, flac_options, lame_options, quiet, verbose
+        global check_missing
+        check_missing = options.check_missing_files
         debug = options.debug
         lame_options = options.lame_options
         quiet = options.quiet
         debug = options.debug
         lame_options = options.lame_options
         quiet = options.quiet
@@ -251,6 +258,16 @@ def main(argv):
                     artist = tags.get('ARTIST', track)
                     artist.extend(tags.get('FEATURING', track))
                     album_artist = tags.gets('ALBUMARTIST', track)
                     artist = tags.get('ARTIST', track)
                     artist.extend(tags.get('FEATURING', track))
                     album_artist = tags.gets('ALBUMARTIST', track)
+                    if check_missing:
+                        mp3 = flac2mp3(fn, title,
+                                 ', '.join(artist),
+                                 album_artist, album, discnum,
+                                 tags.gets('DATE', track),
+                                 track, args[i], pics)
+                        if not os.path.exists(mp3):
+                            print fn
+                            break
+                        continue
                     jobs.append((fn, title,
                                  ', '.join(artist),
                                  album_artist, album, discnum,
                     jobs.append((fn, title,
                                  ', '.join(artist),
                                  album_artist, album, discnum,