diff options
Diffstat (limited to '')
-rwxr-xr-x | convert.py | 31 |
1 files changed, 0 insertions, 31 deletions
@@ -7,7 +7,6 @@ import re from subprocess import check_output, STDOUT, CalledProcessError, Popen, PIPE import pexpect import time -#import progressbar import datetime if len(sys.argv) == 3: @@ -21,9 +20,6 @@ else: print("Simple tool for convert mp4 file to mp3") print("Usage:\nconvert.py [SOURCE] [DESTINATION]") -#sourcedir = "/home/neodarz/video_save/ZXAAA Demo ZX Spectrum/Cracktro" -#outdir = "/home/neodarz/video_save/ZXAAA Demo ZX Spectrum_mp3/Cracktro" - def dirSize(path,ext1,ext2): list_dir = [] list_dir = os.listdir(path) @@ -70,39 +66,12 @@ for file in sorted(os.listdir(sourcedir)): totalRange = time.strptime(total.split('.')[0],'%H:%M:%S') totalRangeS = datetime.timedelta(hours=totalRange.tm_hour,minutes=totalRange.tm_min,seconds=totalRange.tm_sec).total_seconds() if re.match(r'.*time=.*', str(unknown_line)): - #print(str(unknown_line)+total) - #print(str(unknown_line).split("=")[2].split()[0]+"/"+total) 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') - #else if print(unknown_line) # for show other type of error thread.close - #pass - - - - - - - - #p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) - - #for line in p.stdout: - # print(str(line.rstrip())) - #p.stdout.flush() - - #try: - # print(str(count)+"/"+str(total)) - #output = check_output(["ffmpeg", "-n", "-i", sourcedir+"/"+name+".mp4", "-c:a", "libmp3lame", outdir+"/"+name+".mp3"], stderr=STDOUT) - #except CalledProcessError as e: - #except CalledProcessError as e: - # print(e.message) - # if os.path.getsize(outdir+"/"+name+".mp3") < os.path.getsize(sourcedir+"/"+name+".mp4") and re.search(r'.*[already exists].*', str(e)): - # print("\n\nout: "+str(os.path.getsize(outdir+"/"+name+".mp3"))+" < source:"+str(os.path.getsize(sourcedir+"/"+name+".mp4"))) - # print("BAD") - #sys.exit(1) except KeyboardInterrupt: # Read the comment here => https://stackoverflow.com/a/1112357 ! os.remove(outdir+"/"+name+".mp3") |