SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac)

  Thread Rating:
  • 8 Vote(s) - 4.88 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Malexx Offline
Fan
Posts: 329
Joined: Nov 2009
Reputation: 0
Location: Germany
Post: #106
having a problem again and dont know if i make a mistake or if this just isnt possible.

Ok,in my Download Folder i have a file called"ABC-two.and.a.half.men.s01e01.avi"

im my config i added"show-name-substitute:ABC-two.and.a.half.men-->Two and a Half Men"

what i get is this here
Sorting D:\Download\Series/ into Z:\/
INFO: trying to move ABC-two.and.a.half.men season 1 episode 1
INFO: found a matching show:
Z:\/Two and a Half Men
INFO: found a matching season:
Z:\/Two and a Half Men/Season 1
INFO: Fetching episode title for ABC-two.and.a.half.men Season 1 Episode 1.
WARN: Could not get episode title for ABC-two.and.a.half.men Season Episode 1.

The Problem is when i download my Shows they wont be named like Two and a half Men S01e01 etc ...
And if i have to touch the files before using the SortTV Script it would make it more or less useless.

My Question is,am i doing something wrong here,or is the script just not mentioned for task like this?
THX for any help

greets ...
find quote
CoinTos Offline
Member
Posts: 90
Joined: Oct 2010
Reputation: 0
Location: Canada
Post: #107
Hi Malexx,

I can't test this to confirm at the moment but remove the periods.
ABC-two and a half men-->Two and a Half Men

That should sort it for you.
find quote
Malexx Offline
Fan
Posts: 329
Joined: Nov 2009
Reputation: 0
Location: Germany
Post: #108
edit
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Post: #109
CoinTos Wrote:Cliffe,

This more of a take a look up date I did what you said above but I am still stuck on that used one variable. I cheated with it cause I wanted the actual name sub'ed for everything but episode lookup where I want the tvdb id to be used. I also include a sub that will take a show title and episode title and find the season number and episode number, sadly, I can't figure out how make it work in the reg detection of sort_directory.

Anyways, here the patch so you can take a look if you like.
patch

Maybe just include a separate config option for
Code:
lookup-using-tvdb-id:name->TVDBID

To look for files matching "Show - Episode Title.avi':

