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

Come up with a useful post-processing script? Share it here!
Necro
Newbie
Newbie
Posts: 9
Joined: April 9th, 2009, 5:39 pm

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

Post by Necro »

Started out as just a directory walker and file renamer. 

Then I decided that movies leave too much variability and I didn't have time to figure out a way to do perfect matches - particularly this is the first python script I've ever written from scratch.  So...I started out with a shell and got it setup to grab a dir name, clean it up, and search IMDB for possible matches.  Decided - based on my demo setup - that 5 options should cover 99% of movies and set it up where you select one of the top 5 for what the actual movie is.

Then I decided renaming files was useful also...and realized I'd need to be sure to handle CD1 & CD2 subdirectories.  So...I did that.

Then I decided that I didn't want to have to wait for files to move between selecting what movie was what if there are multiple movies that need to be renamed (my setup is a WHS box so moving files around can sometimes take a few mins if it's a large file).  So I rewrote all the renaming defs/functions to generate an array of the original names and an array of the new names and then rename/move everything after all the movies have been selected.  Then I had to write up a function to go back after the renaming and clean up all the dirs from which movies were grabbed from.

Then I added logging. (again...this is my first python script and first program in...wow...9 years...sheesh...been awhile since college).

One of the defs actually has arguments that I have zero reason for using now, but I included them purely because I'm debating moving over non-movie files or parsing them to try to find a IMDB id...

Next steps are to set it up to either take command-line arguments or read from a config file.  And I'd like to do some better name checking - I was going to take a look at your script and see how you're doing the better optimized matching.

All of this was possible since I'm in the process of switching jobs and basically have nothing to do for the next few days...I start there next monday though and everything will most likely stop. :)
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: Started out as just a directory walker and file renamer. 

Then I decided that movies leave too much variability and I didn't have time to figure out a way to do perfect matches - particularly this is the first python script I've ever written from scratch.  So...I started out with a shell and got it setup to grab a dir name, clean it up, and search IMDB for possible matches.  Decided - based on my demo setup - that 5 options should cover 99% of movies and set it up where you select one of the top 5 for what the actual movie is.

Then I decided renaming files was useful also...and realized I'd need to be sure to handle CD1 & CD2 subdirectories.  So...I did that.

Then I decided that I didn't want to have to wait for files to move between selecting what movie was what if there are multiple movies that need to be renamed (my setup is a WHS box so moving files around can sometimes take a few mins if it's a large file).  So I rewrote all the renaming defs/functions to generate an array of the original names and an array of the new names and then rename/move everything after all the movies have been selected.  Then I had to write up a function to go back after the renaming and clean up all the dirs from which movies were grabbed from.

Then I added logging. (again...this is my first python script and first program in...wow...9 years...sheesh...been awhile since college).

One of the defs actually has arguments that I have zero reason for using now, but I included them purely because I'm debating moving over non-movie files or parsing them to try to find a IMDB id...

Next steps are to set it up to either take command-line arguments or read from a config file.  And I'd like to do some better name checking - I was going to take a look at your script and see how you're doing the better optimized matching.

All of this was possible since I'm in the process of switching jobs and basically have nothing to do for the next few days...I start there next monday though and everything will most likely stop. :)

well, that does sound like quite the journey... sounds rather similar to my own script in fact.

I started this back in October or so because I download a ton of movies and tv shows and hate having to move them into my movies/tv shows folders on another computer that I have xbmc running on, then I had to update the library, etc.

I started with some bash scripts, then went to autoit and then discovered python.... enjoying python quite a bit.

Anyway take a look at my script and take what you need if anything and if you don't mind I would like to take a look at your script when you complete it. I have been meaning to include movie file renaming functionality but haven't gotten around to it yet... I unfortunately am pretty busy with work so I don't get to tinker with this stuff as much as I would like.... but happy to have a job for sure!!

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

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

Post by Necro »

No problem!  The main issue with my script right now is it's not user friendly - everything's hardcoded in the script or at least defined in the begining of the script.  And there's minimal error handling as I don't really understand how to catch errors very well or where I should be catching them. 

Odd thing with the UNC paths - I had to double the \'s in the definition of the paths and it worked fine.  Didn't see any difference in you script where I could just put them into the conf file without doubling the \s.  For some reason, every \ needs to be escaped to register properly the way I'm doing it even though there doesn't SEEM to be a difference.

