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

  Thread Rating:
  • 6 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
agentxan Offline
Junior Member
Posts: 1
Joined: Mar 2012
Reputation: 0
Post: #466
I was upgrading some older shows to HD versions and had a problem sorting one episode. I am assuming the problem is the / in the episode title.
Quote:Sorting:
From M:/tvsource/
TV episodes into E:/Series/
0:9:57, 31-2-2012
INFO: trying to move Heroes season 4 episode 16
INFO: found a matching show:
E:/Series/Heroes
INFO: found a matching season directory:
E:/Series/Heroes/Season 4
INFO: Fetching episode title for Heroes Season 4 Episode 16.
MOVE EPISODE: sorting M:/tvsource/Heroes - Season 4 (720p .mkv)/Heroes.S04E16.720p.HDTV.X264-DIMENSION.mkv --to--> E:/Series/Heroes/Season 4/Heroes - S04E16 - Pass/Fail.mkv
File M:/tvsource/Heroes - Season 4 (720p .mkv)/Heroes.S04E16.720p.HDTV.X264-DIMENSION.mkv cannot be moved to E:/Series/Heroes/Season 4/Heroes - S04E16 - Pass/Fail.mkv. : No such file or directory
find quote
magnumk Offline
Junior Member
Posts: 9
Joined: Nov 2009
Reputation: 0
Post: #467
Hi first of all I must say that this script is great!

But I have some issues that ofcourse may be the lack of knowledge on my side.

One of my "problems" is that I have my series directory where all my series is sorted to. In this directory I have a directory named: Game of Thrones.

But when I try to sort the new Game of Thrones episode i get

Sorting:
From /home/xbmc/Media/downloaded/
TV episodes into /home/xbmc/tvserier/
6:0:6, 9-3-2012
INFO: making show directory: /home/xbmc/tvserier/Game of Throne
DOWNLOAD: downloading images for Game of Throne
INFO: making season directory: /home/xbmc/tvserier/Game of Throne/s2
DOWNLOAD: downloading season image for Game of Throne
MOVE-AND-LEAVE-SYMLINK-BEHIND EPISODE: sorting /home/xbmc/Media/downloaded/Game.of.Thrones.S02E02.720p.HDTV.x264-IMMERSE.mkv --to--> /home/xbmc/tvserier/Game of Throne/s2/Game.of.Thrones.S02E02.720p.HDTV.x264-IMMERSE.mkv

Is it possible to make sorttv use the already created "old" directory called Game of Thrones? Yes it's only the letter "S" that is missing... When I try to use the directory Game of Throne created by Sorrtv, xbmc won't download the fanart.
find quote
Fox Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Post: #468
magnumk, that seems strange, the series should be called Game of Thrones.
Why SortTV tries to make a new one without the S is beyond me, here it doesn't.

Maybe you could try to set the "require-show-directories-already-exist" to TRUE so it doesn't make a new one.

If you find any spelling mistakes you can keep them ;)
find quote
magnumk Offline
Junior Member
Posts: 9
Joined: Nov 2009
Reputation: 0
Post: #469
(2012-04-10 08:24)Fox Wrote:  magnumk, that seems strange, the series should be called Game of Thrones.
Why SortTV tries to make a new one without the S is beyond me, here it doesn't.

Maybe you could try to set the "require-show-directories-already-exist" to TRUE so it doesn't make a new one.

I tried that, see result:

Code:
Sorting:
        From /home/xbmc/Media/downloaded/
        TV episodes into /home/xbmc/tvserier/
13:12:13, 10-3-2012
INFO: trying to move Game of Throne season 2 episode 2
SKIP: Show directory does not exist: /home/xbmc/tvserier/Game of Throne
find quote
Fox Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Post: #470
(2012-04-10 13:14)magnumk Wrote:  I tried that, see result:

Code:
Sorting:
        From /home/xbmc/Media/downloaded/
        TV episodes into /home/xbmc/tvserier/
