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 | 33cafb994b9f66e6e095cc72307bff5bce0da29b (patch) | |
tree | 07b15fa9ff4acbf8a1512f146383ab5252ea6968 | |
parent | 58f5a092be9509212a9af82f34a899a9b417c78b (diff) | |
download | convert.py-33cafb994b9f66e6e095cc72307bff5bce0da29b.tar.xz convert.py-33cafb994b9f66e6e095cc72307bff5bce0da29b.zip |
Add multi extension support. Added mkv and webm
Diffstat (limited to '')
-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+",'(.+)']) |