News: 0.5.3 Final is out!  | Return to SABnzbd.org | Contribute to SABnzbd+ | Donors July 29, 2010, 02:22:20 PM
Welcome, Guest. Please login or register.
Did you miss your activation email?
*

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

  [Linux, MacOSX, Windows] Media Sorting + XBMC Updater
Author Message
tret
Full Member
***
Posts: 118


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

Features:
- Use category specific settings to handle cleaning up and moving SABnzbd downloads
- Define up to 2 secondary destinations to be used when the primary destination is full
- Detect failed downloads and delete them or move them to a user defined destination
- Search for and remove junk files and empty directories (Useful for removing sample video files)
- Send video or music library update requests to one or more XBMC htpc's
- Hand off processing of TV Shows to Sick Beard

Setup:
1. Copy the htpc_sort.py, settings.ini and excludes files to your SABnzbd scripts folder
2. In the SABnzbd categories settings, set the desired categories to launch htpc_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, DO NOT modify the htpc_sort.py file to change settings


settings.ini explanation:
NOTE: The 'SABnzbd' section of the ini file is required (The section name IS case sensitive)
[SABnzbd]
address = 192.168.1.2:8081
login = jdoe
password = pass1234
apikey = xxxxxxxxxxxxxxxxxxxxxxxxxxx

address  (Required): set to your sabnzbd address and port, use the address above as an example
login    (Required): set to your sabnzbd login name
password (Required): set to your sabnzbd password
apikey   (Required): set to your sabnzbd apikey (I have not tested this script w/ an apikey disabled SABnzbd installation)


NOTE: The 'SickBeard' section of the ini file is optional, leave blank or remove this section if Sick Beard won't be used
[SickBeard]
scriptPath = /home/tret/.sickbeard/autoProcessTV/sabToSickBeard.py
category = TV

scriptPath (Required): path to find the sabToSickBeard.py script provided w/ Sick Beard
category (Required): all downloads within this category will be handed off to Sick Beard during processing


NOTE: The 'XBMC' section of the ini file is optional, add additional addresses as needed (The section name IS case sensitive)
[XBMC]
xbmc = 192.168.1.2:8080
xbmc2 = 192.168.1.3:8080
xbmc3 = 192.168.1.13:8080

xbmc  (Required): set to your xbmc web server address and port
xbmc* (Optional): additional xbmc web server addresses and ports


NOTE: At least 1 category section is required, add additional category sections as needed (IMPORTANT: The section name must match the SABnzbd category name)
[Movies]
destPath = E:\Movies
destPath2 = D:\Movies
destPath3 = F:\Movies
failPath = C:\Users\tret\Downloads\SABnzbd\Failed
minDownloadSize = 500MB
minFileSize = 200MB
libraryType = video

destPath        (Required): set to your primary library location, finished downloads will be moved here
destPath*       (Optional): additional library locations, downloads will be moved here if 'destPath' is full (destPath2, destPath3)
failPath        (Optional): set to your fail location, failed downloads will be moved here (Remove option to delete failed downloads)
minDownloadSize (Optional): set a minimum download size, downloads below this value will be deleted (Remove option to ignore download size)
minFileSize     (Optional): set a minimum file size, files below this size will be deleted as junk (Remove option to skip junk file removal)
libraryType     (Optional): set the xbmc library type to be updated for this category e.g: video, music (Remove option to disable xbmc library updates)


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


HTPC Sort v2.60
v2.60 Download
v2.60 Release notes (7/11/2010)

Built and tested with Python 2.6.4 (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.4 for Mac OS X
Python 2.6.4 for Windows

tret
« Last Edit: July 11, 2010, 11:50:19 AM by tret » Logged
tret
Full Member
***
Posts: 118


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

[Removed]
Logged
revelation_22
Newbie
*
Posts: 21


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
Full Member
***
Posts: 118


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
Full Member
***
Posts: 118


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: 21


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
Full Member
***
Posts: 118


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: 49



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

look for .nfo files with imdb links?
Logged
tret
Full Member
***
Posts: 118


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: 21


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
Full Member
***
Posts: 118


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
Full Member
***
Posts: 118


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
Full Member
***
Posts: 118


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
Full Member
***
Posts: 118


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 ... 8
  Print  
 

Jump to: