News: 0.5.0 RC6 is out!  | Return to SABnzbd.org | Contribute to SABnzbd+ | Donors February 08, 2010, 11:29:27 PM
Welcome, Guest. Please login or register.
Did you miss your activation email?
*

[Linux, MacOSX, Windows] Media Sorting + XBMC Updater
Pages: [1] 2 3 ... 6
  Print  

  [Linux, MacOSX, Windows] Media Sorting + XBMC Updater
Author Message
tret
Jr. Member
**
Posts: 97


View Profile
« on: March 02, 2009, 01:34:22 AM »

Features:
- Detect downloads in user defined categories and move them to user defined destinations
- Detect failed downloads and delete them or move them to a user defined FAILED destination
- Search for and remove junk files and empty directories
- Send video or music library update requests to one or more XBMC machines

Installation:
1. Copy the media_sort.py, settings.ini and excludes files to your SABnzbd scripts folder
2. In the SABnzbd categories settings, set the desired categories to launch media_sort.py after post-processing
3. In the SABnzbd sorting settings, Enable TV Show sorting and set the "Sort String" to: %sn/Season %0s/%sn - S%0sE%0e.%ext
4. Edit the settings.ini file to configure Don't modify media_sort.py to change settings


settings.ini instructions:

NOTE: This section of the ini file cannot be removed
Code:
misc:
failed_destination = /home/tret/Downloads/SABnzbd/_FAILED
set_permissions = 0777

failed_destination = leave blank to delete _FAILED_ directories OR set a valid path to move _FAILED_ directories to
set_permissions = leave blank to leave permissions alone OR set to a valid octal permission value set permissions on finished downloads


NOTE: This section of the ini file is optional, add additional XBMC sections or remove if XBMC support isn't required
Code:
XBMC:
address = 192.168.1.2
port = 8080

address = set to your XBMC IP address
port = set to your XBMC web server port


NOTE: At least 1 category section is required, add additional category sections as needed e.g: music, tv
Code:
Movies:
source = /home/tret/Downloads/SABnzbd/movies
destination = /mnt/disk3/Movies
min_download_size = 500MB
min_file_size = 200MB
xbmc_library = video

source = set a valid path to check for downloads in this cateogry
destination = set a valid path to move finished downloads to
min_download_size = set a minimum download size for this category, downloads below this value will be deleted (Leave blank to ignore size)
min_file_size = set a minimum file size for this category, files below this size will be deleted as junk (Leave blank to skip junk file cleaning)
xbmc_library = set the xbmc library type to be updated for this category e.g: video, music (Leave blank to disable xbmc library update)


excludes file: Add additional file types here to exclude them from junk file removal e.g: .nzb, .sfv, .m3u


media_sort v2.00
v2.00 Download
v2.00 Release notes (1/17/2010)

Built and tested with Python 2.6.1 (download and install if you don't have python already or if you have an older version and the script isn't working)
Python 2.6.1 for Mac OS X
Python 2.6.1 for Windows

tret
« Last Edit: January 22, 2010, 07:36:19 PM by tret » Logged
tret
Jr. Member
**
Posts: 97


View Profile
« Reply #1 on: March 02, 2009, 02:09:10 AM »

[Removed]
Logged
revelation_22
Newbie
*
Posts: 20


View Profile
« Reply #2 on: March 02, 2009, 06:19:49 PM »

Installed this new version and it is working great.  I have multiple instances of XBMC that I would like the library update command sent to. What would I need to edit to accomplish this with this new version?

Thanks for the great script,
revelation22
Logged
tret
Jr. Member
**
Posts: 97


View Profile
« Reply #3 on: March 02, 2009, 07:12:49 PM »

Installed this new version and it is working great.  I have multiple instances of XBMC that I would like the library update command sent to. What would I need to edit to accomplish this with this new version?

Thanks for the great script,
revelation22

Hey rev,

Glad to hear that it's working out!

I think this functionality should be pretty easy to add, I have a couple of ideas. I'll post whatever I figure out.

Thanks,
tret
Logged
tret
Jr. Member
**
Posts: 97


