X-Git-Url: https://diplodocus.org/git/flac-archive/blobdiff_plain/ab7bc57e5eee62b66b5386630c584b05efb361d5..50c4d6cf6be87e8a21841a3779d892f30970bf93:/flac2mp3 diff --git a/flac2mp3 b/flac2mp3 index cbc0662..24e4a48 100755 --- a/flac2mp3 +++ b/flac2mp3 @@ -89,9 +89,6 @@ def flac2mp3(fn, title, artist, album_artist, album, discnum, date, verbose and tmp.append('--verbose') lame_options = ' '.join(tmp) - outfile = ('%s (%s) %02d %s.mp3' % (artist, album, - track, title)).replace('/', '_') - # Escape any single quotes ' so we can quote this. (fn, title, artist, album_artist, album, date) = [(x or '').replace("'", r"'\''") @@ -109,8 +106,11 @@ def flac2mp3(fn, title, artist, album_artist, album, discnum, date, 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 + pic_options = '' if pics: (fd, picfn) = tempfile.mkstemp() f = os.fdopen(fd, 'wb') @@ -201,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('--check-missing-files', action='store_true', + default=False) except: traceback.print_exc() return 2 @@ -217,6 +219,8 @@ def main(argv): 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 @@ -254,6 +258,16 @@ def main(argv): 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,