From: epg <> Date: Wed, 5 Dec 2007 08:46:08 +0000 (+0000) Subject: (run_flac): Only add --picture option if cover.front exists. X-Git-Url: https://diplodocus.org/git/flac-archive/commitdiff_plain/d30bcd2d78bf0019cb2bbbcb9f25dc20746e29ee?ds=inline;hp=ee9d8a3653ab259b0716fe801c0067956d235e49 (run_flac): Only add --picture option if cover.front exists. (flac): Keep unlinking even if unlink(cover.front) fails. Suggested by: Martin Michlmayr --- diff --git a/fa-flacd b/fa-flacd index e291b75..6488ef5 100755 --- a/fa-flacd +++ b/fa-flacd @@ -109,7 +109,8 @@ def run_flac(infile, cue, outfile, tags): argv.extend(['-T', i]) argv.append(infile) # flac 1.1.3 PICTURE support - argv.extend(['--picture', '3|image/jpeg|||cover.front']) + if os.path.exists('cover.front'): + argv.extend(['--picture', '3|image/jpeg|||cover.front']) spew('Running flac\n') status = os.spawnvp(os.P_WAIT, argv[0], argv) @@ -189,7 +190,10 @@ def flac(dir, tracknum, tags): ld = os.listdir(dir) if ld == ['using-tags'] or sorted(ld) == ['cover.front', 'using-tags']: try: - os.unlink(dir + '/cover.front') + try: + os.unlink(dir + '/cover.front') + except OSError: + pass os.unlink(dir + '/using-tags') os.rmdir(dir) except EnvironmentError: