2
我写了一个python脚本,使mpv的使用更容易(cim是标题)。启动MPV的Python脚本
这里的脚本:
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.
差不多所有的命令行解析器都以相同的方式处理'='和空白,所以使用单独的参数确实是更清晰。实际上,单独的参数更有可能起作用,因为这是在C代码中获得参数而不涉及字符串操作的简单方法(特别是如果不使用getopt等) – ThiefMaster
是的,我有一个快速尝试,它似乎工作所以我会交换修复的顺序。 – dshepherd
是的,它的工作原理,感谢您的答案! – Pentagon98