Browse Source

Convert the song only if necessary

pull/108/head
Oliverpool 9 years ago
parent
commit
e6acaab45e
  1. 2
      patacrep/songs/convert/__main__.py

2
patacrep/songs/convert/__main__.py

@ -57,12 +57,12 @@ if __name__ == "__main__":
for file in song_files: for file in song_files:
song = song_parsers[source]("", file, DEFAULT_CONFIG) song = song_parsers[source]("", file, DEFAULT_CONFIG)
try: try:
converted = song.render(dest)
destname = "{}.{}".format(".".join(file.split(".")[:-1]), dest) destname = "{}.{}".format(".".join(file.split(".")[:-1]), dest)
if os.path.exists(destname) and not remember: if os.path.exists(destname) and not remember:
overwrite, remember = confirm(destname) overwrite, remember = confirm(destname)
if not overwrite: if not overwrite:
continue continue
converted = song.render(dest)
with open(destname, "w") as destfile: with open(destname, "w") as destfile:
destfile.write(converted) destfile.write(converted)

Loading…
Cancel
Save