我知道标题真的很模糊,但不管怎样,我有一个脚本,一旦torrent下载完成,我就可以下载剧集或电影的字幕。输入必须是下载文件的文件路径。方便的是,uTorrent支持在torrent完成下载后运行脚本,并将文件路径作为其“参数”之一。我尝试使用以下命令运行脚本
C:\python\subtitles.py %D其中%D是文件路径支持的utorrent参数。这不起作用,因为脚本加载,然后提示用户input.Any帮助如何自动化这将是很有帮助的。
from datetime import timedelta
from babelfish import Language
from subliminal import download_best_subtitles, region, save_subtitles, scan_videos
import os
# configure the cache
region.configure('dogpile.cache.dbm', arguments={'filename': 'cachefile.dbm'})
path = str(input("enter filepath:"))
# scan for videos newer than 1 week and their existing subtitles in a folder
videos = scan_videos(path, age=timedelta(days=7))
print("scan success")
# download best subtitles
subtitles = download_best_subtitles(videos, {Language('eng')})
print("downloads done")
# save them to disk, next to the video
for v in videos:
save_subtitles(v, subtitles[v])发布于 2020-08-26 01:46:03
这是因为当您的bittorrent客户端将路径作为命令行参数传递时,您正在尝试从stdin获取“参数”。
将path = str(input("enter filepath:"))替换为
import sys
path = sys.argv[1]它会起作用的。
https://stackoverflow.com/questions/62114305
复制相似问题