Autodownload script

Come up with a useful post-processing script? Share it here!
popcornarsonist
Newbie
Newbie
Posts: 13
Joined: January 28th, 2008, 6:53 pm

Re: Autodownload script

Post by popcornarsonist »

Flambard wrote: Both the TV & Movies scripts are working great for me now, but I do have one small problem with them. If the any part of the title pulled from the Newzbin RSS feeds has a colon in it, the script translates it somehow to a semicolon when creating the queue item. This in itself isn't a problem, but if the same show/movie comes up again, the same item gets added back to the queue as the script doesn't "see" it as a duplicate.
I've noticed this problem myself, and it's on my list of updates, but I probably won't get around to it for another week or so.
Camelot
Jr. Member
Jr. Member
Posts: 64
Joined: August 18th, 2008, 6:23 am

Re: Autodownload script

Post by Camelot »

...  translates it somehow to a semicolon when creating the queue item...
This is actually a feature that was recently added to Sabnzbd, so don't blame the script :)

The best way to solve this is probably for the author of the script to edit it so that it converts the titles itself before comparing (either the sabnzbd ones or the ones that are potentially being added)
Flambard
Newbie
Newbie
Posts: 23
Joined: November 4th, 2008, 12:21 pm

Re: Autodownload script

Post by Flambard »

I've managed to fix this by using :

Code: Select all

def isMissing(check_movie_title):
        check_movie_title_clean = check_movie_title.replace(':',';')
        if os.path.exists(movie_dir + "\\" + check_movie_title_clean + ".avi") or os.path.exists(movie_dir + "\\" + check_movie_title_clean):
and :

Code: Select all

def download(report_id):
        movie_title_clean = movie_title.replace(':',';')
        print time.strftime("%Y-%m-%d %H:%M:%S")+": "+ movie_title_clean
and :

Code: Select all

                movie_title_clean = movie_title.replace(':',';')
                report_title_clean = report_title.replace(':',';')
                print("Checking: " + movie_title)
                if (isGoodMovie(htmlSource) == 1) and (isMissing(movie_title_clean) == 1) and (isInQueue(report_title_clean) == 0):
                        msgid=node.getElementsByTagName("report:id")[0].childNodes[0].data
                        download(msgid)
This basically changes the : to a ; in the same places as sabnzbd+ does when creating folders. I probably don't need to qualify the changes so many times throughout the script, but don't have the time/expertise right now to do it 'properly' =)
frankhuzzah
Newbie
Newbie
Posts: 6
Joined: November 8th, 2008, 8:10 pm

Re: Autodownload script

Post by frankhuzzah »

I've noticed something similar, but instead of with the colon/semicolon I think it has to do with parenthesis.  In my case the problem is with a TV show that Newzbin designates with a year, for example, Great New Show (2008).  Sabnzbd downloads it and locates it into the correct folder struction (Great New Show (2008)/Season 1/Great New Show (2008) - 1x01 - Example.avi).  For some reason, however, the script doesn't seem to see that the episode is in there and downloads the same episode over and over again.  It is properly recognizing that I want that show, just now the episodes.  That is what makes me think it is actually the parenthesis in the actual filename that are causing problems.

I'm going to keep working on it tonight when I get off of work, but any suggestions would be greatly appreciated.
popcornarsonist
Newbie
Newbie
Posts: 13
Joined: January 28th, 2008, 6:53 pm

Re: Autodownload script

Post by popcornarsonist »

frankhuzzah wrote: I've noticed something similar, but instead of with the colon/semicolon I think it has to do with parenthesis. 
I probably told my script to ignore parenthesis, since I don't use them. I'm planning on changing that, though.
Camelot wrote: The best way to solve this is probably for the author of the script to edit it so that it converts the titles itself before comparing (either the sabnzbd ones or the ones that are potentially being added)
I'm aware of this issue, and have it on my list of updates. I'm going to try to update the script this weekend, and this should allow it to work with any special character, not just colons.
interfacelift wrote: I'd love to see one based on Rotten Tomatoes ratings instead of IMDB :-)
I found a pretty easy way to do this, so it should be a quick feature to add. I'll update the OP when I make these changes.
xxhds
Release Testers
Release Testers
Posts: 15
Joined: October 11th, 2008, 8:16 pm
Contact:

Re: Autodownload script

Post by xxhds »

First of all thanks a lot to popcornarsonist for the awesome script!

Now, I am not an newzbin member and I do not want to pay to search.  So I looked at some other rss feeds and modified the script to use a http://www.nzbs.org rss feed instead.  I also changed it to download at a rating of 6 and 1000+ votes.  Here is my version of the script:

rss_movies.py
UPDATED:  http://pastebin.com/f1c42f76b
OLD: http://pastebin.com/fc70f284


~xxhds
Last edited by xxhds on November 24th, 2008, 7:24 pm, edited 1 time in total.
revelation_22
Newbie
Newbie
Posts: 21
Joined: October 19th, 2008, 12:21 pm

Re: Autodownload script

Post by revelation_22 »

SABnzbd+ 0.4.5 didn't like the following line of the rss_movies script. I'm using xxhds' version for nzbs.org. Jobs did not get assigned to a category;
urllib.urlopen("http://host:port/sabnzbd/api?mode=addid&name="+msgid+"&cat=\"movies\"")
I changed it to;
urllib.urlopen("http://host:port/sabnzbd/api?mode=addurl&name="+msgid+"&cat=movies")
and jobs are added to the proper category.

