Autodownload script

Come up with a useful post-processing script? Share it here!
Post Reply
Nesousx
Newbie
Newbie
Posts: 9
Joined: January 22nd, 2009, 7:39 am
Contact:

Re: Autodownload script

Post by Nesousx »

I DLed both package and individual files... Doesnt seem to work.

But now I get a different error :

Code: Select all

D:\Apps\SABnzb\SABnzbd\Scripts>TV_Dler.py
Processing :Lost.S05E02.720p.HDTV.x264-2HD
ORIG:  Lost
2009-01-22 18:01:32,914) DEBUG Getting show lost
2009-01-22 18:01:32,917) DEBUG Getting http://www.thetvdb.com/api/GetSeries.php?
seriesname=lost using Cache
2009-01-22 18:01:32,971) DEBUG Found series Lost (id: 73739)
2009-01-22 18:01:32,974) DEBUG Found series Lost Universe (id: 73181)
2009-01-22 18:01:32,974) DEBUG Found series Lost (2001) (id: 72906)
2009-01-22 18:01:32,974) DEBUG Found series Lost in Space (id: 72923)
2009-01-22 18:01:32,976) DEBUG Found series Lost in Austen (id: 82934)
2009-01-22 18:01:32,976) DEBUG Found series Lost Civilizations (id: 80525)
2009-01-22 18:01:32,980) DEBUG Found series Lost Highway (id: 74729)
2009-01-22 18:01:32,980) DEBUG Found series Lost at Home (id: 71150)
2009-01-22 18:01:32,980) DEBUG Found series Lost on Earth (id: 71225)
2009-01-22 18:01:32,982) DEBUG Found series Lost Cities of the Ancients (id: 837
41)
2009-01-22 18:01:32,982) DEBUG Found series Lost Land of the Jaguar (id: 82715)
2009-01-22 18:01:32,982) DEBUG Found series Lost Treasures of NFL Films (id: 738
31)
2009-01-22 18:01:32,984) DEBUG Found series Land of the Lost (id: 71177)
2009-01-22 18:01:32,984) DEBUG Found series Lost Worlds (id: 80685)
2009-01-22 18:01:32,986) DEBUG Found series Lost Worlds, Vanished Lives (id: 796
16)
2009-01-22 18:01:32,986) DEBUG Found series Lost (UK) (id: 80595)
2009-01-22 18:01:32,986) DEBUG Found series The Lost Tomb of Jesus (id: 81028)
2009-01-22 18:01:32,990) DEBUG Found series Secrets of Lost Empires (id: 83797)
2009-01-22 18:01:32,990) DEBUG Found series The Secret Of Lost Creek (id: 73162)

