Kodi Community Forum
SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - Printable Version

+- Kodi Community Forum (http://forum.kodi.tv)
+-- Forum: Help and Support (/forumdisplay.php?fid=33)
+--- Forum: Supplementary Tools for Kodi (/forumdisplay.php?fid=116)
+--- Thread: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) (/showthread.php?tid=75949)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45


- spazlon - 2011-11-15 11:19

cliffe Wrote:Ahh, ok, looks like a problem with the way I coded the error checking, not having been tested much on Windows.

If you would like to help this get fixed, could you please edit sorttv.pl and add this:

Code:
my $test = system("rar e -o$over '$arfile' '$dest'");
print "Return code: $test\n";

at line 1105 (just before "if(num_found_in_list(system("rar e -o$over '$arfile' '$dest'"), @errors) eq "FALSE") {")

And then tell me what that prints out next time you run it.

This is the output after I added those lines.

Code:
C:\scripts>sorttv2.bat

C:\scripts>perl c:\scripts\sorttv2\sorttv.pl
SortTV
~~~~~~
Sorting:
        From D:/test/
        TV episodes into D:/test/
        everything else into D:/test/
12:14:42, 15-10-2011
WARN: could not create directory: /D:/test/An.Idiot.Abroad.S02E07.HDTV.XviD-TLA/
an.idiot.abroad.s02e07.hdtv.xvid-tla.rar (extracted by SortTV) (Invalid argument
), extracting to D:/test/An.Idiot.Abroad.S02E07.HDTV.XviD-TLA/
'rar' is not recognized as an internal or external command,
operable program or batch file.
Return code: 256
'rar' is not recognized as an internal or external command,
operable program or batch file.
RAR: extracting D:/test/An.Idiot.Abroad.S02E07.HDTV.XviD-TLA/an.idiot.abroad.s02
e07.hdtv.xvid-tla.rar into D:/test/An.Idiot.Abroad.S02E07.HDTV.XviD-TLA/
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r00
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r01
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r02
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r03
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r04
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r05
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r06
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r07
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r08
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r09
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r10
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r11
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r12
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r13
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r14
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r15
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r16
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r17
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.rar

C:\scripts>

Now there was some confusion. You said to add the code on line 1105, but before "if(num_found_in_list(system("rar e -o$over '$arfile' '$dest'"), @errors) eq "FALSE") {".

"if(num_found_in_list(system("rar e -o$over '$arfile' '$dest'"), @errors) eq "FALSE") {" is on line 1093. Line 1105 is the "}" of line 1104 which is "out("std", "WARN: the rar / 7zip program could not be found, not decompressing $arfile\n");".

Should I have added the code after or inside of the "} esle {"?


- spazlon - 2011-11-16 18:16

Now I have a new error that just started today. I haven't touched any of the configs since this started so I know it isn't anything I changed.

Code:
C:\scripts>perl c:\scripts\sorttv\sorttv.pl
SortTV
~~~~~~
Sorting:
        From D:/New Downloads/New Shows/
        TV episodes into D:/New Downloads/TV Shows/
        everything else into D:/New Downloads/Unsorted/
19:13:41, 16-10-2011
WARN: Failed to get 60 Minutes US series information on the tvdb.com.
SKIP: File D:/New Downloads/Unsorted/60.Minutes.US.2011.11.06.HDTV.XviD-YT.avi a
lready exists, skipping.
Malformed UTF-8 character (fatal) at C:/strawberry/perl/vendor/lib/XML/LibXML/Er
ror.pm line 217.
at C:/strawberry/perl/vendor/lib/XML/Simple.pm line 370

I'm not sure what is causing the error.


- cliffe - 2011-11-17 16:08

spazlon Wrote:This is the output after I added those lines.

Code:
C:\scripts>sorttv2.bat

C:\scripts>perl c:\scripts\sorttv2\sorttv.pl
SortTV
~~~~~~
Sorting:
        From D:/test/
        TV episodes into D:/test/
        everything else into D:/test/
12:14:42, 15-10-2011
WARN: could not create directory: /D:/test/An.Idiot.Abroad.S02E07.HDTV.XviD-TLA/
an.idiot.abroad.s02e07.hdtv.xvid-tla.rar (extracted by SortTV) (Invalid argument
), extracting to D:/test/An.Idiot.Abroad.S02E07.HDTV.XviD-TLA/
'rar' is not recognized as an internal or external command,
operable program or batch file.
Return code: 256
'rar' is not recognized as an internal or external command,
operable program or batch file.
RAR: extracting D:/test/An.Idiot.Abroad.S02E07.HDTV.XviD-TLA/an.idiot.abroad.s02
e07.hdtv.xvid-tla.rar into D:/test/An.Idiot.Abroad.S02E07.HDTV.XviD-TLA/
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r00
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r01
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r02
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r03
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r04
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r05
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r06
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r07
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r08
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r09
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r10
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r11
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r12
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r13
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r14
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r15
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r16
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.r17
SKIP: Matches ignore list: an.idiot.abroad.s02e07.hdtv.xvid-tla.rar

