diff options
-rwxr-xr-x | convert.py | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -47,7 +47,12 @@ for file in sorted(os.listdir(sourcedir)): try: name = file[:file.rfind(".")] if file.endswith(".mp4"): - print("Converting : "+name) + exist = False + if os.path.isfile(outdir+"/"+name+".mp3"): + if os.path.getsize(sourcedir+"/"+name+".mp3") == os.path.getsize(outdir+"/"+name+".mp3"): + print("File "+sourcedir+"/"+name+".mp3 already exist. Use -y for overwrite.") + else: + print("Converting : "+name) count += 1 #cmd = ["ffmpeg", "-n", "-i", sourcedir+"/"+name+".mp4", "-c:a", "libmp3lame", outdir+"/"+name+".mp3"]² cmd = "ffmpeg "+arg+" -i '"+sourcedir+"/"+name+".mp4' -c:a libmp3lame '"+outdir+"/"+name+".mp3'" @@ -77,7 +82,7 @@ for file in sorted(os.listdir(sourcedir)): if re.match(r'.*time=.*', str(unknown_line)): timeRange = time.strptime(str(unknown_line).split("=")[2].split()[0].split('.')[0],'%H:%M:%S') timeRangeS = datetime.timedelta(hours=timeRange.tm_hour,minutes=timeRange.tm_min,seconds=timeRange.tm_sec).total_seconds() - print(str(round(100*timeRangeS/totalRangeS, 1))+"% / 100%", end='\r') + print(str(round(100*timeRangeS/totalRangeS, 1))+"% / 100% "+str(exist), end='\r') thread.close |