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 XBMC (/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


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - ozp1 - 2012-07-21 04:05

Itachi46 after the replacement I got:


All tests complete:
77 tests passed
0 tests failed


Regards.


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - cliffe - 2012-07-21 23:50

(2012-07-19 12:46)itachi46 Wrote:  Hey Cliffe,

I've swapped over to Strawberry Perl rather than active perl (they have issues with getting cpan working on a windows 64-bit)

and the only drama i had was the module File::Glob had to be replaced with File::Glob:Windows there were a few others but Windows made the most sense to me and it seems to be working...

So the tutorial is literally this.

Install Strawberry Perl from here : http://strawberryperl.com/

Open up command line and type this: cpan File::Copy::Recursive File::Glob::Windows LWP::Simple TVDB::API Getopt::Long Switch WWW::TheMovieDB::Search XML::Simple

and to run the script: Perl SortTv.pl or simply double click on the script


edit: @ozp1 I just tested your problem with the downloading season image on ubuntu (this feature is disabled on windows) and i am confident in saying that it is a bug in TVDB::API

specifically $tvdb->getSeasonBanner and $tvdb->getSeasonBannerWide . They are not returning from their call. I have tried getSeasonBanners which returns an array of banner names but to no avail.

if you don't mind letting xbmc parse for the season banners, then find these two lines in sorttv.pl

Code:
    my $banner = $tvdb->getSeasonBanner($fetchname, $season);
    my $bannerwide = $tvdb->getSeasonBannerWide($fetchname, $season);

and replace them with

Code:
    my $banner ="";# $tvdb->getSeasonBanner($fetchname, $season);
    my $bannerwide ="";# $tvdb->getSeasonBannerWide($fetchname, $season);

This will stop sorttv.pl from trying to download the season banners but it will not "freeze" anymore Smile

Thanks for identifying the problem. I have added a time-out, so hopefully the next release will solve that problem.

I have added "File::Glob::Windows" to the README, so hopefully that will help Windows users. So to clarify, on Windows you don't need to install "File::Glob" if you have "File::Glob::Windows"? Thanks.

(2012-07-19 15:11)itachi46 Wrote:  Hey again Cliffe,

I've finished implementing the states... i called them --run-state and --current-state i have also updated the help message.

I know i said i will be using this for personal use but if you think others may want to use this feature then simply ask and i'll give you the source (bear in mind this is my first time developing on perl so its probably not the prettiest of code).

Great. Yes, please send a diff (see the README FAQ). I'll try to include it in the next release. In addition to the --help, please add the feature to the README and to sorttv.conf (with the option commented out). Please try to be consistent with the existing code and documentation. Thanks!

Perhaps later you can include a brief tutorial on how to use SortTV with utorrent. (Maybe even some screenshots?)

It would also be nice to see a simple description of how to schedule SortTV in Windows. (I guess this could either be done by running SortTV on startup with --polling-time=..., or using Windows scheduler to run it every so often).
(2012-07-17 15:26)ozp1 Wrote:  hello. Is there any way to prevent sorttv to take out the file extension from the videos?

The problem is that when I run it, I have to remember what movies were at the original folder and then go to the respective folder (tv or movies) and then find the movie and change the file name in order to get the extension back

My computer can play the files with no extension, but XBMC does not recognize them as video files and they dont show up at the movies/tv list.

regards

Thanks for reporting this. The missing extension issue occurs with certain filenames.This has been fixed for the next release.


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - itachi46 - 2012-07-23 12:53

hey cliffe, I'm really busy this week (going to be travelling for a few days) so I won't be able to do those things until next week Sad sorry Sad


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - hkon - 2012-08-13 14:17

(2012-07-17 15:26)ozp1 Wrote:  hello. Is there any way to prevent sorttv to take out the file extension from the videos?

The problem is that when I run it, I have to remember what movies were at the original folder and then go to the respective folder (tv or movies) and then find the movie and change the file name in order to get the extension back

My computer can play the files with no extension, but XBMC does not recognize them as video files and they dont show up at the movies/tv list.

regards

I have the same problem and I also use Ubuntu.

I think theres a problem in the script in function "is_movie". When I try'd to print out the content of the variable $ext, it was empty. So I added my own regex line to the $ext and then I got the file extention on my files.
Code:
#my $ext = $3;
my ($ext) = $filename =~ /(\.[^.]+)$/;


I dont understand regex or perl very good, but this seems to fix my problem temporary.
I dont know if this solution are going to mess up any other functions in SortTV.


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

(2012-08-13 14:17)hkon Wrote:  
(2012-07-17 15:26)ozp1 Wrote:  hello. Is there any way to prevent sorttv to take out the file extension from the videos?

The problem is that when I run it, I have to remember what movies were at the original folder and then go to the respective folder (tv or movies) and then find the movie and change the file name in order to get the extension back

My computer can play the files with no extension, but XBMC does not recognize them as video files and they dont show up at the movies/tv list.

regards

I have the same problem and I also use Ubuntu.

I think theres a problem in the script in function "is_movie". When I try'd to print out the content of the variable $ext, it was empty. So I added my own regex line to the $ext and then I got the file extention on my files.
Code:
#my $ext = $3;
my ($ext) = $filename =~ /(\.[^.]+)$/;


I dont understand regex or perl very good, but this seems to fix my problem temporary.
I dont know if this solution are going to mess up any other functions in SortTV.

Thanks, the problem was with an earlier regex, and has been fixed. If you are interested in specifics, you can look at the diffs after release, or via Git. I'll release the next (minor) version some time this week.


New version of SortTV available: 1.34 - cliffe - 2012-08-16 01:50

Version 1.34 of SortTV is now available.

Included in this release:
  • --year-tolerance-for-error=number
    The tolerated variance for year matches.
    This applies to movies and to a lesser extent TV episodes for sorting purposes.
    For example, if a year is specified in the filename of a movie to sort, it can be off by this many years and still be considered the same movie as one in tmdb database.
    Note that when sorting TV episodes, this is only considered when identifying local directories to sort into, and if a match is not found, the year is subsequently ignored.
    If not specified, 1
  • Fixed missing file extension issue
  • Updated xbmc library update RPC to work with new versions of xbmc
  • When movie files include "part 1", "CD2", "Disk 1", this is included in the renamed filename
  • Time-outs are applied to image downloads - this is currently hard-coded to 20 seconds, but is planned to be configurable in a future release
  • Various minor changes, such as improving documentation and TVDB substitutions

Thanks to everyone who submitted suggestions.

You can get the new version here:
https://sourceforge.net/projects/sorttv/files/


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - magnumk - 2012-08-19 13:14

Hi

I can't get SortTV to sort the show Suits...

Have tried with the following options:

# Use these tvdb IDs to lookup these shows
tvdb-id-substitute:Suits-->247808

and
show-name-substitute:Suits-->Suits

I use the option MOVE-AND-LEAVE-SYMLINK-BEHIND.
SortTV will sort all other shows and leave symlink behind but but ignore the show, Suits.

Log says:
INFO: Currently checking file: Suits.S02E09.720p.HDTV.mkv

Any ideas how to get it work?


RE: SortTV, automatically sort new episodes into dirs and update XBMC library (Linux/Win) - Holdengts - 2012-08-25 01:00

(2012-07-08 13:35)cliffe Wrote:  If cpan modules are not passing the tests, you can force cpan to install them anyway. Run sudo cpan (or just "cpan" on Windows), then type "force install Switch", where Switch is the name of the module you are trying to install.

Could you please give an example of this force install, as I have run the cpan on windows and then tried running the force but I just get not a recognized command.
I am new to this so do not fully understand what to do.


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - MrCrispy - 2012-08-25 06:50

Thank you for this, I haven't tried it yet but anyone who can write something like this in Perl has my deep and abiding respect! I never could learn that language Smile


RE: SortTV, automatically sort new episodes into dirs and update XBMC library (Linux/Win) - cliffe - 2012-08-25 12:11

(2012-08-25 01:00)Holdengts Wrote:  
(2012-07-08 13:35)cliffe Wrote:  If cpan modules are not passing the tests, you can force cpan to install them anyway. Run sudo cpan (or just "cpan" on Windows), then type "force install Switch", where Switch is the name of the module you are trying to install.

Could you please give an example of this force install, as I have run the cpan on windows and then tried running the force but I just get not a recognized command.
I am new to this so do not fully understand what to do.

Readme:
Quote:Install the modules the script uses:

To do so, run this command on Linux or Mac OS X:
sudo cpan File::Copy::Recursive File::Glob LWP::Simple TVDB::API Getopt::Long Switch WWW::TheMovieDB::Search XML::Simple

On Windows run this via the command prompt:
cpan File::Copy::Recursive File::Glob::Windows LWP::Simple TVDB::API Getopt::Long Switch WWW::TheMovieDB::Search XML::Simple

When prompted, you can select the recommended options by pressing Enter (see the FAQ if you encounter problems)

This installs a list of Perl modules: "File::Copy::Recursive", "File::Glob", and so on. You may be prompted a number of times during the process, and you can typically press Enter each time to accept the default options. If all goes well then that should be all there is to it.

As part of the cpan module install process a number of tests are run, and if the tests fail, cpan may decide not to install certain modules. If this happens, read the output that describes which modules were not installed. You can force them to install, by doing the following:

Run "cpan" (or "sudo cpan" on Linux or Mac systems). When prompted just press enter, until you get a "cpan[1]>" prompt.

Then type "force install Switch" (without the quotes, then press enter), where Switch is the module that cpan is reporting to have failed the tests. For example, "force install File::Copy::Recursive".

I hope that helps.


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - Holdengts - 2012-08-25 23:59

Yeah thanks that help heaps and is now working fine for the movies.

Next Question
How can I get it to sort to different folders for movies, as I have 2 soon to be 3 folders.
Also applies to TV as I have 4 folders for that.
This is due to disk space.

And what I was hoping to be able to do is have the script scan all of them and any double ups would get spat out into a separate folder with a rename done on them to have the file name and then "double up" amended to the end of the file name, for example "Apollo 18 2011 R5 LiNE XviD -MiSTERE" turns into "Apollo 18 2011" when sorted with the script, but if i was to get another copy of Apollo 18, I would like it to go to the folder that I have called "sort manually" but be named "Apollo 18 2011 double up", this way I know that I have the movie already and can then compare the quality and then delete the one I don't want.


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - alessai - 2012-08-26 17:23

Hello,

I tried every thing, and searched every where..... i cant install Switch, i tried to force install it (you provided the command in an early reply) but perl doesnt know what "force" is.... i'm searching for an alternative for SortTV but i hope i can fix the problem since SortTV is the perfect solution for my needs.

I use Windows 7.


I'm done with that problem, now it runs i get SortTV..... donate....etc, then there is a line says can have access to db permission deniad... and the command closes (really fast) so i cant read the error well.


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - gborri - 2012-08-28 09:02

hello Cliffe,

in Italy some broadcaster name the series as follow: "Angelina ballerina [St.1] Ep. 13.mkv". Is it possible that sorttv recognize the series and episode number from this convention?

thanks
Giovanni


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - arthedain - 2012-09-05 13:23

Hi Cliffe,

First of all great job on this wonderful piece of scripting.

However I am wondering if it would be possible to delete directories that have been successfully sorted? To me, where I only have a /incoming folder it's rather pointless to keep the original there when it's sorted into /media/tv/sorted every hour. I don't need both copies. Is this possible? I read through the documentation, and tested a few things, but to my knowledge I wasn't able to configure it to work like that.

Looking forward to be hearing from you!


RE: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - itachi46 - 2012-09-18 18:07

(2012-09-05 13:23)arthedain Wrote:  Hi Cliffe,

First of all great job on this wonderful piece of scripting.

However I am wondering if it would be possible to delete directories that have been successfully sorted? To me, where I only have a /incoming folder it's rather pointless to keep the original there when it's sorted into /media/tv/sorted every hour. I don't need both copies. Is this possible? I read through the documentation, and tested a few things, but to my knowledge I wasn't able to configure it to work like that.

Looking forward to be hearing from you!

you can simply move the file rather than copying the file to the destination