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
wiak Offline
Junior Member
Posts: 11
Joined: May 2012
Reputation: 0
Post: #481
do sorttv support whitelist?
like say if i only want "Ikke gjør dette hjemme", "Tekno" to be sorted
and can i specify the directories each show goes into?
will it scan into sub directories in downloads directory?

and another question what do i need to run it on windows?
what software?

XBMC 11 "Eden"
AMD Athlon II 240e
AMD 780G (Radeon HD 3200)
OCZ 4GB (2x2GB) DDR3 800mhz
Samsung F4EG 500GB
Windows 7 Home Premium SP1 x64
(This post was last modified: 2012-05-08 01:25 by wiak.)
find quote
Helioy Offline
Junior Member
Posts: 16
Joined: Jan 2011
Reputation: 0
Post: #482
(2012-05-08 01:25)wiak Wrote:  and another question what do i need to run it on windows?
what software?

Strawberry Perl 32/64bit. Open CMD and cpan File::Copy::Recursive File::Glob LWP::Simple TVDB::API and then follow first post..
Some dependencies are not installed and it will give you an error. Just read the last line and type cpan example:: to download the,
find quote
john.doe Offline
bugmenot login
Posts: 495
Joined: Aug 2010
Reputation: 0
Post: #483
Can some1 help me to get this work on w7. Cant install packages gives me error all the time. How to fix this??

Code:
C:\>cd strawberry/perl/bin

C:\strawberry\perl\bin>cpan File::Copy::Recursive File::Glob LWP::Simple TVDB::A
PI Getopt::Long Switch WWW::TheMovieDB::Search XML::Simple
CPAN: CPAN::SQLite loaded ok (v0.202)
Database was generated on Fri, 11 May 2012 17:44:47 GMT
CPAN: Module::CoreList loaded ok (v2.57)
File::Copy::Recursive is up to date (0.38).
Warning: Cannot install File::Glob, don't know what it is.
Try the command

    i /File::Glob/

to find objects with matching identifiers.
CPAN: Time::HiRes loaded ok (v1.9724)
LWP::Simple is up to date (6.00).
TVDB::API is up to date (0.33).
Getopt::Long is up to date (2.38).
Running install for module 'Switch'
Running make for R/RG/RGARCIA/Switch-2.16.tar.gz
CPAN: Digest::SHA loaded ok (v5.63)
CPAN: Compress::Zlib loaded ok (v2.042)
Checksum for C:\strawberry\cpan\sources\authors\id\R\RG\RGARCIA\Switch-2.16.tar.
gz ok
CPAN: Archive::Tar loaded ok (v1.80)
CPAN: File::Temp loaded ok (v0.22)
CPAN: Parse::CPAN::Meta loaded ok (v1.4401)
CPAN: CPAN::Meta loaded ok (v2.112621)

  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.16 usr +  0.06 sys =  0.22 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 install for module 'WWW::TheMovieDB::Search'
Running make for P/PJ/PJOBSON/WWW-TheMovieDB-Search-0.03.tar.gz
Checksum for C:\strawberry\cpan\sources\authors\id\P\PJ\PJOBSON\WWW-TheMovieDB-S
earch-0.03.tar.gz ok

  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
----  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
  Has already been unwrapped into directory C:\strawberry\cpan\build\Switch-2.16
-PKwdoZ
  Has already been made
Running make test
  Has already been tested within this command
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-SSVZ4A

  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.
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 ..
t/WWW-TheMovieDB-Search.t .. 1/1 #   Failed test 'use WWW::TheMovieDB::Search;'
#   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-SSVZ4A\blib\lib C:\strawberry\cpan\build\WWW-TheMovi
eDB-Search-SSVZ4A\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-SSVZ4A\blib\lib/WWW/TheMovieDB/Search.pm line 8.
# BEGIN failed--compilation aborted at C:\strawberry\cpan\build\WWW-TheMovieDB-S
earch-SSVZ4A\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,  1 wallclock secs ( 0.05 usr +  0.08 sys =  0.13 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
XML::Simple is up to date (2.18).

C:\strawberry\perl\bin>perl sorttv.pl
Can't locate WWW/TheMovieDB/Search.pm in @INC (@INC contains: C:/strawberry/perl
/site/lib C:/strawberry/perl/vendor/lib C:/strawberry/perl/lib .) at sorttv.pl l
ine 52.
BEGIN failed--compilation aborted at sorttv.pl line 52.

