[Linux, MacOSX, Windows] Media Sorting + XBMC Updater

Come up with a useful post-processing script? Share it here!
superultra
Newbie
Newbie
Posts: 8
Joined: October 26th, 2008, 1:08 pm

Re: [Linux, MacOSX, Windows] Media Processing + XBMC Updater

Post by superultra »

Tret, this looks terrific and I used your previous scripts. Thanks.

I'm having some problems. Sab is calling media_process.py, but nothing else is happening. I am not getting any activity besides:
Media Process v1.20 by tret

This is also true when I run #sudo python media_process.py.

Dirs are:
Completed Download Folder: /mnt/350gb/completed

which I set to SABNZBD Download Path in settings.conf (which is in the same dir as media_process.py).

Running this on ubuntu feisty server.

I know this isn't much to go on. Your older scripts worked perfect.

Thanks!
superultra
Newbie
Newbie
Posts: 8
Joined: October 26th, 2008, 1:08 pm

Re: [Linux, MacOSX, Windows] Media Processing + XBMC Updater

Post by superultra »

Also, is there a way to run the script manually from the command line to catch up on the media the script has missed?
tret
Full Member
Full Member
Posts: 148
Joined: August 2nd, 2008, 2:07 pm

Re: [Linux, MacOSX, Windows] Media Processing + XBMC Updater

Post by tret »

superultra wrote: Tret, this looks terrific and I used your previous scripts. Thanks.

I'm having some problems. Sab is calling media_process.py, but nothing else is happening. I am not getting any activity besides:
Media Process v1.20 by tret

This is also true when I run #sudo python media_process.py.

Dirs are:
Completed Download Folder: /mnt/350gb/completed

which I set to SABNZBD Download Path in settings.conf (which is in the same dir as media_process.py).

Running this on ubuntu feisty server.

I know this isn't much to go on. Your older scripts worked perfect.

Thanks!
Hi superultra,

Glad to hear that you have enjoyed the scripts. Typically if the script output shows only 'Media Process v1.20 by tret' it means that the script is not finding the category directories within the completed downloads location.

If you have some categories set to use the script, something like: Movies, Music, TV, etc...
You should end up with these directories once sab finishes working with downloads in these categories:
/mnt/350gb/completed/Movies
/mnt/350gb/completed/Music
/mnt/350gb/completed/TV

In the settings.conf file, your first settings is the completed downloads directory, in your case you will have this in the settings.conf file

Code: Select all

SABNZBD Download Path = "/mnt/350gb/completed"
In the categories.conf file, you must define the categories that media_process will look for, so in order to get the script to look at Movies, Music and TV you will need to have these categories defined. Your categories.conf should look something like:

Code: Select all

## Media Process categories

Category Name = "Movies"
Destination Path = "/wherever/you/store/stuff/movies"
Minimum File Size = "400"
Use thetvdb.com scraper (y/n) = "n"
Use imdb.com scraper (y/n) = "y"
Update XBMC Library (y/n) = "y"

Category Name = "Music"
Destination Path = "/wherever/you/store/stuff/music"
Minimum File Size = "1"
Use thetvdb.com scraper (y/n) = "n"
Use imdb.com scraper (y/n) = "n"
Update XBMC Library (y/n) = "y"

Category Name = "TV"
Destination Path = "/wherever/you/store/stuff/tv"
Minimum File Size = "75"
Use thetvdb.com scraper (y/n) = "y"
Use imdb.com scraper (y/n) = "n"
Update XBMC Library (y/n) = "y"
the key here is to make sure that your category names match the category directories that sabnzbd created in your completed downloads directory. So if sab moves a download to:

Code: Select all

/mnt/350gb/completed/Movies/Se7en (1995)
Then you need to be sure that you have defined "Movies" as a category

Hopefully this takes care of the issue. And yes you can manually run the script because it doesn't depend on any output from sab. Just use the terminal, cd to the scripts location and type ./media_process.py

Good luck! Let me know how it goes.

Rob
Last edited by tret on April 6th, 2009, 9:11 pm, edited 1 time in total.
tret
Full Member
Full Member
Posts: 148
Joined: August 2nd, 2008, 2:07 pm

Re: [Linux, MacOSX, Windows] Media Processing + XBMC Updater

Post by tret »

Just a quick update, I am reworking some of the code, it seemed that this wasn't working right in windows when dealing with a mapped network drive. I have already resolved this but I am cleaning up some of the other issues I have noticed.

