SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: Supplementary Tools for Kodi (https://forum.kodi.tv/forumdisplay.php?fid=116) +--- Thread: SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac) (/showthread.php?tid=75949) |
- cliffe - 2010-10-26 nicx76 Wrote:hi, Sorry SortTV currently does its matching and sorting based on figuring out the season and episode number. Then information such as episode titles is retrieved from the tvdb. It would be possible to implement the feature you describe, but I don't see many other people needing it. It seems like a rare case to just have the files named after the episode title without any way to watch them in order... Could you describe or show some examples of the file naming you have. If you are happy to hack away at some Perl programming to add the feature I would be happy to point you in the right direction. - lompelurt - 2010-10-26 Hi Cliffe I'm getting a new error. The tvdb error is gone. Now i'm getting Can't locate Text/Capitalize.pm in @INC (@INC contains: C:/Users/Runar/Downloads /perl/site/lib C:/Users/Runar/Downloads/perl/vendor/lib C:/Users/Runar/Downloads /perl/lib .) at sorttv.pl line 36. BEGIN failed--compilation aborted at sorttv.pl line 36. I've installed Capitalize, but i got alot of errors when installing it. For example it only passes 4 of the 76 test while trying to install it. Any idea why it won't install corectly? I've got the latest strawberry perl installed. - Targettio - 2010-10-26 Hi Cliffe I got the same error as lompelurt, but I simply commented out: Quote:use Text::Capitalize;(line 36) I also found a problem with this line, regardless of what I put in the config file this IF passes, which means I always encounter the permission denied error. Quote:if($renameformat =~ /\[EP_NAME\d]/i || $fetchimages ne "FALSE")(line 67) So I commented out the entire 'if statement' and it works for all that I need (file moving). Unfortunately I don't know enough about perl to fix the problems myself, but as I don't need that functionality I can live with it all commented out. - CoinTos - 2010-10-27 lompelurt Wrote:Hi Cliffe Well, apparently that will be a linux only feature since the package it fails on cannot be built on windows in mingw. It requires PerlIO::locale and it itself won't build on windows due to lack of nl_langinfo support. Code: CPAN.pm: Going to build R/RG/RGARCIA/PerlIO-locale-0.06.tar.gz ------------ Cliffe, Here is a patch to make PRESERVE_ALLCAPS switchable in the config, as I don't use it and figure there will be times when people don't want it on. But now with my above answer I am not sure if it is even worth while since Text::Capitalize appears windows unfriendly due to dependancies unless you know of another more friendly function, I guess it can always be a linux (or mac?) only feature till an alternative is found or coded. Code: --preserve-allcaps:[TRUE|FALSE] - cliffe - 2010-10-27 CoinTos Wrote:Well, apparently that will be a linux only feature since the package it fails on cannot be built on windows in mingw. It requires PerlIO::locale and it itself won't build on windows due to lack of nl_langinfo support. Thanks. Since there are already Windows and Linux users, SortTV will, as far as possible, stay platform independent. I'll probably write a replacement capitalise function when I get a chance. An alternative solution to the title capitalisation would be to do a lookup on thetvdb and see what capitalisation that uses... - lompelurt - 2010-10-27 Targettio Wrote:Hi Cliffe Hi Targettio This might be a stupid question, but what do you mean by you commented out those line. Do you mean you deleted them? I'm new to this so I have no idea what i am doing. - cliffe - 2010-10-27 If you are using Windows then please use v1.11 until v1.14 is released. If you get the Code: DBM: Deep : Cannot sysopen file '/.tvdb' : Permission denied Code: my $tvdb = TVDB::API::new($TVDBAPIKEY); Code: my $tvdb; lompelurt Wrote:Hi Targettio Just add a hash (#) at the start of the line. This tells perl to ignore the line. - Targettio - 2010-10-27 lompelurt Wrote:Hi Targettio cliffe Wrote:Just add a hash (#) at the start of the line. This tells perl to ignore the line. Yeah I just put hashes in front of lines that were causing errors and it all worked fine. (line 36 and the whole IF that starts on line 67) - lompelurt - 2010-10-27 Finally Thanks guys! Appreciate it. - nicx76 - 2010-10-27 cliffe Wrote:Sorry SortTV currently does its matching and sorting based on figuring out the season and episode number. Then information such as episode titles is retrieved from the tvdb. ok just a simple example: this is what i have: "Two and a Half Men - Give Me Your Thumb.ts" this is what i want: "Two and a Half Men - S7E6 - Give Me Your Thumb.ts" is this that complicated? nicx... - CoinTos - 2010-10-28 Cliffe, Took some time after work to remove my Capitalization 'bug' then add a more platform independant solution and fix my $#*! lookup issue. Meet version 1.14rc, due to me working on windows for this and so I can test it there, Eclipse formated the file differently with my new code so a patch file was all but impossible. I mostly likely made it worst when I tried to fix the formating but anyhoo... New features (if accepted): > --show-title-rename - uses tvdb lookup for proper title format. (replaces Text::Capitalize) > added tvdb id support for shows that the ep lookup gets confused on, now you can use the tvdb id # for the sub name. ie. $#*! My Dad Says ep lookup now works with tvdb id. Once again, sorry about the lack of patch file, tomorrow when I am rested again I can copy additions into a basic editor that won't mess with it's formating so I can make a useable patch file. Here is my release candidate if you wish to look at it and implement. Sorttv 1.14rc - cliffe - 2010-10-28 CoinTos Wrote:Cliffe, First of all thanks for taking the time to do this. It is fantastic to get the code contribution. I look forward to incorporating these features into SortTV. A few constructive comments: Please stick to the code style and layout used. I realise that spacing is a matter of preference, but as with contributing to any open source projects, it is polite to use the established style, or discuss changes. I agree with reformatting the eval lines (and maybe some other changes), but when submitting patches please try to stick with the current coding style. It also makes it hard to review feature changes, when you have made lots of unrelated changes. Example of style (no need for blank lines in if statements these are the product of the forum): Code: if(condition1) { I can review changes to style separately, but please send your patch without style changes. Update: I notice you mention your editor made some changes, so perhaps these are all the result of your text editor Regarding the actual feature changes: Please call the argument "--fetch-show-title" or something that can not imply that it forces a file rename. Your version included this strange output: Code: DOWNLOAD: downloading images for CSI: Crime Scene Investigation I look forward to the patch. Please create the patch using: Code: diff -u /path/to/sorttv.pl /path/to/your-new-version-of-sorttv.pl > sorttv.patch (or you can use git and pull the latest SortTV version from sourceforge) Please only include feature changes. (i.e. don't include your own config file settings changes) As you are probably aware, the command dos2unix can convert the Windows formatted file into a Linux formatted file. Anyway, thanks again, I look forward to receiving a patch. - CoinTos - 2010-10-28 Quote:Update: I notice you mention your editor made some changes, so perhaps these are all the result of your text editor That exactly what happened and I again apologize for it, I will submit a proper patch today as I am now not running off of few hours of sleep and not seeing the matrix everywhere I look. :-) Quote:Please call the argument "--fetch-show-title" or something that can not imply that it forces a file rename.Agreed, I blame lack of sleep. Quote:Your version included this strange output:Oops, will be looked at and corrected. Update -------- Here is the patch as it stands now. It contains the code changes for --fetch-show-name and the function for using tvdb id for sub name. I fixed Eclipse so that it will never (ever ever :-)) format the original code auto-magicly. I could not reproduce that log output you posted so I will sum it up as the auto formating of Eclipse which is now fixed. Patch File - cliffe - 2010-10-28 CoinTos Wrote:That exactly what happened and I again apologize for it, I will submit a proper patch today as I am now not running off of few hours of sleep and not seeing the matrix everywhere I look. :-)]Haha. Ok CoinTos Wrote:Agreed, I blame lack of sleep. Thanks for the patch. As is fairly typical for open source collaboration, I have reviewed your code and made some comments below. Please make and test the changes and send me another patch, then I will test and if all is well add to the next release. Cheers. Code: --- /home/greg/SortTV1.13/sorttv/sorttv.pl 2010-10-27 00:05:18.000000000 -0400 Code: my $imagesformat = "POSTER"; Code: $rename = $1; You mean "with or without". Code: + Rename show title to the name stored in thetvdb.com lookup format when moving, can be used with out Code: + my ($from, $filter) = @_; Code: + if ( $subdest =~ /^[+]?\d+$/ && !defined($filter) ) I am inclined to not include this sub since it looks like it pretty much does a different one line thing for each request... Why not just put these one liners where this is being called from? Code: +sub fetchshowdetails { Code: + $return = tvdb_title($show); Code: + my @before = @_; Code: + my $name = fetchshowdetails("EPISODE", substitute_name(remdot($pureshowname), 1), $series, $episode); Also please check the spacing for the lines you have changed. They are often formatted differently. Check the spaces between () and also {} - CoinTos - 2010-10-28 Quote:As is fairly typical for open source collaboration, I have reviewed your code and made some comments below.I sure hope you do cause I am as proficient in programming as I am with flying without having wings. :-) Quote:Tabs rather than spaces pleaseD'oh though I got all them. Quote:Looks like you only use this second arg once. Instead, just add a check in here (see my next comment)You caught me I cheated, I kept running into a problem with it suppling the name not the ID on episode lookup. Quote:I am inclined to not include this sub since it looks like it pretty much does a different one line thing for each request... Why not just put these one liners where this is being called from?It's soon to be gone, I had this crazy idea for the look up with only Show Title and Ep Title known to make one big tvdb sub but it didn't work out like I hoped. Quote:Also please check the spacing for the lines you have changed. They are often formatted differently. Check the spaces between () and also {} I'll work on that. Update -------- Cliffe, This more of a take a look up date I did what you said above but I am still stuck on that used one variable. I cheated with it cause I wanted the actual name sub'ed for everything but episode lookup where I want the tvdb id to be used. I also include a sub that will take a show title and episode title and find the season number and episode number, sadly, I can't figure out how make it work in the reg detection of sort_directory. Anyways, here the patch so you can take a look if you like. patch |