diff options
author | NeodarZ <neodarz@neodarz.net> | 2017-10-15 14:38:33 +0200 |
---|---|---|
committer | NeodarZ <neodarz@neodarz.net> | 2017-10-15 14:38:33 +0200 |
commit | b541f0f1cb916c83d0565b3a1aa3e0ffb4356d21 (patch) | |
tree | 92d451cb9b178cb2e34d96f78f49e4a9caf46dc9 | |
parent | 561e58bce1d7464fcd3fe6a778848d2df7bf7b40 (diff) | |
download | video_save-b541f0f1cb916c83d0565b3a1aa3e0ffb4356d21.tar.xz video_save-b541f0f1cb916c83d0565b3a1aa3e0ffb4356d21.zip |
Add multi extension support. Added mkv and webm
-rwxr-xr-x | convert.py | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -53,16 +53,17 @@ count = 0 for file in sorted(os.listdir(sourcedir)): try: name = file[:file.rfind(".")] - if file.endswith(".mp4"): + ext = [".mp4", ".mkv", ".webm"] + if file.endswith(tuple(ext)): exist = False if os.path.isfile(outdir+"/"+name+".mp3"): - if os.path.getsize(path_rm_end_slash(sourcedir)+"/"+name+".mp4") == os.path.getsize(outdir+"/"+name+".mp3"): + if os.path.getsize(path_rm_end_slash(sourcedir)+"/"+file) == os.path.getsize(outdir+"/"+name+".mp3"): print("File "+path_rm_end_slash(sourcedir)+"/"+name+".mp3 already exist. Use -y for overwrite.") else: - print("Converting : "+name) + print("Converting : "+file) count += 1 #cmd = ["ffmpeg", "-n", "-i", sourcedir+"/"+name+".mp4", "-c:a", "libmp3lame", outdir+"/"+name+".mp3"]² - cmd = "ffmpeg "+arg+" -i '"+path_rm_end_slash(sourcedir)+"/"+name+".mp4' -c:a libmp3lame '"+outdir+"/"+name+".mp3'" + cmd = "ffmpeg "+arg+" -i '"+path_rm_end_slash(sourcedir)+"/"+file+"' -c:a libmp3lame '"+outdir+"/"+name+".mp3'" thread = pexpect.spawn(cmd) cpl = thread.compile_pattern_list([pexpect.EOF,"frame= *\d+",'(.+)']) |