2009-01-22 18:01:32,992) DEBUG Found series Xam`d: Lost Memories (id: 82834)
2009-01-22 18:01:32,992) DEBUG Found series The Lost Room (id: 79637)
2009-01-22 18:01:32,992) DEBUG Found series The Lost Tribes (id: 80333)
2009-01-22 18:01:32,994) DEBUG Found series The Lost Saucer (id: 73549)
2009-01-22 18:01:32,994) DEBUG Found series The Lost Gods (id: 82275)
2009-01-22 18:01:32,996) DEBUG Found series WWII: The Lost Color Archives (id: 8
2250)
2009-01-22 18:01:32,996) DEBUG Found series History's Lost and Found (id: 83333)

2009-01-22 18:01:32,996) DEBUG Found series Brats of the Lost Nebula (id: 78687)

2009-01-22 18:01:33,000) DEBUG Found series The Lost World (id: 78457)
2009-01-22 18:01:33,000) DEBUG Found series The Man who Lost his Head (id: 81313
)
2009-01-22 18:01:33,002) DEBUG Found series The Lost Prince (id: 84482)
2009-01-22 18:01:33,002) DEBUG Found series Land of the Lost (1991) (id: 76861)
2009-01-22 18:01:33,002) DEBUG Found series Finder of Lost Loves (id: 73420)
2009-01-22 18:01:33,005) DEBUG Auto-selecting first search result using BaseUI
2009-01-22 18:01:33,005) DEBUG Got Lost, sid 73739
2009-01-22 18:01:33,005) DEBUG Getting all series data for 73739
2009-01-22 18:01:33,005) DEBUG Getting http://www.thetvdb.com/api/0629B785CE550C
8D/series/73739/ using Cache
2009-01-22 18:01:33,012) DEBUG Got info: id = 73739
2009-01-22 18:01:33,012) DEBUG Got info: actors = |Matthew Fox|Evangeline Lilly|
Naveen Andrews|Elizabeth Mitchell|Michael Emerson|Terry O'Quinn|Daniel Dae Kim|Y
unjin Kim|Josh Holloway|Andrew Divoff|Sam Anderson|L. Scott Caldwell|Nestor Carb
onell|Kevin Durand|Jeff Fahey|Tania Raymonde|Mira Furlan|Alan Dale|Sonya Walger|
Rebecca Mader|Ken Leung|Jeremy Davies|Kiele Sanchez|Rodrigo Santoro|Cynthia Watr
os|Adewale Akinnuoye-Agbaje|Henry Ian Cusick|Michelle Rodriguez|Dominic Monaghan
|Emilie de Ravin|Harold Perrineau Jr.|Ian Somerhalder|Maggie Grace|Jorge Garcia|
Malcolm David Kelley|John Terry|M.C. Gainey|Zuleikha Robinson|
2009-01-22 18:01:33,015) DEBUG Got info: airs_dayofweek = Thursday
2009-01-22 18:01:33,015) DEBUG Got info: airs_time = 10:00 PM
2009-01-22 18:01:33,015) DEBUG Got info: contentrating = TV-14
2009-01-22 18:01:33,015) DEBUG Got info: firstaired = 2004-09-22
2009-01-22 18:01:33,015) DEBUG Got info: genre = |Action and Adventure|Drama|Sci
ence-Fiction|
2009-01-22 18:01:33,015) DEBUG Got info: imdb_id = tt0411008
2009-01-22 18:01:33,016) DEBUG Got info: language = en
2009-01-22 18:01:33,016) DEBUG Got info: network = ABC
2009-01-22 18:01:33,016) DEBUG Got info: overview = After their plane, Oceanic A
ir flight 815, tore apart whilst thousands of miles off course, the survivors fi
nd themselves on a mysterious deserted island where they soon find out they are
not alone.
2009-01-22 18:01:33,016) DEBUG Got info: rating = 8.8
2009-01-22 18:01:33,016) DEBUG Got info: runtime = 45
2009-01-22 18:01:33,016) DEBUG Got info: seriesid = 24313
2009-01-22 18:01:33,019) DEBUG Got info: seriesname = Lost
2009-01-22 18:01:33,019) DEBUG Got info: status = Continuing
2009-01-22 18:01:33,019) DEBUG Got info: banner = graphical/73739-g4.jpg
2009-01-22 18:01:33,019) DEBUG Got info: fanart = fanart/original/73739-26.jpg
2009-01-22 18:01:33,019) DEBUG Got info: lastupdated = 1232624431
2009-01-22 18:01:33,019) DEBUG Got info: poster = posters/73739-5.jpg
2009-01-22 18:01:33,022) DEBUG Got info: zap2it_id = SH672362
2009-01-22 18:01:33,022) DEBUG Getting all episodes of 73739
2009-01-22 18:01:33,022) DEBUG Getting http://www.thetvdb.com/api/0629B785CE550C
8D/series/73739/all/ using Cache
2009-01-22 18:01:33,927) DEBUG Got series id 73739
TVDB:  Lost
Using Smart Queue Check
Checking if Lost is wanted
Checking format
Video Format is Wanted
NOT WANTED: Lost

D:\Apps\SABnzb\SABnzbd\Scripts>
But I DLed Lost in the meantime with sabnzbd "manually". Purged the history... Buy maybe thats why the script doesn't want to DL it. Concerning CSI miami which appeared this morning in the RSS, it is no longer the case... If anyone has some idead, I'll be happy. If not I'll keep trying different things, and wait for more episodes to be online, in order to test it further.

Thanks anyways.
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: Autodownload script

Post by markus101 »

That Error looks like you don't actually "want" Lost - which isn't the case. Did you setup the folder properly in the first section of the script? (just below the Change Log). If you're using Windows (which it looks like you are), make sure you set the following to you TV Show Directory:

Code: Select all

if sys.platform == "win32":
    tv_dirs=[ "Z:" ]
or for Linux:

Code: Select all

else:
    tv_dirs=[ "/mnt/user/tv" ]
Also if you did the above already, in your TV Show folder do you have a folder just called "Lost" (without quotes)?  It doesn't get to the point to actually check if you already have that episode so likely it is to due with the config.

The Process of the script is, read RSS Feed, look for show on TVDB, check that format is wanted, look if Show is wanted, look for existing episode on disk, look for existing episode in queue (not history as far as I know) then add it to the queue if it is needed. (if the nzb file is the same and SAB is set to ignore already imported nzbs then it will discard it (but the script will still attempt to add it).

Yours seems to fail on the step to check for that series (show) in your TV Show directory, so I would suggest confiming the TV Show folder is correct first and foremost.

Cheers,

Markus101
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
Nesousx
Newbie
Newbie
Posts: 9
Joined: January 22nd, 2009, 7:39 am
Contact:

Re: Autodownload script

Post by Nesousx »

It keeps saying that Lost is "not wanted". Actually, maybe I really don't want this show, because it is really bad, but still...

I edited the path, and have a Lost folder in this "TV path" I entered in the script.

My file looks like this:

Code: Select all

# set this to the location of your downloads.  the first entry must be your live download area
if sys.platform == "win32":
    tv_dirs=[ "D:\Docs\Videos\TV" ]
And here is my Lost folder:

Code: Select all

D:\Docs\Videos\TV\Lost
Maybe it is something related to character encoding... It seems that folder name is "Vidéos", and the script doesn't recognize accentuated characters. I renamed the dir to "Videos" but it doesn't take hold. I'm changing it completely.
I'll keep you posted.


Edit :

After removing some weird french characters in folder's name I got this :

Code: Select all

2009-01-22 22:20:50,252) DEBUG Got series id 73739
TVDB:  Lost
Using Smart Queue Check
Checking if Lost is wanted
Checking format
Video Format is Wanted
WANTED: Lost
Looking for: Lost - S05E02
checking: D:\Docs\Vids\TV
MISSING: Lost - S05E02
Sounds a lot better !! Now, Windoze is copying gibabytes of data from "vidéos" to "vids". *sights*
Last edited by Nesousx on January 22nd, 2009, 4:23 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 »

Evening All,

Welcome to Nesousx, good to see someone else using this script.  It really has developed since I started modifying DoubleDrat's version of popcorn's original.

Anyway Here's the lastest version (0.7), http://pastebin.com/f286a1d78

Please confirm the version number when reporting any error, the way things have be going you can expect a new version almost every night (maybe every other day :-) ).

Changes:

# 090123 2200  Added option to choose SABnzbd style or tvnamer.py style, illegal character replacement
#              Added option to force Windows compliant names, useful if you run this on a linux box but access via windows
#              Now we reformat a NewzBin into the same format as a 'non' newzbin feed, Smart Queue should work better now

Nesousx, Your the first person I know that is using a 'non' english character set, this could cause some interesting bugs, but i'll do my best to fix any that might arise.
Stokkes
Newbie
Newbie
Posts: 32
Joined: January 23rd, 2009, 10:28 pm

Re: Autodownload script

Post by Stokkes »

I'm currently scratching my head on this one, but I'm wondering how do you handle a situation like mine where I'm downloading 720/x264 episodes for every show that offers it, yet I also have shows that simply do not offer HD episodes yet.

I don't want to add xvid to the list of formats because I don't want the script to download say, an SD version of Lost.

Not quite sure how to get around this, and I'm willing to wager I'm not the only one :).. Maybe I missed something?

Edit:

also, I'm just testing it out, but when I've downloaded your 0.7 version in the post above), configured it  and when I run it, I get :

": No such file or directory"

(I have the tvdb_api) and the script is saved to rss_tv.py in the same directory as the tvdb_api and given execute privileges (ubuntu 8.10)
Last edited by Stokkes on January 23rd, 2009, 11:04 pm, edited 1 time in total.
doubledrat
Release Testers
Release Testers
Posts: 180
Joined: February 20th, 2008, 3:16 pm

Re: Autodownload script

Post by doubledrat »

stokkes:  If I understand you correctly, you only want the sd version if you don't already have the HD version, but you also want to get the HD version regardless of having the SD version?

if this is the case, you can do it by running 2 versions of the script.  Check out my explanation posted earlier to this thread...
minimad
Release Testers
Release Testers
Posts: 62
Joined: January 11th, 2009, 5:45 pm

Re: Autodownload script

Post by minimad »

Hi stokkes,

Only get HD version of some shows but not SD version and get SD version of others,  I think the only ways currently to do this are:

1,  Run two versions of the script.  one HD, one SD using two newzbin feeds, one per script, but different shows in each feed

2,  again run two versions of the script, single non newzbin feed, HD shows in one directory, SD shows in another.


The only other way I can see doing this is a config file detailing shows and the formats to get  for each show.  I wouldn't want to put this actually into the script file itself as that would start getting too big.  I've been thinking about something similar, when I fix all the other little bugs :-).

Have you got all the tvdb_api files? it used used to be one or two files but the latest version is about 5 (I think).
jl0810
Newbie
Newbie
Posts: 18
Joined: December 27th, 2008, 8:01 am

Re: Autodownload script

Post by jl0810 »

this thread has really helped alot.  I now have a version of the script that will rename the movie file from IMDB, which is quite handy for feeding into metax.  Since I'm not a python expert, I did have one question, that I figured someone here would know off the top of their head.  When IMDB uses funky characters in the name, my autodownload script hiccups a bit.  For instance "Planet Earth" instead of Planet Earth.  Even the period in the movie W. causes some problems

Is there an easy to strip out unwanted characters in python so you just have the movie name and get rid of everything else?
minimad
Release Testers
Release Testers
Posts: 62
Joined: January 11th, 2009, 5:45 pm

Re: Autodownload script

Post by minimad »

Hi jl0810,

try something like (around line 192 in my script):

# convert unicode to ASCII
newstring = origstring.encode('ascii', 'ignore')
# replace illegal chars with nothing
newstring = re.sub("[*:|]", "", newstring).strip()

replaces the charsacters * : | with nothing, effectivly removing them.

if you post you script, we can have a look, I haven't looked at the movie script yet.
Stokkes
Newbie
Newbie
Posts: 32
Joined: January 23rd, 2009, 10:28 pm

Re: Autodownload script

Post by Stokkes »

@doubledrat
No exactly. Some shows aren't available in HD, but if my script is configured for HD shows, it won't find them. On the flip side, if I configure my script for SD shows, it will catch SD versions of my HD shows (ie: lost) when I don't want the SD versions

@minimad
I cloned the github repository and got all the files. I then copied your v7 pastebin to the same directory as rss_tv.py and set it as executable. I then configured it with my sabnzb server and tv folder, etc and when I run it, it gives me that error. Other python scripts work fine (tvnamer.py from the api works beautifully). Not sure how to get this script to work :/
minimad
Release Testers
Release Testers
Posts: 62
Joined: January 11th, 2009, 5:45 pm

Re: Autodownload script

Post by minimad »

Hi stokkes,

Can you post me your config section, might be a misconfig in there. if that doesn't show anything then I'll just have to give you an 'xtra' debug version.

Some Questions to help me debug:
What are you running the script on (linux, windows, osx)?
version of python? 
where are the media files located?
How are they named?
How are the seasons named?
doubledrat
Release Testers
Release Testers
Posts: 180
Joined: February 20th, 2008, 3:16 pm

Re: Autodownload script

Post by doubledrat »

Stokkes wrote: @doubledrat
No exactly. Some shows aren't available in HD, but if my script is configured for HD shows, it won't find them. On the flip side, if I configure my script for SD shows, it will catch SD versions of my HD shows (ie: lost) when I don't want the SD versions

@minimad
I cloned the github repository and got all the files. I then copied your v7 pastebin to the same directory as rss_tv.py and set it as executable. I then configured it with my sabnzb server and tv folder, etc and when I run it, it gives me that error. Other python scripts work fine (tvnamer.py from the api works beautifully). Not sure how to get this script to work :/
it will work for you if you run 2 versions - this is how I explained it earlier in this thread -

have newzbin search 1 that gets your low-def content
search 2 for hi-def content

version 1 of the script will place you low-def content in e.g. c:\tv
version 2 will place hi-def content in e.g. c:\hdtv

now here's the funky bit.
tell version 1 to check for existence of content in c:\tv AND c:\hdtv
tell version 2 to only check the existence of content in c:\hdtv

which should mean that you will always get the hd version, but you will only get the low def version if you don't already have the hi-def version.

so

v1

Code: Select all

#
# set this to the location of your downloads.  the first entry must be your live download area
#
tv_dirs=[ "c:\\tv", "c:\\hdtv" ]
#
 
#
# the RSS link to your search
#
tvurl="your low definition search"

v2

Code: Select all


#
# set this to the location of your downloads.  the first entry must be your live download area
#
tv_dirs=[ "c:\\hdtv ]
#
 
#
# the RSS link to your search
#
tvurl="your high definition search"
If you NEVER want the SD version of some shows, then don't point the sd version of the script at your hd content.  If you have a mixture, some you want SD some you don't, then you will need to use the above trick but with even more versions.
minimad
Release Testers
Release Testers
Posts: 62
Joined: January 11th, 2009, 5:45 pm

Re: Autodownload script

Post by minimad »

Another Evening, Another version.

Version: 0.8
http://pastebin.com/f56b242e2

Major Feature:
Per Show/Season format selection.  Only want HD version (but no SD) for Lost season 5 but SD for other seasons.  Now it's possible

This is experimental at the moment, I've tested against a feed with CSI in both x264 and xvid for the same season and episode AND other seasons.  It correctly matched the per season format and the 'general' format for the other seasons.

Any bugs let me know.

P.S.

If anyone has a NewzBin invite, i could really use it for testing the NewzBin side of this script. 
Stokkes
Newbie
Newbie
Posts: 32
Joined: January 23rd, 2009, 10:28 pm

Re: Autodownload script

Post by Stokkes »

minimad wrote: Hi stokkes,

Can you post me your config section, might be a misconfig in there. if that doesn't show anything then I'll just have to give you an 'xtra' debug version.

Some Questions to help me debug:
What are you running the script on (linux, windows, osx)?
version of python? 
where are the media files located?
How are they named?
How are the seasons named?
Config section: http://pastebin.com/m689daff4

1) running on ubuntu 8.10 in /usr/local/share/python/tvdb_api/tv_rss.py
2) 2.5.2
3) media files are located in /mnt/raid/media/tv/
4) Named like so /mnt/raid/media/tv/Lost/ or /mnt/raid/media/tv/My Name is Earl/
5) Seasons are /mnt/raid/media/tv/Lost/Season 1/
6) Episodes would be /mnt/raid/media/tv/Lost/Season 1/Lost 1x01 - Pilot.mkv
Stokkes
Newbie
Newbie
Posts: 32
Joined: January 23rd, 2009, 10:28 pm

Re: Autodownload script

Post by Stokkes »

Ok minimad, your v0.8 works fine for me!

Unfortunately, I will have to wait until the script is a little bit more configurable. Right now I currently have over 5000 episodes spanned across 60+ series on my 7TB media raid which is hooked into XBMC on a windows HTPC and Plex on a mac HTPC. I can't possibly rename all these episodes and change the directories (ie: I use Season X - Season 1, not Season 01, the preceeding 0 annoys me), and my episode format is SeriesName 1x01 - Title.ext.. So like I said, I can't possibly rename all my episodes, even though I'm really enjoying your script. I hope some extra functionality comes in so that us old timers who picked a certain way to rename our episodes and directories can adapt the script easily to get it to work with our naming schemes.


Maybe add a configuration option for a regex for the way we name our folders/episodes?
Last edited by Stokkes on January 25th, 2009, 8:28 pm, edited 1 time in total.
Post Reply