C:\scripts>

Now there was some confusion. You said to add the code on line 1105, but before "if(num_found_in_list(system("rar e -o$over '$arfile' '$dest'"), @errors) eq "FALSE") {".

"if(num_found_in_list(system("rar e -o$over '$arfile' '$dest'"), @errors) eq "FALSE") {" is on line 1093. Line 1105 is the "}" of line 1104 which is "out("std", "WARN: the rar / 7zip program could not be found, not decompressing $arfile\n");".

Should I have added the code after or inside of the "} esle {"?

Thanks. The line numbers didn't match because I was referring to the latest from the git repository, not the last release. Sorry for the confusion. I can add that return value as an error, for the next release. In the mean time you can try it out by changing the line:
Code:
my @errors = (-1, 32512);
to:
Code:
my @errors = (-1, 32512, 256);

Hopefully that would fix the issue and it would realise that the extract command failed and would try the next one.

If you do try that, then please let me know whether it resolves the problem.


- cliffe - 2011-11-17 16:12

spazlon Wrote:Now I have a new error that just started today. I haven't touched any of the configs since this started so I know it isn't anything I changed.

Code:
C:\scripts>perl c:\scripts\sorttv\sorttv.pl
SortTV
~~~~~~
Sorting:
        From D:/New Downloads/New Shows/
        TV episodes into D:/New Downloads/TV Shows/
        everything else into D:/New Downloads/Unsorted/
19:13:41, 16-10-2011
WARN: Failed to get 60 Minutes US series information on the tvdb.com.
SKIP: File D:/New Downloads/Unsorted/60.Minutes.US.2011.11.06.HDTV.XviD-YT.avi a
lready exists, skipping.
Malformed UTF-8 character (fatal) at C:/strawberry/perl/vendor/lib/XML/LibXML/Er
ror.pm line 217.
at C:/strawberry/perl/vendor/lib/XML/Simple.pm line 370

I'm not sure what is causing the error.

Hmm, that's a new one. (Thanks for reporting it.) Maybe one of the files in your sort directory has a file name with non-standard encoding. You could try moving some of the files out until you figure out which one it was.

I think this kind of problem is quite rare, but it would be nice to know what caused it.


- cliffe - 2011-11-17 16:18

Novanod Wrote:Greetings... i may be coming off stupid or some where in that area. but this has gone right over my head...
please verify and answer... in order for sorttv to work i have to have perl installed... 'Did that'
copied sorttv folder to users/name/sorttv
followed README file and ran 'cpan File::Copy::Recursive File::Glob LWP::Simple TVDB::API Getopt::Long Switch WWW::TheMovieDB::Search XML::Simple' in windows start command line box...
it installed the command lines i expect in order to run the sorttv app, took about 4 minutes

now editing the sorttv config file...
my new downloads are on my e:/downloads/new
and i would like the sorted files to be placed on the same drive e:/tvseries
would i change the config file to read as such...
"directory-to-sort=e:/downloads/new"
"tv-directory=e:/tvseries"

which i did, and double clicked on sorttv.pl and a dos box opened and closed and nothing... in the dos box i glimsed a error of "can't locate www/themoviedb/search.pm..............at sorttv.pl line 49..................begin failed"

what am i doing wrong? do i not have everything installed correctly or the tv episodes in the wrong place (they all together) is the config file line wrong...

could someone go through a step by step installation on getting this working... thank you and i appreciate the effort in other peoples work to make my life simpler with a tool like this... how much time i have spent renaming and sorting...

running windows 7 32bit - latest SortTV1.31 and ActivePerl-5.14.2.1402-MSWin32-x86-295342 as of todays date...

EDIT---- I placed a # sign on line 49 in the sorttv.pl file to ignore searching themovieDB...(i am more interested in my tv series than movies... it now scans and renames and places the episodes in the correct areas - BUT the images are all corrupt as spazlon stated above... hope this is sorted in the near future

Try re-running the command:
Code:
cpan File::Copy::Recursive File::Glob LWP::Simple TVDB::API Getopt::Long Switch WWW::TheMovieDB::Search XML::Simple
And look for errors. Maybe one of the modules didn't get installed properly.

Also try installing the specific module that looks to be missing:
Code:
cpan WWW::TheMovieDB::Search


Otherwise as spazlon suggests, maybe it is to do with the version of Perl you are using. I have only ever tried Strawberry Perl on Windows, so you could try that.


- slashr - 2011-11-26 08:26

Hello , getting this error (running ubuntu)

Quote:Can't locate TVDB/API.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.12.4 /usr/local/share/perl/5.12.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.12 /usr/share/perl/5.12 /usr/local/lib/site_perl .) at sorttv.pl line 48.
BEGIN failed--compilation aborted at sorttv.pl line 48.

Any idea what it might be ?

Thanks

Trying the cpan method atm will paste errors if any


Seems like running :
Quote:cpan File::Copy::Recursive File::Glob LWP::Simple TVDB::API Getopt::Long Switch WWW::TheMovieDB::Search XML::Simple