I am also working on the imdb movie.nfo creation, it hasn't worked quite right to this point so I am trying to come up with some new methods for accurately searching imdb when the downloads have extra garbage in the directory titles (the.dark.knight.720p.bluray.newrelease.blah.blah.blah.2008)

Anyway, I'll post the updates soon

thanks,
Rob
superultra
Newbie
Newbie
Posts: 8
Joined: October 26th, 2008, 1:08 pm

Re: [Linux, MacOSX, Windows] Media Processing + XBMC Updater

Post by superultra »

That did the trick. Excellent! Thanks so much Rob!
tret
Full Member
Full Member
Posts: 148
Joined: August 2nd, 2008, 2:07 pm

Re: [Linux, MacOSX, Windows] Media Processing + XBMC Updater

Post by tret »

superultra wrote: That did the trick. Excellent! Thanks so much Rob!
Awesome, btw i made a bit of a typo earlier, I said you need 3 categories but what I meant to say is just that you need to have some categories set. The categories.conf file can contain as many or as few categories as you like so long as you follow the same format, each category needs to have the same number of settings and the settings need be in the same order

Anyway glad to hear that it is working and check back in the next week or so and I'll have an updated version with better imdb scraping capabilities as well as a few bug fixes here and there

Rob
Laat
Newbie
Newbie
Posts: 9
Joined: March 12th, 2009, 9:40 pm

Re: [Linux, MacOSX, Windows] Media Processing + XBMC Updater

Post by Laat »

I am also working on the imdb movie.nfo creation, it hasn't worked quite right to this point so I am trying to come up with some new methods for accurately searching imdb when the downloads have extra garbage in the directory titles (the.dark.knight.720p.bluray.newrelease.blah.blah.blah.2008)
Tret, perhaps you could clean the names like they do in the XBMC-scrapers?
it's here. look for "PrepareSearchString"
tret
Full Member
Full Member
Posts: 148
Joined: August 2nd, 2008, 2:07 pm

Re: [Linux, MacOSX, Windows] Media Processing + XBMC Updater

Post by tret »

Laat wrote:
I am also working on the imdb movie.nfo creation, it hasn't worked quite right to this point so I am trying to come up with some new methods for accurately searching imdb when the downloads have extra garbage in the directory titles (the.dark.knight.720p.bluray.newrelease.blah.blah.blah.2008)
Tret, perhaps you could clean the names like they do in the XBMC-scrapers?
it's here. look for "PrepareSearchString"
excellent suggestion, thanks! Looks like they have a list of "Crap" words which they try to match within the title, if they find one of them they remove it and everything to the right of it. Simple but sounds as though it would be effective. I'll try and reproduce this.

Thanks again for the suggestion :)

Rob
Necro
Newbie
Newbie
Posts: 9
Joined: April 9th, 2009, 5:39 pm

Re: [Linux, MacOSX, Windows] Media Processing + XBMC Updater

Post by Necro »

Tret, I'm actually trying to use your script seperate from Sabnzbd as a scheduled script on a WHS machine - I just resolved an issue I was having with directory naming but had a question on something else.  Should this be processing files themselves in the download directory or only subfolders?  Also, what can the script handle naming wise (i.e. what's the format's it can handle)?

Also, anyway to get the script to rename files (preferably to a configurable format - I generally try Movie Name (Year) [IMDBId]).

I'm going to start messing around with the script to try to do the renaming, but the subfolder/file issue I kind of need to understand because from looking at the script it looks like it SHOULD be doing files as well but it's not.
Last edited by Necro on April 9th, 2009, 5:50 pm, edited 1 time in total.
Laat
Newbie
Newbie
Posts: 9
Joined: March 12th, 2009, 9:40 pm

Re: [Linux, MacOSX, Windows] Media Processing + XBMC Updater

Post by Laat »

tret, I wrote the method in python.

I hope it helps :)

http://pastebin.com/m2e0912bd
Last edited by Laat on April 9th, 2009, 6:01 pm, edited 1 time in total.
tret
Full Member
Full Member
Posts: 148
Joined: August 2nd, 2008, 2:07 pm

Re: [Linux, MacOSX, Windows] Media Processing + XBMC Updater

Post by tret »

Necro wrote: Tret, I'm actually trying to use your script seperate from Sabnzbd as a scheduled script on a WHS machine - I just resolved an issue I was having with directory naming but had a question on something else.  Should this be processing files themselves in the download directory or only subfolders?  Also, what can the script handle naming wise (i.e. what's the format's it can handle)?