Just before
Code:
} elsif(defined $nonepisodedir) {
Put this
Code:
        } elsif(filename($file) =~ /(.*)-(.*)(?:\..*)/) {
            $pureshowname = $1;
            $showname = fixtitle($pureshowname);
            my $episodetitle = fixtitle($2);
            $series = "";
            $episode = "";

            # remove these lines
            print "the extracted possible show name is: $showname\n";
            print "the extracted possible episode title is: $episodetitle\n";

            # here is where you should set $series and $episode if they are found.
            # when doing the comparison with $episodetitle use fixtitle on the tvdb episode title.
            
            if($series ne "" && $episode ne "") {
                if($seasondoubledigit eq "TRUE") {
                    $series = sprintf("%02d", $2);
                }
                if(move_episode($pureshowname, $showname, $series, $episode, $file) eq $REDO_FILE) {
                    redo FILE;
                }
            }

Maybe include a conf option for detecting turning this feature on and add a check that the feature is on in the above elsif condition.
find quote
Targettio Offline
Senior Member
Posts: 160
Joined: Aug 2010
Reputation: 0
Post: #110
I am now using it for the first time in anger (previously I was just trying to make it move one file for testing purposes).

When I have more than 1 file in the file that needs sorted (unsorted), the script will move the first one but then just freeze. I have to manually close the cmd screen and re-run the batch file.

I am guessing a little bit, but I assume there is something in the loop which is messing upConfused

[Image: frozensorttv.png]
(there were 2 files to sort, this screen will never go away unless I clear it)
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Post: #111
Targettio Wrote:I am now using it for the first time in anger (previously I was just trying to make it move one file for testing purposes).

When I have more than 1 file in the file that needs sorted (unsorted), the script will move the first one but then just freeze. I have to manually close the cmd screen and re-run the batch file.

I am guessing a little bit, but I assume there is something in the loop which is messing upConfused

[Image: frozensorttv.png]
(there were 2 files to sort, this screen will never go away unless I clear it)

Try turning off xbmc notifications:
Code:
perl sorttv.pl --xbmc-web-server:
If you don't have it set to your own xbmc webserver, it tries to connect to the server in the config file. On Windows Perl seems to wait a long time for a response. It will be disabled by default in a later release.

Let me know if that helps.
find quote
Malexx Offline
Fan
Posts: 329
Joined: Nov 2009
Reputation: 0
Location: Germany
Post: #112
CoinTos Wrote:Hi Malexx,

I can't test this to confirm at the moment but remove the periods.
ABC-two and a half men-->Two and a Half Men

That should sort it for you.

This didnt work too,it just wont copy or move if the filename doenst have the exact showname.
(This post was last modified: 2010-10-29 22:15 by Malexx.)
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Post: #113
Malexx Wrote:This didnt work too,it just wont copy or move if the filename doenst have the exact showname.

The last release fixed some problems with substitutions. However, that version is limited to Linux. Hopefully the next release will fix those issues you encountered and work on Windows.
find quote
Targettio Offline
Senior Member
Posts: 160
Joined: Aug 2010
Reputation: 0
Post: #114
cliffe Wrote:Try turning off xbmc notifications:
Code:
perl sorttv.pl --xbmc-web-server:
If you don't have it set to your own xbmc webserver, it tries to connect to the server in the config file. On Windows Perl seems to wait a long time for a response. It will be disabled by default in a later release.

Let me know if that helps.

That sorts it! Thanks soo much. Big GrinLaughBig Grin
find quote
Capt.Insano Offline
Senior Member
Posts: 103
Joined: Mar 2010
Reputation: 2
Location: Dublin, Ireland
Post: #115
Wow, I'm away for a week and HUGE changes happen to the Script!! Great work Cliffe, loving some of the updates, especially the Automatic Image Grabbing.

I have a question though;

When the xbmc-web-server argument is set up, should my password be part of the variable?

my sorttv.conf contains;
Code:
xbmc-web-server:localhost:8080

and I see nothing happening to XBMC when the script runs. I have also tried SortTV with:
Code:
xbmc-web-server:user:[email protected]:8080
and still not a thing being seen happening on xbmc.

Both the script and XBMC are running on the same Ubuntu machine and the Script does not show any errors or record errors to the SortTV.log. Also my web-server is definitely running on port 8080, I am running the AWX interface and able to use it on my Laptop.

Am I missing something?
Thanks,
The Capt.
find quote
newphreak Offline
Donor
Posts: 197
Joined: Oct 2010
Reputation: 4
Location: sofa @ Norway
Post: #116
yeah, i havent gotten that to work either just yet Smile nor locally or from a different box on the network.
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Post: #117
Capt.Insano Wrote:Wow, I'm away for a week and HUGE changes happen to the Script!! Great work Cliffe, loving some of the updates, especially the Automatic Image Grabbing.

I have a question though;

When the xbmc-web-server argument is set up, should my password be part of the variable?

my sorttv.conf contains;
Code:
xbmc-web-server:localhost:8080

and I see nothing happening to XBMC when the script runs. I have also tried SortTV with:
Code:
xbmc-web-server:user:[email protected]:8080
and still not a thing being seen happening on xbmc.

Both the script and XBMC are running on the same Ubuntu machine and the Script does not show any errors or record errors to the SortTV.log. Also my web-server is definitely running on port 8080, I am running the AWX interface and able to use it on my Laptop.

Am I missing something?
Thanks,
The Capt.

Make sure you have "allow control of xbmc via HTTP" turned on in xbmc's settings. Test that the network is setup correctly, by opening a web browser (on the system running SortTV) and open this url:
Code:
http://localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn%28Notification%28test,test,%207000%29%29
Where localhost:8080 is however it is setup in xbmc.

You should see a webpage with the message "Ok". And a test message should display in xbmc. If not, check your xbmc and firewall settings.

If you have set a password then include it in the sorttv.conf (as you describe) eg:
Code:
xbmc-web-server:user:[email protected]:8080

You can also include this in the test url:
Code:
http://user:[email protected]:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn%28Notification%28test,test,%207000%29%29
find quote
CoinTos Offline
Member
Posts: 90
Joined: Oct 2010
Reputation: 0
Location: Canada
Post: #118
Hey cliffe,

I am having a hard time with the test string.

Two and a Half Men - Give Me Your Thumb.ts

Using fixtitle() it strips all the space which I don't want.

Using just pureshowtitle it has Two and a Half Men<space>

Using google to search for remove all tailing spaces, I now have a headache. :-)
I can't get a single regex I try to work. Any ideas?
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Post: #119
CoinTos Wrote:Hey cliffe,

I am having a hard time with the test string.

Two and a Half Men - Give Me Your Thumb.ts

Using fixtitle() it strips all the space which I don't want.

Using just pureshowtitle it has Two and a Half Men<space>

Using google to search for remove all tailing spaces, I now have a headache. :-)
I can't get a single regex I try to work. Any ideas?

Please just use fixtitle() on both of the strings you are comparing. Then do a simple match:

Code:
if($s1 =~ /$s2/i) {

}

That way "Two.and.a.halfmen" (or any other likely version) would match "Two and a Half Men", also it won't be fussy about the way the episode title is written.

Update: by the way there is an example of removing trailing whitespace in remdot()
Code:
$title =~ s/\s$//ig;
(Substitute space at the end "s/\s$" with blank "//" until all gone "g")
(This post was last modified: 2010-10-30 18:25 by cliffe.)
find quote
Capt.Insano Offline
Senior Member
Posts: 103
Joined: Mar 2010
Reputation: 2
Location: Dublin, Ireland
Post: #120
cliffe Wrote:You can also include this in the test url:
Code:
http://user:[email protected]:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn%28Notification%28test,test,%207000%29%29

XBMC has "allow control of xbmc via HTTP" enabled and when I use the above URL on another computer on the same network (changing user and pass, and localhost to correct IP address) I get the Correct "Test Test" Pop Up. But SortTV still does not start XBMC Library Update.

SortTV has the correct info:
Code:
xbmc-web-server:user:[email protected]:8080

I could not open a browser and run above URL on the same machine as XBMC as I use a Minimal XBMC Set-Up and have no Browser on the box.

Any further advice?

Thanks
The Capt.

EDIT:
Found out I could use PHP to request a URL through the commandline so I used
Code:
php -r "file('http://[i]USER:PASS[/i]@localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn%28Notification%28test,test,%207000%29%29');"

and I got the required test test PopUp, So I know that xbmc is set up correctly and there is no reason why a localhost request to port 8080 should not work, yet XBMC still will not update on using SortTV.
(This post was last modified: 2010-10-30 20:17 by Capt.Insano.)
find quote
Post Reply