Quote:cpan WWW::TheMovieDB::Search

Did the trick but for future users in case they're having problems :

First time my cpan got messed up kept asking me to configure every time i ran , and didn't install anything , so i deleted the config file and then everything worked fine , yey , testing the script now

Need to test more but hanks alot for such a great work , will donate soon !

Just one question how come some folders are named lowercase ? had some like "top chef" and others like "High Fidelity"

Thanks a bunch , this is a kick ass script indeed

Donated Smile


- slashr - 2011-11-26 12:27

1 more doubt , how can i inform a xbmc server on another machine to update ? running the sorter etc in a different machine than the xbmc client , don't even have xbmc installed on the server .

is it possible to enter an ip or ? thanks in advance Smile


- cliffe - 2011-11-26 12:49

slashr Wrote:Hello , getting this error (running ubuntu)



Any idea what it might be ?

Thanks

Trying the cpan method atm will paste errors if any


Seems like running :



Did the trick but for future users in case they're having problems :

First time my cpan got messed up kept asking me to configure every time i ran , and didn't install anything , so i deleted the config file and then everything worked fine , yey , testing the script now

Need to test more but hanks alot for such a great work , will donate soon !

Just one question how come some folders are named lowercase ? had some like "top chef" and others like "High Fidelity"

Thanks a bunch , this is a kick ass script indeed

Donated Smile

Thanks Smile

The naming capitalisation is based on fetches from thetvdb. If a match is not found in the online database, the capitalisation is as per the file name. If you are not happy with the result you can always rename the directory that was created, with your capitalisation of choice. Future files will be sorted into the existing directory regardless of capitalisation.

slashr Wrote:1 more doubt , how can i inform a xbmc server on another machine to update ? running the sorter etc in a different machine than the xbmc client , don't even have xbmc installed on the server .

is it possible to enter an ip or ? thanks in advance Smile

Although I haven't tested that, it should work. Just replace "localhost" with the IP address, and make sure the ports are open on any firewalls.

Your success with the xbmc integration may vary, depending on the version of xbmc etc. I think the new remote control interface code could use some work (but seems to work on my development machine). If possible, it might be worth testing SortTV on the same machine first. Alternatively, maybe you could somehow just script xbmc to check its library every so often. If anyone reading this has any other advice please chime in.


- slashr - 2011-11-26 13:23

Thanks a bunch , well i could add a cronjob to update library every so often Smile will try the ip thingie , at least will know if it works .

Thanks for this really saved me many headaches with sorting my stuff

And yeah will do the rename thingie , cheers


- jacksback - 2011-12-05 13:12

Recently converted to Linux and was looking for an automated TV-Show renamer. Just found your script and couldn't be happier. Thanks so much for putting this together


- Nexxo - 2011-12-10 07:01

I'm having some issues with the movie renamer. I'm running the script on my Ubuntu Server that acts as a media server to windows machines. The problem is the script is adding ':' in some file / folder names, which causes the names appear as rubbish on windows shares.

I have set the following flag in the config file, but it does not seem to be doing anything.
force-windows-compatible-filenames=TRUE

Any ideas what is causing this?


- cliffe - 2011-12-10 07:21

Nexxo Wrote:I'm having some issues with the movie renamer. I'm running the script on my Ubuntu Server that acts as a media server to windows machines. The problem is the script is adding ':' in some file / folder names, which causes the names appear as rubbish on windows shares.

I have set the following flag in the config file, but it does not seem to be doing anything.
force-windows-compatible-filenames=TRUE

Any ideas what is causing this?

This is because the movie naming feature is currently not honouring that option. This will be fixed in the next release (when I get some time). Thanks for reporting.


- Solo0815 - 2011-12-11 13:48

I get this error on Debian Squeeze:
Code:
Can't locate TVDB/API.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at ./sorttv.pl line 48.
BEGIN failed--compilation aborted at ./sorttv.pl line 48.
I searched in the Inet and a
Code:
perl -MCPAN -e 'install TVDB::API'
didn't help. Any tips?
Thx


- gref - 2011-12-13 19:05

Hi cliffe,

Firstly thanks for the tool - it provides a far simpler way to automate sorting tv and movies and for the most part works very well.

I have a couple of suggestions/queries -

1) How does the tv-id-substitute work? I have a couple of series that I know have pages on tvdb but aren't being renamed correctly because of ambiguities between shows of similar names. I've tried having the folder name link to the substitute as shown below but it doesn't seem to use that when searching on the tvdb...
tvdb-id-substitute:#ShowName#-->123456

2) Secondly, as far as I can see there's no option to sort films into their own folders. This would be great as its the standard for XBMC and makes it far more organised.

Hope you can get back to me with a response but either way, keep up the good work.


- newphreak - 2011-12-17 22:05

Hi, could we get a episode/season substitute to clean up series like Mythbusters and Dirty Jobs? All these things are wrongly named and i would like to clean it up using SortTV with some substitution of episode/season. It would be a long and messy conf, but I would really appreciate fixing issues like this in this matter, not through renaming/messing up my files.
Would that be possible?