Also, anyway to get the script to rename files (preferably to a configurable format - I generally try Movie Name (Year) [IMDBId]).

I'm going to start messing around with the script to try to do the renaming, but the subfolder/file issue I kind of need to understand because from looking at the script it looks like it SHOULD be doing files as well but it's not.
Hi necro,

The script only looks for directories within the provided category. I designed it that way because SAB always puts the downloads in a directory within a given category.

I plan in a later version to have the script rename Movie folders based on the imdb scraping results in the Movie Name (Year) format as you mentioned.

Thanks,
Rob
tret
Full Member
Full Member
Posts: 148
Joined: August 2nd, 2008, 2:07 pm

Re: [Linux, MacOSX, Windows] Media Processing + XBMC Updater

Post by tret »

Laat wrote: tret, I wrote the method in python.

I hope it helps :)

http://pastebin.com/m2e0912bd
Excellent!! saved me a bit of work, thank you much :)

I'll likely have a reworked version of the script up by the end of the weekend for those interested. I have gone through pretty much the entire code and made improvements, fixed some bugs, etc.

I'm looking forward to using this new title cleanup method, should certainly help with getting a more reliable imdb fetch.

Rob
tret
Full Member
Full Member
Posts: 148
Joined: August 2nd, 2008, 2:07 pm

Re: [Linux, MacOSX, Windows] Media Processing + XBMC Updater

Post by tret »

version 1.30 (Use the download link at the bottom of the 1st post in the thread)

I have reworked the entire code in this version.  Aside from the more reliable scraping techniques (Big thanks to Laat for the name parsing code), copying across mapped network drives in windows is now working properly.  I built this version in windows and suspect it still works fine for linux and MacOSX but I would appreciate anyone using these systems to report back on functionality.  As usual please report any issues, errors, etc so I can attempt to work out any bugs I may have missed.


The new imdb scraper will filter out junk in the directory name to provide a more reliable search. Also this scraper takes the top 5 imdb hits, splits the imdb title up and provides a percentage based match (# of words matched vs. # of words in the title).  Whichever title has the highest percentage match will be chosen
The new tvdb scraper has the same features, capabilities and matching technique as used in the imdb scraper

NOTE: please post the script output for any downloads which fail to properly match using thetvdb or the imdb scraper so I can continue to improve the scraper reliabilty

TO DO:
- Two outstanding issues with the imdb scraper that I need to resolve...
  1. Foreign titles on imdb but english titles from sabnzbd... right now the two titles won't match, imdb provides an english title translation, I just need to work it in
  2. Remakes when the year isn't provided... right now the scraper will most often select the original release but i suspect in most cases the user will be looking for the most recent release (The Day the Earth Stood Still) 1951 version or 2008 version???
- Rename Movie directories to match the imdb title: The.Dark.Knight.2008.x264.1080p.bluray -> The Dark Knight (2008)
- Identify unnecessary directory nesting, move files to the root of the download directory (VIDEO_TS being the exception)
Last edited by tret on April 11th, 2009, 7:28 pm, edited 1 time in total.
Necro
Newbie
Newbie
Posts: 9
Joined: April 9th, 2009, 5:39 pm

Re: [Linux, MacOSX, Windows] Media Processing + XBMC Updater

Post by Necro »

Anyone mind if I steal that little bit of code for stripping down the scene directory names for a 'simple' directory scanner and movie renamer/mover script I'm working on?  (That's quickly getting a bit out of control).

Also, tret, not sure if you know about this but you may want to check out IMDbPY - saved me a ton of time and got me to a fully functional script fairly quickly. (http://imdbpy.sourceforge.net/)

Of course...UNC paths are now screwing everything up.
Last edited by Necro on April 14th, 2009, 9:54 pm, edited 1 time in total.
tret
Full Member
Full Member
Posts: 148
Joined: August 2nd, 2008, 2:07 pm

Re: [Linux, MacOSX, Windows] Media Processing + XBMC Updater

Post by tret »

Necro wrote: Anyone mind if I steal that little bit of code for stripping down the scene directory names for a 'simple' directory scanner and movie renamer/mover script I'm working on?  (That's quickly getting a bit out of control).

Also, tret, not sure if you know about this but you may want to check out IMDbPY - saved me a ton of time and got me to a fully functional script fairly quickly. (http://imdbpy.sourceforge.net/)

Of course...UNC paths are now screwing everything up.
Thanks for the imdbpy link, looks promising!!!

I don't mind if anyone uses any of the code.... btw tell me about your "Out of Control" script
Post Reply