From e0f179cda4477d0ea2a5bc8aca83ccf136ed9147 Mon Sep 17 00:00:00 2001 From: yomguy Date: Fri, 1 May 2009 17:56:53 +0000 Subject: [PATCH] don't overwrite files git-svn-id: http://svn.parisson.org/svn/telemaster/trunk@13 353fd7da-fb10-4236-9bec-1a49139083f2 --- flac2mp3mix.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/flac2mp3mix.py b/flac2mp3mix.py index 713c0d8..3807591 100644 --- a/flac2mp3mix.py +++ b/flac2mp3mix.py @@ -107,18 +107,21 @@ class Flac2Mp3Mix: metadata = flac.get_tags() album_name = metadata['album'] mp3_file = self.dest_dir + os.sep + album_name + '.mp3' - #if not os.path.exists(mp3_file): - f = self.flac_player(media_list, None) - m = self.mp3_encode(f.stdout, mp3_file) - print 'Encoding ' + mp3_file - m.proc.wait() - print 'Writing metadata...' - mp3 = Mp3(mp3_file) - mp3.metadata = metadata - mp3.metadata['title'] = album_name - mp3.metadata['comment'] = 'Cellar_playlist' - mp3.write_tags() - print 'Done !' + if not os.path.exists(mp3_file): + f = self.flac_player(media_list, None) + m = self.mp3_encode(f.stdout, mp3_file) + print 'Encoding ' + mp3_file + m.proc.wait() + print 'Writing metadata...' + mp3 = Mp3(mp3_file) + mp3.metadata = metadata + mp3.metadata['title'] = album_name + mp3.metadata['comment'] = 'Cellar_playlist' + mp3.write_tags() + print 'Done !' + else: + print 'File already exits !' + print mp3_file if __name__ == '__main__': -- 2.39.5