summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconvert.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/convert.py b/convert.py
index 0316127..881aa76 100755
--- a/convert.py
+++ b/convert.py
@@ -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+",'(.+)'])