C:\strawberry\perl\bin>
find quote
drossmill06 Offline
Junior Member
Posts: 2
Joined: Apr 2012
Reputation: 0
Post: #484
I was having the same issue as john.doe for the time being I removed line 52 from the sorttv.pl file. Seems to be able to sort TV ep now, I haven't tried sorting movies. This could fix your problem temporary until a better fix is found.
find quote
john.doe Offline
bugmenot login
Posts: 495
Joined: Aug 2010
Reputation: 0
Post: #485
Thank you, got my tv shows sorted for now Smile. Only problem is that all the images are corrupted, cant view them. :/
find quote
drossmill06 Offline
Junior Member
Posts: 2
Joined: Apr 2012
Reputation: 0
Post: #486
I turned the download images setting off and let xbmc download the images
find quote
Fox Offline
Senior Member
Posts: 129
Joined: Oct 2003
Reputation: 1
Post: #487
Cliffe I found a new error code, if winrar runs into a CRC it returns 768.

You probably know this already but the delete part seems to be a bit on its own. If you run a dry-run it still delete the files and also if you catch an error with in the extraction part it doesn't cancel the delete.

/Fox

If you find any spelling mistakes you can keep them ;)
find quote
deranjer Offline
Junior Member
Posts: 4
Joined: Apr 2012
Reputation: 0
Post: #488
(2012-04-18 19:31)frozenesper Wrote:  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.)

frozenesper, thanks for your encode fix, worked well, however, I would encourage everyone NOT to use your

Code:
        $name =~ s/[\/:*?\"<>|]/-/g;

as this will strip out the "\", which breaks the preserve folder structure feature for nonep files since the sub sort_other() calls the function, which strips the "\" from the file name, which will then flatten all non-ep files, whether you want it to or not.
find quote
deranjer Offline
Junior Member
Posts: 4
Joined: Apr 2012
Reputation: 0
Post: #489
I have edited sorttv.pl to add the following options you can set in the sorttv.conf file:

Code:
#OPTIONAL - These extensions are NOT movies or TV shows or music, treat them as non episodes/Movies automatically
#Note: Will not run these file types through tvdb, etc.
#non-media-ext=smc,pdf,mobi,jpg,exe

# OPTIONAL - The movie-in-folder setting tells sorttv that if if finds a movie file to move it to the movie directory,
# but create a folder in the movie directory for the movie, named after the movie.
# For example, it would name a movie "The Bourne Identity - 2002.avi" and then create a folder in the movie directory
# and place the movie in it like so: "The Bourne Identity - 2002\The Bourne Identity - 2002.avi".
# If not specified, FALSE
movie-in-folder=FALSE

# OPTIONAL - The movie-move-folder setting tells sorttv that if it finds a FOLDER that matches a movie directory name (not TV)
# then sorttv will rename and move the folder (AND ALL CONTENTS) into the movie directory wholesale.
# Note: Currently, this option WILL NOT rename or sort ANY of the contents of the folder, including the movie.
# If not specified=FALSE
movie-move-folder=FALSE

I have tested this as best I could on linux (this is not tested on Windows), and it seems to work okay. I am not good at programming perl, so I'm sure I did this the long way, and perhaps did some things wrong. I will submit this to the original author as well, see if he is interested it looking it over and integrating it/optimizing it.

You can download the modified script below:

Download
find quote
cableghost Offline
Junior Member
Posts: 13
Joined: Jun 2012
Reputation: 0
Post: #490
Newbie here...

I'm not understanding the install and run functions. I have tried reading XBMC scripting readme, but it doesn't jive with sorttv instructions.

1. I don't have an existing directory called 'scripts in my default XBMC install directory 'C:\Program Files (x86)\XBMC', so where do I copy/move the 'sorttv' folder to?
3. What is meant by 'install pearl'
2. Where do I run: 'cpan File::Copy::Recursive File::Glob LWP::Simple TVDB::API Getopt::Long Switch WWW::TheMovieDB::Search XML::Simple'?

My setup: Windows 7 HP x64

Any help would be appreciated.

-Scott

P.S. Does any of this change if using Raspberry Pi?
find quote
Post Reply