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

+- XBMC Community Forum (http://forum.xbmc.org)
+-- 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


Cannot sysopen file '/.tvdb.db': Permission denied - Xian - 2014-05-29 08:08

Hei,
I'm using windows 8 and Strawberry Pearl. I end up with similar problem to Scorrsburg.

(2012-12-09 15:41)cliffe Wrote:  
(2012-12-09 06:55)Scottsburg Wrote:  
Code:
DBM::Deep: Cannot sysopen file '/.tvdb.db': Permission denied

I found reference to this error in the thread way back in 2010, but the only solution then was to setup the config file so the script doesn't require a connection to TheTVDB. However when I do that (no file renaming, no downloading artwork) I get this error message:

Code:
Can't call method "getSeries" on an undefined value at ./SortTV/sorttv.pl line 1705

Check the permissions on sorttv/.cache/.tvdb.db

Perhaps try setting the permissions as liberally as possible (Grant Everyone all permissions to everything in .cache). See if that helps, and set the permissions to something that makes sense afterwards.
(2012-12-10 01:07)Scottsburg Wrote:  I debugged 'sorttv.pl' and the script was stopping at line #294
Code:
$tvdb = TVDB::API::new($TVDBAPIKEY);
The directory ".cache" and the file ".tvdb.db" were not being created at all. I looked through the code for TVDB::API and it tries to create it's database file as soon as an instance is called, using the default location "$ENV{HOME}/.tvdb.db"

In the code for 'sorttv.pl', after the new $tvdb instance is created, the script then creates the '.cache' directory and sets that folder as the location for the $tvdb database. I assumed there was some kind of permission issue going on that didn't allow the code in TVDB::API to create the database in the location it wanted, so I just commented out a line in '/strawberry/perl/site/lib/TVDB/API.pm' - line #74
Code:
$self->setCacheDB($args->{cache});

I don't get how to solve it. And I dont understand how to implement Scottsburg solution. Kinda new when it comes to programing,

Any help would be much appericiated.

Many Thx


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - zapho - 2014-06-09 00:04

Hi cliffe,

Thanks for a wonderful script - it was exactly what I was looking for!

I've only been using the script (version 1.37) a short while and noticed a slight issue which I think is worth reporting. Its not exactly a bug but hopefully this might help you out in the future.
I was having trouble trying to match this file with name: "harry_potter_and_the_philosphers_stone" - it would find the right result but fail after "INFO: Comparing ......".

I noticed the problem was that the sub "fixtitle" was producing two different results from the $title and $moviename - and the reason was due to all the underscores.
Fixtitle won't remove the substrings "and" or "the" from my example filename because the regex you're using is looking for whitespaces on either side of the those substrings.

The simple fix was to add the following right before line 1044.
$title =~ s/_/ /ig;

Anyway, hope this helps.
Cheers!


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - mybrain87 - 2014-06-16 20:32

What would I need to edit to make sorttv rename tv shows and movies all in lowcase.
I want all my files to be lowcase.

can somebody help me please?


SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - Fox - 2014-06-16 21:01

(2014-06-16 20:32)mybrain87 Wrote:  What would I need to edit to make sorttv rename tv shows and movies all in lowcase.
I want all my files to be lowcase.

can somebody help me please?

I don't think there is such an option right now, but if you feel like editing the code a bit it should be fairly simple.
Around row 1819 where you have the if($usedots eq "TRUE") {, I say around because I don't think I have the latest version, if you add
$newfilename = lc($newfilename);
just above I think that should do the trick, but thats the hard-coded and not so nice version. If you want to make it changeable from the config have a look at the
use-dots-instead-of-spaces bool and do something similar.


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - mybrain87 - 2014-06-16 21:14

(2014-06-16 21:01)Fox Wrote:  
(2014-06-16 20:32)mybrain87 Wrote:  What would I need to edit to make sorttv rename tv shows and movies all in lowcase.
I want all my files to be lowcase.

can somebody help me please?

I don't think there is such an option right now, but if you feel like editing the code a bit it should be fairly simple.
Around row 1819 where you have the if($usedots eq "TRUE") {, I say around because I don't think I have the latest version, if you add
$newfilename = lc($newfilename);
just above I think that should do the trick, but thats the hard-coded and not so nice version. If you want to make it changeable from the config have a look at the
use-dots-instead-of-spaces bool and do something similar.

That worked great for tvshows. Thank you very much.

What do i need to change to make lowcase work for movies?


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - Fox - 2014-06-16 21:53

(2014-06-16 21:14)mybrain87 Wrote:  That worked great for tvshows. Thank you very much.

What do i need to change to make lowcase work for movies?

Oh thought that would fix it for both, but then maybe you could change it in the cleanup_filename function instead.
If you add $title = lc($title); at the end of the function (but before the return) it should clean it up for both.


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - mybrain87 - 2014-06-16 22:16

(2014-06-16 21:53)Fox Wrote:  
(2014-06-16 21:14)mybrain87 Wrote:  That worked great for tvshows. Thank you very much.

What do i need to change to make lowcase work for movies?

Oh thought that would fix it for both, but then maybe you could change it in the cleanup_filename function instead.
If you add $title = lc($title); at the end of the function (but before the return) it should clean it up for both.

Big Grin Thanks that did it


DBM::Deep cannot write to a readonly filehandle - mrbrookz - 2014-07-17 12:43

Hi! The script works well, thank you so much for this. I have encountered a problem and I'm not quite sure as to how I could go about resolving it:

I have installed the modules with cpan as explained in the tread and the readme. I installed the modules using the "sudo" option rather than "local:lib" as I wanted other users to be able to access them too in case they would want to run the script.

Here is the problem I encounter:
When I run the script as a user
Code:
perl ./sorttv.pl
I get the following:
Code:
DBM::Deep: Cannot write to a readonly filehandle at /usr/local/lib/perl5/site_perl/5.20.0/TVDB/API.pm line 458
But when I run the script with
Code:
sudo perl ./sorttv.pl
the script runs fine without any problems.
Is this caused by installation of modules with cpan using the "sudo" option? If so, should I reinstall them with cpan and the local:lib option?
I did have to force install the module "File::Glob".

The other problem I encounter is when running the other line of code recommended in the readme:
Code:
perl -MXML::SAX -e "XML::SAX->add_parser(q(XML::SAX::Expat))->save_parsers()"
I get the following error:
Code:
Can't locate XML/Parser.pm in @INC (you may need to install the XML::Parser module) (@INC contains: /usr/local/lib/perl5/site_perl/5.20.0/x86_64-linux /usr/local/lib/perl5/site_perl/5.20.0 /usr/local/lib/perl5/5.20.0/x86_64-linux /usr/local/lib/perl5/5.20.0 .) at /usr/local/lib/perl5/site_perl/5.20.0/XML/SAX/Expat.pm line 11.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.20.0/XML/SAX/Expat.pm line 11.
Compilation failed in require at /usr/local/lib/perl5/site_perl/5.20.0/XML/SAX.pm line 147.

Do I need to install other modules? Not sure this is essential since the script seems to run fine without it.

In case this is important, I am running this on ubuntu 12.04.
Any help is highly appreciated.


EDIT: I think I may not have had the right permissions on the script or contents in its folder.
Code:
sudo chmod -R user:user /opt/sorttv/
I think this may have fixed it for me. Still having the second problem, but not sure if it is essential for me?


Cron error - mrbrookz - 2014-07-21 15:52

I have been testing this script with cron, and using the README instructions I have:
Code:
0 * * * * nice perl /opt/sorttv/sorttv.pl

But I get the error message:
Code:
Can't locate WWW/TheMovieDB.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl +.) at /opt/sorttv/sorttv.pl line 58.

I have installed all the modules, when running cpan .... all required modules are installed successfully and are up to date. The script works fine when run from a user in the terminal. I have entered the information using "crontab -e" under the same user account. Not sure if this is a permissions problem?


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - etnstyles - 2014-08-09 20:32

Hi I am sortTV installed and i have the below perl cpan modules installed.

#instmodsh
Available commands are:
l - List all installed modules
m <module> - Select a module
q - Quit the program
cmd? l
Installed modules are:
Algorithm::Diff
DBM::Deep
Debug::Simple
Encode::Locale
File::Copy::Recursive
File::Glob::Windows
File::Listing
HTML::Parser
HTML::Tagset
HTTP::Cookies
HTTP::Daemon
HTTP::Date
HTTP::Message
HTTP::Negotiate
IO::HTML
LWP
LWP::MediaTypes
Module::Build
Net::HTTP
Perl
Spiffy
Sub::Uplevel
Switch
Test::Base
Test::Deep
Test::Exception
Test::NoWarnings
Test::Tester
Test::Warn
Text::Diff
URI
WWW::RobotRules
WWW::TheMovieDB::Search
XML::NamespaceSupport
XML::SAX
XML::SAX::Base

The sortTV sorts tv episodes fine when I run:
perl5.14.2 sorttv.pl --directory-to-sort:/home/me/Desktop/videos/unsorted-tv/ --directory-to-sort-into:/media/tv

However when I run the command on a movie folder I get the following output.
perl5.14.2 sorttv.pl --directory-to-sort:/home/me/Desktop/videos/unsorted-film/ --directory-to-sort-into:/media/film


(Also lots of html and looks like it is from the sorttv sourceforge website and then below).
SKIP: Matches ignore list: sample.avi
WARN: Failed to get WWW YIFY series information on the tvdb.com.
WARN: Failed to get WWW YIFY series information on the tvdb.com.

I have removed all the weird titles and but I am really unsure what to do next - looking at the sorttv.log just outputs the same.

Sorting:
From /home/me/Desktop/videos/unsorted-film/
TV episodes into /media/film/
2:28:26, 10-7-2014
SKIP: Matches ignore list: sample.avi
WARN: Failed to get WWW YIFY series information on the tvdb.com.
WARN: Failed to get WWW YIFY series information on the tvdb.com.

Any ideas would be great thanks.


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - npkamen - 2014-08-17 06:24

When attempting to run the script on Mac OS 10.9 I get the following error each time:

Quote:SKIP: File /Users/nick/Movies/Kids Shows/Baby Einstein/Season 1/Baby Einstein - S01E06 - Numbers Nursery.m4v already exists, skipping.
SKIP: File /Users/nick/Movies/Kids Shows/Baby Einstein/Season 1/Baby Einstein - S01E07 - Language Nursery.m4v already exists, skipping.
SKIP: File /Users/nick/Movies/Kids Shows/Baby Einstein/Season 1/Baby Einstein - S01E09 - Neighborhood Animals.m4v already exists, skipping.
SKIP: File /Users/nick/Movies/Kids Shows/Baby Einstein/Season 1/Baby Einstein - S01E13 - On the Go.m4v already exists, skipping.
SKIP: File /Users/nick/Movies/Kids Shows/Baby Einstein/Season 1/Baby Einstein - S01E14 - Meet the Orchestra.m4v already exists, skipping.
SKIP: File /Users/nick/Movies/Kids Shows/Baby Einstein/Season 1/Baby Einstein - S01E17 - My First Signs.m4v already exists, skipping.
SKIP: File /Users/nick/Movies/Kids Shows/Baby Einstein/Season 1/Baby Einstein - S01E25 - Lullaby Time.m4v already exists, skipping.
timed out

It just seems to time out. Any way to get more information on what is timing out?

Ran sorttv.pl again with verbose output turned on and get a little bit more information. It seems that the TVDB module is failing.

Quote:INFO: Failed to get season 2 details: Could not find sorttv.xml in ./ at /Library/Perl/5.16/TVDB/API.pm line 260.

Upgrading my CPAN modules now so we'll see if that fixes the issue. Fingers crossed. Man this update takes quite a long time though Sad


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - Ballistic - 2014-08-21 19:19

Sorttv on Freebsd10-RELEASE does not require any other installation steps anymore. The default step (same as Linux) is enough.


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - fliberdygibits - 2014-08-24 13:23

-deleted-


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - true_blue - 2014-09-01 13:01

Hi - new here!

The modules didn't install for me so I have manually installed the moviedb module and now I can't install the JSON::Parse module.

It says:

Code:
dll.exp: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status
dmake.exe:  Error code 129, while making 'blib\arch\auto\JSON\Parse\Parse.dll'
  BKB/JSON-Parse-0.30.tar.gz
  D:\strawberry\c\bin\dmake.exe -- NOT OK
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible
Stopping: 'install' failed for 'JSON::Parse'.
Failed during this command:
BKB/JSON-Parse-0.30.tar.gz                   : make NO

EDIT: I am trying active perl now to see if that helps.. but I have noticed that in both strawberry and active perl, I am getting an error about "configure.com not being compatible with windows 64bit" while installing the File::Glob module.
EDIT2: Still no luck.. saying TVDB::API is not installed now.. have installed ALL modules with the force command. Also still getting "dmake.exe -- NOT OK" error on a few other modules like TVDB::API

EDIT3:
Solved this by uninstalling my anti-virus program, then I reinstalled it when the modules were installed. PITA.
Works fine but a tip to all.. make sure you go through the configs before you use it, because once it starts renaming stuff there is no way back. I rushed in and now my movies don't show whether they are SD or HD as the [QUALITY] switch is disabled by default.. Bit of a bummer and will have to edit them all manually now!! Oh well.. this tool is still amazing and I will be donating this month. Cheers!


Cheers


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc - simonind - 2014-10-05 22:54

Many thanks for the addition of [RATING], I can now automatically segregate movies the kids can watch from those for 'grown-ups' automatically.
Cheers