One thing I want to add is multi-file combining (something like this: http://forums.sabnzbd.org/index.php?topic=1712.0)
Last edited by Necro on April 15th, 2009, 8:33 am, edited 1 time in total.
hopcroft
Newbie
Newbie
Posts: 1
Joined: April 24th, 2009, 4:58 am

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

Post by hopcroft »

Hi,

I love this script it really works very well. 

I mainly download TV shows and was wondering if there was anyway to use the script so that the files were named as their episode title as well as their number?

e.g. "BASE_DIRECTORY/SHOW_NAME/Season SEASON_NUMBER/SHOW_NAME - SEASON_NUMBERxEPSIODE_NUMBER - EPISODE_TITLE"

Im useless with episode numbers but can usually tell if ive seen something by its tite, that way i know what to download and what not to download.

Thanks
ntlord
Newbie
Newbie
Posts: 2
Joined: May 3rd, 2009, 6:16 pm

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

Post by ntlord »

Have you thought about maybe integrating the IMDB scraping with the link that is posted on Newzbin? You could check to see if the report number was passed in on the command line, then scrape newzbin for the imdb link, which nearly every post has. Same thing could work for tv listings too.  I know this only works for us newzbin folks, but it would streamline the process significantly and get rid of any scraping errors.
Tijlbert
Release Testers
Release Testers
Posts: 19
Joined: February 20th, 2009, 11:16 am

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

Post by Tijlbert »

Hi, I've been trying to get this to work; I added the script, configured everyrhing (download: /mnt/transdata3/Downloads/ - cat TV so that makes /mnt/transdata3/Downloads/TV).

When I manually run it it outputs:

thetvdb series name matched: http://thetvdb.com/index.php?tab=series&id=73800

Moved Desperate housewives to /mnt/transdata3/tv/Desperate housewives

XBMC (192.168.0.191:80) library update request sent.


Yet nothing is added to XBMC. I'm running v. 9.04 final but I also tried an older version. I suspect that there is something wrong with the login settings. username is xbox according to xbmc but I cannot find anything in the .conf files. ...port is 80...

Any hints?

SOLVED!!! as is.. now it works; I didn't change a thing.
Last edited by Tijlbert on May 8th, 2009, 10:45 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 »

Hey guys,

Been a bit since I updated the script, most things are working alright for now and I haven't had much time to work on new features/bug fixes.

I have noticed that every once in a while my download will be deleted because the script thinks the download is 0MB even though this is not the case. I haven't had a chance to sit down and troubleshoot that one.

Also I am still not entirely happy with the IMDB scraping. Foreign title films are still a problem, especially when there are special language characters in the title. I'll get around to fixing this eventually I suppose but for now it seems to catch most things. I like the idea of using the newzbin links so maybe I will look into that as well.

tret
jk2587
Newbie
Newbie
Posts: 4
Joined: January 22nd, 2008, 11:01 am

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

Post by jk2587 »

The file is no longer on mediafire, any chance of getting it reupped?

Thanks
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 »

jk2587 wrote: The file is no longer on mediafire, any chance of getting it reupped?

Thanks
I was just able to download the file from the link provided, please try it again.

Thanks
sixones
Release Testers
Release Testers
Posts: 43
Joined: January 13th, 2009, 6:10 am

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

Post by sixones »

is this script mirrored anywhere? the media fire link for the os x download doesnt work.
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 »

sixones wrote: is this script mirrored anywhere? the media fire link for the os x download doesnt work.
I am able to download the file with no problems, can you describe where you are running into a problem?
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 »

I have a couple of questions for those of you who are using this script.

1. Any issues with things being removed because they are below the min size limit when this is clearly not the case?
2. How often do you get movies or tv shows that are scraped incorrectly or not at all? Any examples?
3. Any other issues? Any improvements you would like to see? Features?

Rob
Tijlbert
Release Testers
Release Testers
Posts: 19
Joined: February 20th, 2009, 11:16 am

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

Post by Tijlbert »

1 No never
2 Law & order becomes Law and order and then it mismatches to some 1972 miniseries instead.
3. Well since you ask, I want the rating on imdb determen how many beers I should get (the lower the score, the more beers)... no but seriously, I don't have any requests for this script at the moment (except meaby the law & order thing).
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 »

Tijlbert wrote: 1 No never
2 Law & order becomes Law and order and then it mismatches to some 1972 miniseries instead.
3. Well since you ask, I want the rating on imdb determen how many beers I should get (the lower the score, the more beers)... no but seriously, I don't have any requests for this script at the moment (except meaby the law & order thing).
Thanks for the feedback... Special characters cause some issues with my scrapers atm and I'll work on resolving them.

Thanks again!

Rob
joeblack2k
Newbie
Newbie
Posts: 5
Joined: May 8th, 2008, 10:56 am

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

Post by joeblack2k »

First of all great script!

the only thing that's bothering me is it feels like its copying the files from /category to /download folder and not moving (takes 10min for mkv)
is that because the files are on external drive ? (/media/BOOK/downloads/Films -> /media/Book/downloads/Movies.. where Films is the category and Movies the ending-place)

also i found this neat little http cmd for XBMC:

http://192.168.1.96:9777/xbmcCmds/xbmcH ... sting123))

its show's you: Testing
                      testing123

in xbmc.. can that be used when the script is finished ? "MEDIA PROCESSING COMPLETE" (or even capture the imdb movie name or something like that? )

thanx for reading!
Post Reply