]> git.parisson.com Git - telemaster.git/commitdiff
don't overwrite files
authoryomguy <yomguy@353fd7da-fb10-4236-9bec-1a49139083f2>
Fri, 1 May 2009 17:56:53 +0000 (17:56 +0000)
committeryomguy <yomguy@353fd7da-fb10-4236-9bec-1a49139083f2>
Fri, 1 May 2009 17:56:53 +0000 (17:56 +0000)
git-svn-id: http://svn.parisson.org/svn/telemaster/trunk@13 353fd7da-fb10-4236-9bec-1a49139083f2

flac2mp3mix.py

index 713c0d846e8225b3a1f8d2b63db2f5cee7350b52..38075916f177ff8cef19f1017032691837f198d7 100644 (file)
@@ -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__':