Also, I have ran into the issue parenthesis causing the nzb to be added to the queue each time the script is run. Any idea how to fix this?

Thanks for the great script.
Last edited by revelation_22 on November 23rd, 2008, 7:19 pm, edited 1 time in total.
xxhds
Release Testers
Release Testers
Posts: 15
Joined: October 11th, 2008, 8:16 pm
Contact:

Re: Autodownload script

Post by xxhds »

since popcornarsonist disappeared it seems, Ill look into the parenthesis and other characters problem tomorrow.  Should be a pretty easy fix.  I havent set mine up to run as a cron job yet, ive just used it manually a few times.  But ill keep working on the bugs.
frankhuzzah
Newbie
Newbie
Posts: 6
Joined: November 8th, 2008, 8:10 pm

Re: Autodownload script

Post by frankhuzzah »

I've been trying to figure it out, but I've got no Python scripting experience.  I can read the script and basically understand what it is doing, just don't know how to tell it to do something else!
xxhds
Release Testers
Release Testers
Posts: 15
Joined: October 11th, 2008, 8:16 pm
Contact:

Re: Autodownload script

Post by xxhds »

Alright I have updated my script a little bit.  I added a command to check the years on movies, and only get 1995 and newer since I am not interested in downloading a bunch of old stuff like 007 movies.  If you want a different year check let me know if you need help modifying it.  Oh and I also added colors to the console ouput (linux... idk about other os's) to say SKIPPING and DOWNLOADING in red or green.

*note my script is for nzbs.org not newzbin
rss_movies.py
http://pastebin.com/f1c42f76b

rss_movies.py  (with no year checking)
http://pastebin.com/f7c120561

as far problems with parenthesis and colons, sorry but I have no way of testing at this time.  I use http://mytvnzb.foechoer.be/ and rss in sabnzbd+ for my automatic tv download.  which works awesome.  and none of the movie releases ive seen from nzbs.org in the last few days have not had any problems.  I'll try and attack problems as I see them appear, but otherwise I would need more details and I could try modifying the orignal scripts, but I have no way of testing.  Sorry.
frankhuzzah
Newbie
Newbie
Posts: 6
Joined: November 8th, 2008, 8:10 pm

Re: Autodownload script

Post by frankhuzzah »

It looks like I've quasi-solved the parenthesis by changing the filename structure.  The problem seems to be in line 30 in the way it sees the series_title.  If I remove that checking and remove the series titles from my filenames the script recognizes what I have and don't have perfectly fine.  For me, I don't really mind not having the series title in the name, it was just extra information.  I don't know if this is 'proper' but it works for me.
revelation_22
Newbie
Newbie
Posts: 21
Joined: October 19th, 2008, 12:21 pm

Re: Autodownload script

Post by revelation_22 »

xxhds, you must have read my mind when you added the year check. What is the syntax for the check? I would like to change it around a bit. Thanks for your efforts.
xxhds
Release Testers
Release Testers
Posts: 15
Joined: October 11th, 2008, 8:16 pm
Contact:

Re: Autodownload script

Post by xxhds »

np.  here is the part of the year checking function you need to change:
if re.search("19[0-8][0-9]", movie_year.group()) or re.search("199[0-4]", movie_year.group()):
Its a regex match.  So if the year matches 1900-1989 then its old. and then the second part is 1990-1994. if you let me know what year you want I can change it for you. or you can experiment. 

For 2000+:
if re.search("19[0-9][0-9]", movie_year.group()):
for 2006+:
if re.search("19[0-9][0-9]", movie_year.group()) or re.search("200[0-5]", movie_year.group()):

revelation_22 wrote: xxhds, you must have read my mind when you added the year check. What is the syntax for the check? I would like to change it around a bit. Thanks for your efforts.
Cuchulainn
Release Testers
Release Testers
Posts: 7
Joined: December 1st, 2008, 9:11 am

Re: Autodownload script

Post by Cuchulainn »

In order to prevent duplicate downloads, I adjusted the script to check against already downloaded nzb-files (you also need to specify the nzb backup directory in the sabnzbd settings) by adding

Code: Select all

#Put your own movie directory here
movie_dir="u:/Movies"
nzb_dir="d:/BACKUP/nzb"
suffix=".nzb;.gz"
and changing

Code: Select all

def isMissing(check_movie_title):
	if os.path.exists(movie_dir + "/" + check_movie_title + ".avi") or os.path.exists(movie_dir + "/" + check_movie_title) or os.path.exists(nzb_dir + "/" + check_movie_title + suffix):
		return 0
	else:
		return 1
I tried to make it work with the backup directory in the Application Data directory, but I couldn't get that to work.... Probably something to do with the whitespaces in the pathname. Hopefully this little change is of use to someone.
Last edited by Cuchulainn on December 1st, 2008, 11:23 am, edited 1 time in total.
geebee
Release Testers
Release Testers
Posts: 59
Joined: August 2nd, 2008, 5:58 pm

Re: Autodownload script

Post by geebee »

COuld you update the pastebins please? I cannot access them...



Great work btw!
Post Reply