13:12:13, 10-3-2012
INFO: trying to move Game of Throne season 2 episode 2
SKIP: Show directory does not exist: /home/xbmc/tvserier/Game of Throne

Hmm seems like SortTV gets the wrong name for some reason, maybe try with the "tvdb-id-substitute" or the "show-name-substitute" options.
You are using the latest version I guess?

If you find any spelling mistakes you can keep them ;)
find quote
magnumk Offline
Junior Member
Posts: 9
Joined: Nov 2009
Reputation: 0
Post: #471
(2012-04-10 13:44)Fox Wrote:  
(2012-04-10 13:14)magnumk Wrote:  I tried that, see result:

Code:
Sorting:
        From /home/xbmc/Media/downloaded/
        TV episodes into /home/xbmc/tvserier/
13:12:13, 10-3-2012
INFO: trying to move Game of Throne season 2 episode 2
SKIP: Show directory does not exist: /home/xbmc/tvserier/Game of Throne

Hmm seems like SortTV gets the wrong name for some reason, maybe try with the "tvdb-id-substitute" or the "show-name-substitute" options.
You are using the latest version I guess?

"show-name-substitute:Game of Throne-->Game of Thrones" made it work!
Thanks for the qucik support!

Code:
Sorting:
        From /home/xbmc/Media/downloaded/
        TV episodes into /home/xbmc/tvserier/
13:58:28, 10-3-2012
INFO: trying to move Game of Throne season 2 episode 2
INFO: found a matching show:
        /home/xbmc/tvserier/Game of Thrones
INFO: found a matching season directory:
        /home/xbmc/tvserier/Game of Thrones/s2
MOVE-AND-LEAVE-SYMLINK-BEHIND EPISODE: sorting /home/xbmc/Media/downloaded/Game.of.Thrones.S02E02.720p.HDTV.x264-IMMERSE.mkv --to--> /home/xbmc/tvserier/Game of Thrones/s2/Game.of.Thrones.S02E02.720p.HDTV.x264-IMMERSE.mkv
find quote
magnumk Offline
Junior Member
Posts: 9
Joined: Nov 2009
Reputation: 0
Post: #472
My next problem is that SortTv won't touch the show Smash...

I have tried
show-name-substitute:Smash-->Smash 2012

and

tvdb-id-substitute:Smash-->248789 and of course set this to TRUE

I only get:
Code:
Sorting:
        From /home/xbmc/Media/downloaded/
        TV episodes into /home/xbmc/tvserier/
14:13:24, 10-3-2012
(This post was last modified: 2012-04-10 14:25 by magnumk.)
find quote
Fox Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Post: #473
Glad that we found a solution to the Game of Thrones problem, still thats more of a work around then a fix, maybe cliffe can find out a real problem later on.

About Smash... not so much to go on there, maybe turn on the verbose setting and you get some more info, if you haven't already.
How is the file named that you are trying to sort?

*edit*
(2012-04-10 14:15)magnumk Wrote:  I have tried
show-name-substitute:Smash-->Smash 2012

and

tvdb-id-substitute:Smash-->248789 and of course set this to TRUE
Maybe you shouldn't use them both, I'm not sure how it works but maybe you first substitute it to Smash 2012 with the "show-name-substitute" and then the "tvdb-id-substitute" misses due to the substitute earlier.

If you find any spelling mistakes you can keep them ;)
(This post was last modified: 2012-04-10 15:06 by Fox.)
find quote
magnumk Offline
Junior Member
Posts: 9
Joined: Nov 2009
Reputation: 0
Post: #474
(2012-04-10 14:43)Fox Wrote:  Glad that we found a solution to the Game of Thrones problem, still thats more of a work around then a fix, maybe cliffe can find out a real problem later on.

About Smash... not so much to go on there, maybe turn on the verbose setting and you get some more info, if you haven't already.
How is the file named that you are trying to sort?

*edit*
(2012-04-10 14:15)magnumk Wrote:  I have tried
show-name-substitute:Smash-->Smash 2012

and

tvdb-id-substitute:Smash-->248789 and of course set this to TRUE
Maybe you shouldn't use them both, I'm not sure how it works but maybe you first substitute it to Smash 2012 with the "show-name-substitute" and then the "tvdb-id-substitute" misses due to the substitute earlier.

Tried them once at a time.

Verbose is on but I get no info It's as SortTV can't find them.

The files is named like this: Smash.S01E06.720p.HDTV.X264-DIMENSION.mkv
find quote
Fox Offline
Senior Member
Posts: 134
Joined: Oct 2003
Reputation: 1
Post: #475
(2012-04-10 15:34)magnumk Wrote:  Tried them once at a time.

Verbose is on but I get no info It's as SortTV can't find them.

The files is named like this: Smash.S01E06.720p.HDTV.X264-DIMENSION.mkv

Tried it here with that exact filename, it created season folder and moved it into it with no problem whatsoever. Sad
And thats without any of the substitutes.
Folder was created and named Smash manually beforehand.

If you find any spelling mistakes you can keep them ;)
(This post was last modified: 2012-04-10 15:46 by Fox.)
find quote
magnumk Offline
Junior Member
Posts: 9
Joined: Nov 2009
Reputation: 0
Post: #476
(2012-04-10 15:45)Fox Wrote:  
(2012-04-10 15:34)magnumk Wrote:  Tried them once at a time.

Verbose is on but I get no info It's as SortTV can't find them.

The files is named like this: Smash.S01E06.720p.HDTV.X264-DIMENSION.mkv

Tried it here with that exact filename, it created season folder and moved it into it with no problem whatsoever. Sad
And thats without any of the substitutes.
Folder was created and named Smash manually beforehand.
Strange...