View Profile
« Reply #4 on: March 03, 2009, 01:57:12 AM »

Installed this new version and it is working great.  I have multiple instances of XBMC that I would like the library update command sent to. What would I need to edit to accomplish this with this new version?

Thanks for the great script,
revelation22

Rev,

Ok so here is how to add the ability to update multiple xbmc libraries.

Find these two lines, they are the last two lines in the media_process.py file
Code:
        if str.lower(categoriesList[i+4]) == 'y':
          urllib.urlopen("http://" + settingsList[3] + "/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)", proxies={})

And replace them with these three lines. Remember in python indents are important so be sure to maintin the proper indentation. This code change will be included with my next release.
Code:
        if str.lower(categoriesList[i+4]) == 'y':
          for y in range(3, len(settingsList)):
            urllib.urlopen("http://" + settingsList[y] + "/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)", proxies={})

Then all you need to do is add the additional xbmc ip addresses to settings.conf. Example:
Code:
## Media Process settings
   
SABNZBD Download Path = "/WD500/downloads/sabnzbd"
Failed Downloads Destination Path = "/WD500/downloads/sabnzbd/FAILED"
XBMC IP address and port = "192.168.1.3:8080"
XBMC 2 IP address and port = "192.168.1.10:8080"
XBMC 3 IP address and port = "192.168.1.101:8080"

That should take care of it. Let me know how it goes!

tret
Logged
revelation_22
Newbie
*
Posts: 20


View Profile
« Reply #5 on: March 04, 2009, 12:07:25 AM »

Installed this new version and it is working great.  I have multiple instances of XBMC that I would like the library update command sent to. What would I need to edit to accomplish this with this new version?

Thanks for the great script,
revelation22

Rev,

Ok so here is how to add the ability to update multiple xbmc libraries.

Find these two lines, they are the last two lines in the media_process.py file
Code:
        if str.lower(categoriesList[i+4]) == 'y':
          urllib.urlopen("http://" + settingsList[3] + "/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)", proxies={})

And replace them with these three lines. Remember in python indents are important so be sure to maintin the proper indentation. This code change will be included with my next release.
Code:
        if str.lower(categoriesList[i+4]) == 'y':
          for y in range(3, len(settingsList)):
            urllib.urlopen("http://" + settingsList[y] + "/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary(video)", proxies={})

Then all you need to do is add the additional xbmc ip addresses to settings.conf. Example:
Code:
## Media Process settings
   
SABNZBD Download Path = "/WD500/downloads/sabnzbd"
Failed Downloads Destination Path = "/WD500/downloads/sabnzbd/FAILED"
XBMC IP address and port = "192.168.1.3:8080"
XBMC 2 IP address and port = "192.168.1.10:8080"
XBMC 3 IP address and port = "192.168.1.101:8080"

That should take care of it. Let me know how it goes!

tret

That did the trick! Thank you. Have you considered scraping imdb for movies and creating a Movie.nfo and using the movie name for the folder name? I think I need to learn python  Grin
Logged
tret
Jr. Member
**
Posts: 97


View Profile
« Reply #6 on: March 04, 2009, 01:38:35 AM »


That did the trick! Thank you. Have you considered scraping imdb for movies and creating a Movie.nfo and using the movie name for the folder name? I think I need to learn python  Grin


Haha funny you should ask. I am working on that right now in fact. I am trying to decide how flexible I want to make it. For instance, if I have a download waiting and my script picks it up. The folder is named No Country for Old Men (2007) and that name and year format exactly matches the title and year on IMDB, so I get a positive match and everything is great. Now say I have Bill and Ted's excellent adventure with no year. The IMDB match for that movie is Bill & Ted's Excellent Adventure (1989) so my script wouldn't get an exact match.

IMDB will give you popular results for your search, so if I search for Bill and Ted's excellent adventure with no year the #1 link in the popular results is the link to the correct movie. But say the title is something more obscure, or even something that is titled way off, if I let the script just take the #1 popular result and run with it, we could have a link to the wrong movie entirely.

So..... what to do? Be strict and perhaps 30% of the movies won't get a Movie.nfo file or be more relaxed and chance getting some wrong url's?

