For those of You who love to watch TV shows downloaded from internet .. but hate the procedure of finding the correct torrent file and subtitles I will present a way to automate the whole process.
What we will need:
Let's begin.
c:\MyScripts\download.vbs
Set Utorrent - Preferences - Advanced - Run Program :
Run This program when torrent finishes
c:\MyScripts\download.vbs "%D" "%F" %K
Run When torrent changes state
c:\MyScripts\download.vbs "%D" "%F" %K %S
What we will need:
- Utorrent client: http://www.utorrent.com/
- Python 2.7.3 http://www.python.org/download/releases/2.7.3/
- BeautifulSoup 3.2.1 (Python library)
http://www.crummy.com/software/BeautifulSoup/
http://www.crummy.com/software/BeautifulSoup/download/3.x/BeautifulSoup-3.2.1.tar.gz - Periscope (Python module)
http://code.google.com/p/periscope/
python-periscope_0.2.4.orig.tar.gz
(Or use my python-periscope_0.2.4.orig.plirkee.repack)
Let's begin.
- Utorrent (briefly, cause you can find information on how to do this on many sites)
- First you install Utorrent and open it.
- Right click on Feeds and add new Rss feed
(it could be any rss feed of your favorite site mine is EzTv so I add rss feed with feed url: http://feeds.feedburner.com/eztv-rss-atom-feeds?format=xml ) - Go to Options => Rss downloader and Add new rule for your favorite show...
- Python
- install python to c:\python27
- download BeautifulSoup, unzip it into c:\python27\BeautifulSoup,
run form command prompt:cd c:\python27\BeautifulSoup\
setup.py install - download Periscope, unzip it into c:\python27\Periscope,
run from command prompt:cd c:\python27\Periscope\
setup.py install - go to your user's folder (C:\Users\USERNAME) (this folder is defined ether by %HOME% or %USERPROFILE% or %HOMEDRIVE%%HOMEPATH% env variables) from command prompt and create directory with name ".config" e.g.
- cmd
- cd C:\Users\USERNAME
- mkdir .config
- Vb Script
- create .vbs file that will handle subtitle downloading
'In v5 uTorrent kind (%K) support is added kind can be single or multi Const RUN = "C:\Python27\python.exe C:\Python27\scripts\periscope" Const LANGS = "-l el -l en" Const LOGFILE_POSTFIX = "_downloader.log" Const SUB_EXT = "srt" Const EXPECETED=3 ' utorrent pause code Const FORAPPENDING = 8 Const LEAST_NUM_OF_ARG=3 ' (0) = Directory (1) = File (2) = Kind + optional (3) = Status Const KIND_MULTI = "multi" On Error Resume Next Dim directory,file,kind,extension,whatToRun set objFSO = CreateObject("Scripting.FileSystemObject") Function log(logfile,str) set objFile = objFSO.OpenTextFile(logfile, FORAPPENDING, True) objFile.WriteLine("Time Stamp: " & Now) objFile.WriteLine(" " & str) objFile.Close set objFile=Nothing End Function if ( WScript.Arguments.CountLEAST_NUM_OF_ARG) then if (WScript.Arguments.Count=LEAST_NUM_OF_ARG+1 and WScript.Arguments(LEAST_NUM_OF_ARG)<>CStr(EXPECETED)) then 'Wscript.Echo "Arg3 unexpected value" & WScript.Arguments(2) &" " & EXPECETED log logfile,WScript.Arguments(1) & "Arg3 unexpected value " & WScript.Arguments(2) &" was expecting " & EXPECETED WScript.quit() end if end if extension = Right(file,3) if kind=KIND_MULTI then whatToRun = RUN & " " & LANGS &" " & chr(34) &directory& chr(34) else whatToRun = RUN & " " & LANGS &" " & chr(34) &directory&"\" &file& chr(34) if (extension<>"mp4" and extension<>"avi" and extension<>"mkv") then 'Wscript.Echo "unsupported extension:" & extension log logfile,"unsupported extension:" & extension WScript.quit() end if end if log logfile,"Will try " & file Set WshShell = WScript.CreateObject("WScript.Shell") 'WshShell.Run "cmd.exe /c start /min " WshShell.Run "cmd.exe /c " &_ " echo %date% %time% " &_ directory & " " & file & whatToRun & " >> " & logfile & " &" &_ whatToRun & " >> "&logfile&" 2>&1"&_ " & exit",0,True newFile = left(file,len(file)-3)&SUB_EXT 'Wscript.Echo(newFile) If objFSO.FileExists(chr(34) & directory&"\"&newFile &chr(34)) Then 'Wscript.Echo("Downloaded subtitles for " & file) End If set objFSO=nothing Set WshShell=nothing
Run This program when torrent finishes
c:\MyScripts\download.vbs "%D" "%F" %K
Run When torrent changes state
c:\MyScripts\download.vbs "%D" "%F" %K %S
Of course you could create your own .bat file as I did at first. In that case I would recommend you to call it with following command: "cmd.exe /c start /min C:\MyPythonSubsDowloader.bat "%D" "%F" %K %S ^& exit", from utorrent. The downside of using bat file is the flickering of dos window that appears every time torrent state changes.
Also, as you can see in vbs, the script tries to download Greek and English subs [Const LANGS = "-l el -l en"], you can add your own languages by changing that line.
Any way, we have finished our task. Now any time video has finished downloading ..or whenever you hit pause on downloaded video in utorrent - subtitle search is performed.
I use utorrent pause (state code = 3) to cause downloading of subtitles at time of my choosing ...and use it in cases when no subs are found, the first time the torrent finished.
P.S. Also, it seems that currently there are some problems with a number of plugins of periscope (v 0.2.4) .. but you can download my fixes for Addic7ed and TVsubtitles. If you do, then don't forget to un-comment these plugins in periscope\plugins\__init__.py before executing setup.py install
P.S2 I upgraded the download vb script to v5 (24/07/2013) now it downloads subs even if you are getting muti-item torrent (e.g. complete season). The old version of the script is still available @ my support site.
From there you can download my repack of periscope which includes all the above fixes.