I can't get SortTV to sort Smash... Tried to sort from another directory and changed the sort to directory, same result nothing.
find quote
frozenesper Offline
Junior Member
Posts: 1
Joined: Apr 2012
Reputation: 0
Post: #477
I found SortTV a few weeks ago and I love it! If you don't mind, I may have some bugfixes for issues with the 1.32 release. (I don't know perl, but I have some programming experience.)
  • In the sub escape_myfilename, line 1036 should have "\/' added to it, so the whole line should read:
    Code:
            $name =~ s/[\/:*?\"<>|]/-/g;
    This makes it properly sort of a movie like Frost/Nixon as the file Frost-Nixon rather than the file Nixon in the folder Frost.
  • A weird issue with TheMovieDB search. I kept getting occasional wide character errors (similar to some seen earlier in the thread) until I added a line to encode the result of the Movie_search:
    Code:
        my $result = $tmdb->Movie_search(remdot($title));
        $result = Encode::encode("utf8", $result);
    I honestly have no idea what this does, but it seems to have solved my intermittent issues. I decided to try different combinations of encoding and decoding after I did some searching about wide character issues.

I also had some issues with how the movie search works:

Currently: As far as I can tell, after looking for series/season folders, individual episodes by season and ep, and finally episodes by name/date, the sorter treats all remaining (nonep) files as movies. The movie search acts as a fall through for any unknown file.

Problem: That leads to really heavy usage of TheMovideDB api and a lot of noise in the movie folder. (Especially if you're running sorttv often on cron.) For example: I had a zipped android rom in my sort directory that contained hundreds of files. I later found a ton of movies like Core (2010).jar and Network (1976).conf and a really long sorttv.log file.

Workaround: I replaced my current whitelist with common video and subtitle extensions (*.avi, *.m4v, *.mkv, *.mov, *.mp4, *.mpg, *.mpeg, *.ogm, *.wmv, *.divx, *.dvr-ms, *.3gp, *.ssa, *.srt, *.sub) and that pretty much did the trick. This stops me from extracting zip files or sorting audio, but that's fine with me.

I'm not really sure what kind of general solution there is for this, but one possibility might be to include video-file-ext and audio-file-ext conf variables that would stop the sorter if no matching extension is found. (This would have to take place after the extraction step for zip files.)
find quote
john.doe Offline
Banned
Posts: 514
Joined: Aug 2010
Post: #478
Trying to get this work on windows 7. I installed strawberry-perl-5.14.2.1-32bit and when I do

cpan WWW::TheMovieDB::Search

Then I got this error

Code:
C:\strawberry\perl\bin>cpan WWW::TheMovieDB::Search
CPAN: CPAN::SQLite loaded ok (v0.202)
Database was generated on Sun, 29 Apr 2012 08:13:23 GMT
Running install for module 'WWW::TheMovieDB::Search'
Running make for P/PJ/PJOBSON/WWW-TheMovieDB-Search-0.03.tar.gz
CPAN: Digest::SHA loaded ok (v5.63)
CPAN: Compress::Zlib loaded ok (v2.042)
Checksum for C:\strawberry\cpan\sources\authors\id\P\PJ\PJOBSON\WWW-TheMovieDB-S
earch-0.03.tar.gz ok
CPAN: Archive::Tar loaded ok (v1.80)
CPAN: File::Temp loaded ok (v0.22)
CPAN: CPAN::Meta loaded ok (v2.112621)

  CPAN.pm: Building P/PJ/PJOBSON/WWW-TheMovieDB-Search-0.03.tar.gz

Checking if your kit is complete...
Looks good
Warning: prerequisite Switch 0 not found.
Writing Makefile for WWW::TheMovieDB::Search
Writing MYMETA.yml and MYMETA.json
CPAN: Module::CoreList loaded ok (v2.57)
----  Unsatisfied dependencies detected during ----
---- PJOBSON/WWW-TheMovieDB-Search-0.03.tar.gz ----
    Switch [requires]
Running make test
  Delayed until after prerequisites
Running make install
  Delayed until after prerequisites
Running install for module 'Switch'
Running make for R/RG/RGARCIA/Switch-2.16.tar.gz
Checksum for C:\strawberry\cpan\sources\authors\id\R\RG\RGARCIA\Switch-2.16.tar.
gz ok

  CPAN.pm: Building R/RG/RGARCIA/Switch-2.16.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Switch
Writing MYMETA.yml and MYMETA.json
cp Switch.pm blib\lib\Switch.pm
  RGARCIA/Switch-2.16.tar.gz
  C:\strawberry\c\bin\dmake.EXE -- OK
Running make test
C:\strawberry\perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0,
'blib\lib', 'blib\arch')" t/*.t
t/given.t ... Useless use of numeric gt (>) in void context at t/given.t line 19
.
t/given.t ... Failed 2/293 subtests
t/nested.t .. ok
t/switch.t .. ok

Test Summary Report
-------------------
t/given.t (Wstat: 0 Tests: 293 Failed: 2)
  Failed tests:  2-3
Files=3, Tests=590,  1 wallclock secs ( 0.19 usr +  0.00 sys =  0.19 CPU)
Result: FAIL
Failed 1/3 test programs. 2/590 subtests failed.
dmake.EXE:  Error code 255, while making 'test_dynamic'
  RGARCIA/Switch-2.16.tar.gz
  C:\strawberry\c\bin\dmake.EXE test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports RGARCIA/Switch-2.16.tar.gz
Running make install
  make test had returned bad status, won't install without force
Running make for P/PJ/PJOBSON/WWW-TheMovieDB-Search-0.03.tar.gz
  Has already been unwrapped into directory C:\strawberry\cpan\build\WWW-TheMovi
eDB-Search-Y0RQ3K

  CPAN.pm: Building P/PJ/PJOBSON/WWW-TheMovieDB-Search-0.03.tar.gz

Warning: Prerequisite 'Switch => 0' for 'PJOBSON/WWW-TheMovieDB-Search-0.03.tar.
gz' failed when processing 'RGARCIA/Switch-2.16.tar.gz' with 'make_test => NO'.
Continuing, but chances to succeed are limited.
CPAN: Time::HiRes loaded ok (v1.9724)
cp lib/WWW/TheMovieDB/Search.pm blib\lib\WWW\TheMovieDB\Search.pm
  PJOBSON/WWW-TheMovieDB-Search-0.03.tar.gz
  C:\strawberry\c\bin\dmake.EXE -- OK
Running make test
C:\strawberry\perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0,
'blib\lib', 'blib\arch')" t/*.t
t/WWW-TheMovieDB-Search.t ..
#   Failed test 'use WWW::TheMovieDB::Search;'
t/WWW-TheMovieDB-Search.t .. 1/1 #   at t/WWW-TheMovieDB-Search.t line 9.
#     Tried to use 'WWW::TheMovieDB::Search'.
#     Error:  Can't locate Switch.pm in @INC (@INC contains: C:\strawberry\cpan\
build\WWW-TheMovieDB-Search-Y0RQ3K\blib\lib C:\strawberry\cpan\build\WWW-TheMovi
eDB-Search-Y0RQ3K\blib\arch C:/strawberry/perl/site/lib C:/strawberry/perl/vendo
r/lib C:/strawberry/perl/lib .) at C:\strawberry\cpan\build\WWW-TheMovieDB-Searc
h-Y0RQ3K\blib\lib/WWW/TheMovieDB/Search.pm line 8.
# BEGIN failed--compilation aborted at C:\strawberry\cpan\build\WWW-TheMovieDB-S
earch-Y0RQ3K\blib\lib/WWW/TheMovieDB/Search.pm line 8.
# Compilation failed in require at (eval 4) line 2.
# BEGIN failed--compilation aborted at (eval 4) line 2.
# Looks like you failed 1 test of 1.
t/WWW-TheMovieDB-Search.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests

Test Summary Report
-------------------
t/WWW-TheMovieDB-Search.t (Wstat: 256 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
Files=1, Tests=1,  0 wallclock secs ( 0.06 usr +  0.09 sys =  0.16 CPU)
Result: FAIL
Failed 1/1 test programs. 1/1 subtests failed.
dmake.EXE:  Error code 129, while making 'test_dynamic'
  PJOBSON/WWW-TheMovieDB-Search-0.03.tar.gz
one dependency not OK (Switch); additionally test harness failed
  C:\strawberry\c\bin\dmake.EXE test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports PJOBSON/WWW-TheMovieDB-Search-0.03.tar.gz
Running make install
  make test had returned bad status, won't install without force

C:\strawberry\perl\bin>

How can I fix this and get this script to work in w7 ? plz help Confused
find quote
DoubleDroz Offline
Junior Member
Posts: 2
Joined: May 2012
Reputation: 0
Post: #479
I too am getting the MovieDB error, but also I get a "Glob" error - apparently, there is no such file. Copy/Pasting the instructions "cpan File::Copy::Recursive File::Glob LWP::Simple TVDB::API Getopt::Long Switch WWW::TheMovieDB::Search XML::Simple" get me this error everytime!

I'm using the latest (as of yesterday) strawberry perl and am using Windows XP.

I'll try and copy the output from the XP computer when I get a chance to go back to it...

Cheers,

Droz
find quote
Helioy Offline
Junior Member
Posts: 19
Joined: Jan 2011
Reputation: 0
Post: #480
Hello Smile

Is it possible to add support for foreign letters from thetvdb like http://thetvdb.com/index.php?tab=series&id=88091

It should be Bonderøven not Bonderøven as is written right now.

show-name-substitute or tvdb-id-substitute doesn't help here unfortunately
(This post was last modified: 2012-05-05 22:53 by Helioy.)
find quote
Post Reply