我编写了一个python脚本来简化mpv的使用(cim就是标题)。
下面是剧本:
from sh import mpv
cim=input("Cím: ")
a=int(input("with start(1) | without start (2) "))
b=int(input("with sub (1) | without sub(2) "))
if a == 1:
#w/ start
c=input("xx:yy:zz : ")
if b == 1:
#w/ sub
sh.mpv(cim,"--sub-file=",d,"start=",c)
elif b == 2:
#w/ sub
sh.mpv(cim,"start=",c)
elif a == 2:
#nincs start
if b == 1:
#w/ sub
d=input("sub: ")
sh.mpv(cim,"--sub-file=",d)
if b == 2:
sh.mpv(cim)当我尝试运行它时:
RAN:
'/usr/bin/mpv Red Museum.avi --sub-file= eng.srt'
STDOUT:
Error parsing option sub-file (option requires parameter)
Setting commandline option --sub-file= failed.发布于 2015-05-01 08:19:06
问题似乎在于--sub-file=和eng.srt之间的额外空间。您可以通过移除=来修复它,以便mpv希望它们被一个空格隔开。即更换线路
sh.mpv(cim,"--sub-file=",d)使用
sh.mpv(cim,"--sub-file", d)如果这样做不起作用,您可以通过使用字符串连接来消除额外的空间:
sh.mpv(cim,"--sub-file=" + d)https://stackoverflow.com/questions/29983320
复制相似问题