What do you think?

Rob
Logged
Usenet
Newbie
*
Posts: 47



View Profile
« Reply #7 on: March 04, 2009, 10:14:55 AM »

look for .nfo files with imdb links?
Logged
tret
Jr. Member
**
Posts: 97


View Profile
« Reply #8 on: March 06, 2009, 08:04:01 PM »

look for .nfo files with imdb links?

Yeah that is the first option. I am planning to have a 3 step process for this.

1. use any imdb url's found in any .nfo files that came with the movie
2. search imdb for exact matches
3. use some kind of matching percentage to use likely imdb search results.

I have 1 and 2 figured out and working, I just need to work on #3

tret
Logged
revelation_22
Newbie
*
Posts: 20


View Profile
« Reply #9 on: March 08, 2009, 10:27:21 PM »

Quote

1. use any imdb url's found in any .nfo files that came with the movie
2. search imdb for exact matches
3. use some kind of matching percentage to use likely imdb search results.

I have 1 and 2 figured out and working, I just need to work on #3

tret

tret, do you have a working version with these features added that you would post? I would like to give it a try.
Logged
tret
Jr. Member
**
Posts: 97


View Profile
« Reply #10 on: March 09, 2009, 01:48:33 AM »

Quote

1. use any imdb url's found in any .nfo files that came with the movie
2. search imdb for exact matches
3. use some kind of matching percentage to use likely imdb search results.

I have 1 and 2 figured out and working, I just need to work on #3

tret

tret, do you have a working version with these features added that you would post? I would like to give it a try.

Hi rev, I am getting close to having this ready, I also have a couple of small bug fixes in the next release. Should have something ready for use in a couple of days.

tret
Logged
tret
Jr. Member
**
Posts: 97


View Profile
« Reply #11 on: March 09, 2009, 09:56:17 PM »

version 1.10 (Use the link in the first post)

changes:

- bugfix: error reporting when URL couldn't be reached, errors handled properly now with normal script output
- bugfix: excludes.conf file types being deleted, no longer case sensitive when checking excludes against files below min size threshold
- added: IMDB scraping, If enabled a Movie.nfo file will be created with a URL to the matching IMDB page (helps XBMC scrape IMDB)
- added: More than 1 XBMC box can be updated if enabled in the settings
- change: thetvdb.com and imdb.com scraping is now percentage based (50% or higher if title contains 2 words and 66% or higher for 3 or more words will result in a match)
« Last Edit: March 09, 2009, 10:09:12 PM by tret » Logged
Ozymandias
Newbie
*
Posts: 1


View Profile
« Reply #12 on: March 11, 2009, 06:28:31 AM »

Hey tret

Thanks for the good work  Smiley

I installed it last night on OSX 10.5 and it seems work well, no issues yet.

I have a feature request though

Would it be possible to include episode information about TV shows kind of like media companion, http://billyad2000.co.uk? It'd speed up scanning of new episodes and would save having to download thumbs etc.
Logged
tret
Jr. Member
**
Posts: 97


View Profile
« Reply #13 on: March 12, 2009, 01:42:21 PM »

For those of you who are having imdb and thetvdb matching issues:

I am planning to rework some of the imdb and thetvdb scraping code. Currently if there are special characters in the titles (' " ( & etc.) the matching can get messed up. I am planning to have the script temporarily remove all non alpha and numeric characters from the titles before comparing them. I think this should help things out a bit, we'll see.

I should have an update in a few days.

Thanks
Logged
tret
Jr. Member
**
Posts: 97


View Profile
« Reply #14 on: March 12, 2009, 01:43:45 PM »

Hey tret

Thanks for the good work  Smiley

I installed it last night on OSX 10.5 and it seems work well, no issues yet.

I have a feature request though

Would it be possible to include episode information about TV shows kind of like media companion, http://billyad2000.co.uk? It'd speed up scanning of new episodes and would save having to download thumbs etc.


Nice, thanks for testing it out. I'll look into episode info, not sure about what would need to be done just yet.

tret
Logged

Pages: [1] 2 3 ... 6
  Print  
 

Jump to: