Autodownload script

Come up with a useful post-processing script? Share it here!
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: Autodownload script

Post by markus101 »

Using 0.81 I'm having issues with it doing anything more than checking if I want a show.

My Debug Output is like this:

Code: Select all

Processing: Show - 5x13
NZB: Show
TVDB: Show
Using Smart Queue Check
CHECK WANTED: Show
LOOKING: /mnt/user/tv/Show
SHOW WANTED: Show
Then it moves on to process the next show, it happened for the Simpsons and House using Newzbin.
I tried running it against a NZBS.org feed, processed to the point of finding a match...then returned this gibberish:

Code: Select all

MATCH FOUND: ^([0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\!\@\Â\£\$\%\^\&\*\(\)\_\+\=\-\[\]\:\{\}\"\'\.\,\<\>\`\~\?\ ]+?)[ \._\-][Ss]([0-9]+)[\.\- ]?[Ee]([0-9]+)[^\/]*$
Newzbin support is broken, but other than the odd bug there, other feeds seem to work.
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
minimad
Release Testers
Release Testers
Posts: 62
Joined: January 11th, 2009, 5:45 pm

Re: Autodownload script

Post by minimad »

OK,

Thought I broke something.

The MATCH FOUND gibberish is actually the regex pattern that matched the file for season x episode x.  Fixed in 0.82 (simple print statement really), just te=old it to print the season no and episode no rather than the pattern.  It's a hold over from the way that I was looking for files, the regex pattern was something more readable but very naming specific.

I'll try to test the NewzBin feed out tonight, now that I have an account (thanks markus)
pinion
Newbie
Newbie
Posts: 17
Joined: January 26th, 2009, 2:21 am

Re: Autodownload script

Post by pinion »

What do I need to do to get this script running as a cron job? I tried just going to system|advanced|cron and running the same command I used to run it from the terminal... python2.5 /mnt/Scratch/rssmovies.py but that's not working.  I've never really dealt with cron jobs so I don't know what I'm doing.  Also can I get some help as to what this line does and how it could be changed for different star rating and total number of votes. 

Code: Select all

if re.compile("<b>[7-9]\.[0-9]/10</b>").search(htmlSource) and re.compile(">[0-9]*,[0-9][0-9][0-9] votes<").search(htmlSource):
I assume the first part if I change the 7 to like 5 it will give me movies rated 5-9.9 right?  What about the next part though?  I want to know how to change it to different values to fiddle with it.  Thanks for the help!
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: Autodownload script

Post by markus101 »

I use the following in CronTab to run this python script:

Code: Select all

*/15 * * * * /boot/scripts/rss_tv.sh 2>&1 > /dev/null
- I don't need output errors of the shell script, so they get put to /dev/null
rss_tv.sh contains the following:

Code: Select all

python /boot/scripts/rss_tv.py >> /mnt/staging/SABnzbd/logs/rss_tv_nb.log
Which will allow me to log what went on during the script (at least in this time of change for it), plus I can make changes to the shell script and not have to make changes to CronTab (which can be a PITA),

You can run the script directly from cron with the following:

Code: Select all

*/15 * * * * python /boot/scripts/rss_tv.py 2>&1 > /dev/null
- will put all errors and output to /dev/null

The above examples run the script every 15 minutes, which is what I previously had my RSS feeds in SAB to scan at.

You can edit CronTab directly with

Code: Select all

crontab -e
list its contents with

Code: Select all

crontab -l
You can also import an update Crontab file...
First output the current crontab to a file then add the lines and then import it... For example:

Code: Select all

crontab -u root -l /tmp/crontab.root
- Dumps crontab for the user "root"
Edit crontab as you need to, then run the following to import the changes:

Code: Select all

crontab /tmp/crontab.root -u root

Hope this helps.

markus
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: Autodownload script

Post by markus101 »

Found an issue with something....really odd error... here is the log in a pastebin...not sure how it confused Season 13 with being Season 01...

Also if the Season is not being ignored, but there is no folder the script tries to look in the folder but as it doesn't exist, it just moves on... SAB can handle creating the folder, so in this case would it be possible for the script to know (SMART check for files) and just download the file? With the above error it said couldn't fine Season 01, so I created the folder, even though it really was looking at Season 13... maybe a moot point for shows that check out properly, but then I also would have to create new folders when a new season starts.

Pastebin log dump: http://pastebin.com/m219f8a87

Thanks again,

Markus

PS - Suggested Release name, Newzbin FTW/FTL depending on how well tonight goes for fixing the Newzbin support:)
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
minimad
Release Testers
Release Testers
Posts: 62
Joined: January 11th, 2009, 5:45 pm

Re: Autodownload script

Post by minimad »

Hi Markus,

Check around line 613 (function reformatReport) in v0.81, I thought it might get caught up there, the assumption is that the series for a 1x01 style won't go above 9 series,hence the S0 put on the start.  Line 577 (function formatReport) is the NEW and IMPROVED function to deal with season & episode numbers, not finished yet though, might by ready for 0.83, depends really (it's the wife's 30th tomorrow).

I thought the script would download the file if it couldn't find the directory, might need a bit more testing or is it that i've sorted in the next version, damn can't remember.
Cuchulainn
Release Testers
Release Testers
Posts: 7
Joined: December 1st, 2008, 9:11 am

Re: Autodownload script

Post by Cuchulainn »

I am trying to incorporate the Rotten Tomatoes rating in the movie script adjusted for nzbs.org by xxhds. I isolated the imdb code for the movie with

Code: Select all

                code_title = re.sub(".+title\/tt","",imdb_link)
                code_title = re.sub("\/","",code_title)
and parsed the rottentomatoes page for the movie with

Code: Select all

        sock=urllib.urlopen("http://www.rottentomatoes.com/alias?type=imdbid&s="+code_title)
        rottenSource = sock.read()
        sock.close()
So far so good. Now the problem is to get the rating from the page. I found the html-code for the rating:

Code: Select all

<div id="tomatometer_score" style="">
    <span class="percent">76</span>    <sup class="symbol ">%</sup>
</div>
Could someone help me with the python code to get the movie rating from this code? I tried

Code: Select all

score = re.compile("<span class=\"percent\">.+?<).search(rottenSource)
and a couple of variations on this, but I could not get it to work.
Last edited by Cuchulainn on January 31st, 2009, 10:43 am, edited 1 time in total.
rollingeyeball
Release Testers
Release Testers
Posts: 181
Joined: January 30th, 2009, 12:26 pm

Re: Autodownload script

Post by rollingeyeball »

I've read this thread few a few times now, some great work has been goin on, but mainly with the tv script =/
I use episode butler for my TV, much less hassle.

Can someone kindly post the latest working movie script?
I have newzbin, so the newzbin version would be preferable..
I tried a few I found here but keep getting errors.

If any of the script makers here want a newzbin invitation, while I don't have any yet, I've posted some very valuable info in the newzbin invite thread.

NINJAEDIT:
Rotten Tomatoes lookup would be bliss
minimad
Release Testers
Release Testers
Posts: 62
Joined: January 11th, 2009, 5:45 pm

Re: Autodownload script

Post by minimad »

Hi rollingeyeball,

Episode Butler could be less hassle but most of us don't have a newzbin account, it's the main reason I've been developing my branch of the script.

Also from what I've read on the episode butler website (please correct me if I'm wrong) but it doesn't check if you already have the episode and doesn't check which format you require (proably because newzbin can do that bit for you), the script i've developed although still beta is now able to check most naming conventions used for tv shows so it doesn't download an episode you already have, but it does download one that you might be missing (and you might not realise your missing)

I've not worked on the movie script because it doesn't interest me that much.

I now have a NewzBin account but to be honest, I'm only using it for testing my script.

If you post the errors your getting then I might be able to point you in the right direction for a fix.

@All,
version 0.85 (yep, i've jumped a few versions) is currently in inital testing by me.  I'm going to put this script under SVN and will post the location.  I'll put all changes from v0.7 upwards in, just in case anyone wants to go to a previous one.

I think i've fixed most of the errors so when I'm happy I'll post it.
rollingeyeball
Release Testers
Release Testers
Posts: 181
Joined: January 30th, 2009, 12:26 pm

Re: Autodownload script

Post by rollingeyeball »

You do make some good points.

Episode butler doesn't specifically check if you have it, but it doesn't download the same ep more than once, you can set it to start @ ep x and it'll just work on from there, this is better in my case I thin, because I have some tb shows that I .. don't want any more of.
Example, I I have 3 episodes of house in my tv directory for a friend, I don't want every other episode.
I have to specifically add the shows I want to automatically dl with butler, which is a welcome thing.
If you have maybe.. an exclusion folder, or exclusion filename wildcard support or some other workaround, I'll drop butler in an instant.

I'll post the errors with the movie script shortly :P

EDIT:
Forgot to mention, It does have certain options for format/quality
High/Low/Medium
Don't ask me how it works it out though.

I'd prefer to use yours if I could.
Last edited by rollingeyeball on January 31st, 2009, 5:28 pm, edited 1 time in total.
minimad
Release Testers
Release Testers
Posts: 62
Joined: January 11th, 2009, 5:45 pm

Re: Autodownload script

Post by minimad »

Hi rollingeyeball,

Well funny you should say that, The script does have exculsion support, you just create a file or directory called 'ignore Season 04' under say Z:\House and it will ignore any further files for season 4, assuming your using two digit season numbers ('ignore Season 4' if you using single digit).  If you don't want a particular episode then just creating a empty file with the correct name will stop the script downloading it

You have to have the main show directory e.g. Z:\House for the script to download it, no House dir, no download.  Similar to having to specify in episode butler.

It might take a hour or so (depends on your TV Storage, mine's just over 1TB, but pilGrims i think is over 7TB), to setup the first time.

How are you files named?  If you need to rename them to something more conventional then pilGrim has posted the options available (page 7 I think), I've used most, but currently I'm sticking to tvnamer.py from the tvdb_api (although mildly modified to move files as it renames them, and to cope with CSI, those damn : and the inconsistant way people name the show CSI: NY, CSI: New York etc and the seraching for CSI (Las Vegas one) on theTVDB the first return is CSI: NY so my odded version gets round this).

Regards

Minimad
Stokkes
Newbie
Newbie
Posts: 32
Joined: January 23rd, 2009, 10:28 pm

Re: Autodownload script

Post by Stokkes »

Looking forward to that new version with the Season fixes :)
pilGrim
Full Member
Full Member
Posts: 116
Joined: January 9th, 2009, 7:28 pm
Location: Hong Kong, SAR China

Re: Autodownload script

Post by pilGrim »

minimad wrote:
It might take a hour or so (depends on your TV Storage, mine's just over 1TB, but pilGrims i think is over 7TB), to setup the first time.
My TV Show collection is 1.7 TB and but I have LOTS of free space with my unRaid file server.  As a result I really do not worry about picking up seasons that I will probably never watch.  I simply go in every so often and delete them out.  For example I have the first 3 seasons of ER and have no desire to pick up seasons 4 - 15.  I like the fact that the new script allows me to build either directories or file names to ignore seasons, but I have been too lazy to set it all up.

Renaming that many shows was a little daunting at first but with ReNamer and the TV_Rename.py script it was a snap and took me all of 5 min.

pilGrim
Last edited by pilGrim on January 31st, 2009, 8:51 pm, edited 1 time in total.
rollingeyeball
Release Testers
Release Testers
Posts: 181
Joined: January 30th, 2009, 12:26 pm

Re: Autodownload script

Post by rollingeyeball »

I use TvRenamer
from TVRenamer.com

I like it, because it moves as well as renaming, and it has commandline support now too, though thats a bit primitive currently.
I dont have many shows at all.
My Internet provider quota is somewhat limiting, but I get what i need to so I have approx.. 200gb?

How do you guys trigger these to run?
I'm on windows and I don't know how to use the post processing feature at all, the wiki for it is pretty bad.
When these are working I'll want these to run, and even now I can't figure out how to run TVRenamer

*removed link*
Those are the errors I recieve with the movie script.
Nothing gets added at all.
Used a new folder for that too, so sometimes it says have it- yes it's just total BS
http://pastebin.com/f52a9a492
Thats the script.

I'll try the TV script now, now that I know it'll suit me :D
Last edited by rollingeyeball on February 20th, 2009, 1:21 pm, edited 1 time in total.
rollingeyeball
Release Testers
Release Testers
Posts: 181
Joined: January 30th, 2009, 12:26 pm

Re: Autodownload script

Post by rollingeyeball »

http://cl1p.net/sadface/

It just ends like that.
Is it meant to?
I'm opening these in IDLE editor and running from there btw, in case it makes a difference.
Haven't used python for too long (I've meddled a little before, years ago)
Post Reply