如何自动下载种子字幕



我知道标题真的很模糊,但无论如何,我有一个脚本,用于在种子下载完成后下载系列或电影的字幕。输入需要是下载文件的文件路径。方便的是,uTorrent支持在种子完成下载后运行脚本,并将文件路径作为其"参数"之一。我尝试运行脚本

C:pythonsubtitles.py %D

其中 %D 是文件路径支持的 utorrent 参数。这不起作用,因为脚本加载然后提示用户输入。有关如何自动化此操作的任何帮助都会有所帮助。

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])

这是因为当您的bittorrent客户端将路径作为命令行参数传递时,您正在尝试从stdin获取"参数"。

path = str(input("enter filepath:"))替换为

import sys
path = sys.argv[1]

它会起作用的。

最新更新