|
|
View previous topic :: View next topic |
Author |
Message |
Lordship-SE
Posts: 8
|
Posted: Sat Oct 08, 2011 10:27 am Post subject: Automatically update MyEpisode via uTorrent |
|
|
In case some of you use �Torrent to acquire episodes, I wrote a script that updates MyEpisodes automatically once you have downloaded the episode. It is still very beta but managed a test run without any hiccups.
First, you make .vbs file and fill it with this:
Code: | 'Replace the 5 in the next line with the number of shows you want to track minus one
Dim shows(5,2)
shows(0,0) = "the.big.bang.theory"
shows(0,1) = "1115"
shows(1,0) = "castle.2009"
shows(1,1) = "3920"
shows(2,0) = "house"
shows(2,1) = "57"
shows(3,0) = "terra.nova"
shows(3,1) = "6678"
shows(4,0) = "strike.back"
shows(4,1) = "6607"
shows(5,0) = "the.walking.dead"
shows(5,1) = "6141"
'You can just keep adding more lines here, just remember to edit the Dim line above.
'Fill the array like above with the ,0 part being part of the torrent name in lowercase
'and the ,1 part the show ID on MyEpisodes (you find it by looking at the link
'when hovering over a link in your All-In-One view)
'An example for a torrent name for which this script works is:
'Castle.2009.S04E03.720p.HDTV.X264-DIMENSION
'This assumes that season and episode follow directly after the show name.
'If they don't, but by a constant number of characters, modify the 3 to suit
'your needs.
For i = 0 to UBound(shows)
shows(i,2) = Len(shows(i,0)) + 3
Next
'I know the For loop is klutzy and unneccessary but I can't be bothered to take
'it away. Remnants of an earlier version..
For i = 0 to WScript.Arguments.Count - 1
name = LCASE(WScript.Arguments.Item(i))
For j = 0 to UBound(shows)
If InStr(name,shows(j,0)) <> 0 Then
show = shows(j,1)
season = Mid(name,shows(j,2),2)
'Strike Back Season Workaround, message me if you need another workaround
If shows(j,1) = "6607" Then
season = CInt(season) - 1
End If
episode = Mid(name,shows(j,2)+3,2)
Exit For
End If
Next
Set WshShell = WScript.CreateObject("WScript.Shell")
'Next, change the wget directory, look at your cookies and edit accordingly
WshShell.Run "D:\Programme\wget\wget.exe --no-cookies --header ""Cookie: PHPSESSID=EDIT HERE ;PHPSESSUID=EDIT HERE ;PHPSESSGID=EDIT HERE ;PHPSESSVID=EDIT HERE"" -O - ""http://www.myepisodes.com/myshows.php?action=Update&showid=" & show & "&season=" & season & "&episode=" & episode & "&seen=0",0
Next |
Then you install some version of wget, just google it if you don't have it already and modify the script above so the D:\Programme\wget\wget.exe points to where you have stored your wget. If wget doesn't work, see if you're missing some SSL files.
Next, look at your cookies. I can only help with Firefox, you other browsers will figure it out I believe. Go to your settings and then the Privacy tab. Click on show cookies (or delete single cookies, I don't know, I got the german version) and type in myepisodes there. You will find your values for PHPSESSID, PHPSESSUID, PHPSESSGID and PHPSESSVID, fill them into the script above. I don't know if all of them are needed, but if you use them all, it works.
Now your script is done. All that is left here is save it somewhere as a .vbs file and then set up �Torrent.
In �Torrent, go to Preferences, Advanced and then enter the path and name of the .vbs file followed by %N. It might look something like: "D:\Misc\MyEpisodes.vbs %N" (without the quotes obviously)
Grateful for your guys feedback!
Version 0.1
Known bugs:
*It will reset an already watched episode to unwatched if your RSS downloader decides it wants to download a PROPER after you've seen the episode. No idea how to prevent that other than proper RSS setup. |
|
Back to top |
|
|
Lordship-SE
Posts: 8
|
Posted: Tue Oct 11, 2011 10:30 am Post subject: |
|
|
Version 0.2
* Added Logfile support to avoid setting recently downloaded episodes to unwatched
* Code Cleanup
Code: | Dim shows(11,2)
shows(0,0) = "the.big.bang.theory"
shows(0,1) = "1115"
shows(1,0) = "castle.2009"
shows(1,1) = "3920"
shows(2,0) = "house"
shows(2,1) = "57"
shows(3,0) = "terra.nova"
shows(3,1) = "6678"
shows(4,0) = "strike.back"
shows(4,1) = "6607"
shows(5,0) = "the.walking.dead"
shows(5,1) = "6141"
shows(6,0) = "how.i.met.your.mother"
shows(6,1) = "334"
shows(7,0) = "hawaii.five-0.2010"
shows(7,1) = "6174"
shows(8,0) = "glee"
shows(8,1) = "4687"
shows(9,0) = "blue.mountain.state"
shows(9,1) = "5201"
shows(10,0) = "once.upon.a.time"
shows(10,1) = "8591"
shows(11,0) = "grimm"
shows(11,1) = "8571"
For i = 0 to UBound(shows)
shows(i,2) = Len(shows(i,0)) + 3
Next
show = 0
name = LCASE(WScript.Arguments.Item(0))
For j = 0 to UBound(shows)
If InStr(name,shows(j,0)) <> 0 Then
show = shows(j,1)
season = Mid(name,shows(j,2),2)
'Strike Back Season Workaround
If shows(j,1) = "6607" Then
season = CInt(season) - 1
End If
episode = Mid(name,shows(j,2)+3,2)
Exit For
End If
Next
If show <> 0 Then
'Create Logfile
Set objFSO = CreateObject("Scripting.FileSystemObject")
If Not objFSO.FileExists("myepisodes.log") Then
Set objFile = objFSO.CreateTextFile("myepisodes.log")
Set objFile = nothing
End If
'Read Logfile
Set objTextFile = objFSO.OpenTextFile("myepisodes.log", 1, True)
Dim myepsiodes_log(100,2)
i = 0
'Fill Array
Do while not objTextFile.AtEndOfStream AND i<100
i = i + 1
line = objTextFile.ReadLine
dummy = Split(line,",")
'Compare while reading
If dummy(0) = show AND dummy(1) = season AND dummy(2) = episode Then
objTextFile.Close
WScript.Quit
Else
myepsiodes_log(i,0) = dummy(0)
myepsiodes_log(i,1) = dummy(1)
myepsiodes_log(i,2) = dummy(2)
End If
Loop
objTextFile.Close
'Fill the first line
myepsiodes_log(0,0) = show
myepsiodes_log(0,1) = season
myepsiodes_log(0,2) = episode
'Write new Logfile
Set objTextFile = objFSO.OpenTextFile("myepisodes.log", 2, True)
For j = 0 to i
line = myepsiodes_log(j,0) & "," & myepsiodes_log(j,1) & "," & myepsiodes_log(j,2)
objTextFile.WriteLine(line)
Next
objTextFile.Close
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "D:\Programme\wget\wget.exe --no-cookies --header ""Cookie: PHPSESSID=FILL ;PHPSESSUID=FILL ;PHPSESSGID=FILL ;PHPSESSVID=FILL"" -O - ""http://www.myepisodes.com/myshows.php?action=Update&showid=" & show & "&season=" & season & "&episode=" & episode & "&seen=0",0
End If |
Does what version 0.1 does, only it also creates a logfile with max 100 entries to keep track of what you downloaded so it won't set an episode to unwatched if it is downloaded again. Installation and stuff is still the same as v0.1
Msg me if there are any problems with this
Funny enough, I found a post by myself from 2006 where I outline the idea... The brain is weird sometimes |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
Main design by MW. Refitted to board by Hostile.
|