SortTV: Sort TV episodes, movies, and music into directories for xbmc (Linux/Win/Mac)

  Thread Rating:
  • 7 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Big Grin   
Post: #31
jjrroberts Wrote:$5 sent, love both the tool and speed of updates/enhancements!

Donation link is here to save others some time, I looked at your home page for the link when i should have gone to sf.net

Edit - And i see you are a fellow aussie, that makes me even more pleased!

Thanks! I really appreciate it!

It is great to support free open source software, it gives developers warm fuzzy feelings Smile

Thanks again!

Cliffe.
find quote
schmoko Offline
Junior Member
Posts: 48
Joined: Jul 2008
Reputation: 0
Post: #32
Capt.Insano Wrote:Is it possible to have an option that the Script copies the TV Episodes into the correct folders rather than move them?

My Setup:
rtorrent and rutorrent downloads all my shows through RSS to a folder
Code:
/mnt/DATA/Torrents/Complete/TV

I would like to copy these shows to another location:
Code:
/media/FREECOM/TV Shows/[i][b]Show Name/Season #/Episode Name[/b][/i]

Copy is important so that I can finish seeding the shows.

Would the fact that the script would need to remember what shows it has copied and not copy them again make it too difficult to achieve?

Congrats on the Script either way!!
The Capt

I'm using rtorrent too. I updated the script with the following changes:

- If a file in the current directory is a symlink ignore it
- After moving a directory or file, symlink the new location to the current folder

rtorrent is not interrupted in the brief time it takes to move and create the symlink, and you do not have to store two copies of each episode or clean an incoming directory constantly.
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Thumbs Up   
Post: #33
schmoko Wrote:I'm using rtorrent too. I updated the script with the following changes:

- If a file in the current directory is a symlink ignore it
- After moving a directory or file, symlink the new location to the current folder

rtorrent is not interrupted in the brief time it takes to move and create the symlink, and you do not have to store two copies of each episode or clean an incoming directory constantly.

Sounds good. Could you please send me a patch to z.cliffe {-at-} schreuders.org.

To create a patch file:
Code:
diff -u sorttv.pl your-new-version-of-sorttv.pl > sorttv.patch
(or you can use git and pull the latest SortTV version from sourceforge)

If you send me the patch I'll add it as a configurable option. Maybe an option to remove symlinks would also come in handy (could be scheduled for once a week, or so).
find quote
newphreak Offline
Donor
Posts: 183
Joined: Oct 2010
Reputation: 1
Location: sofa @ Norway
Post: #34
i would like to see an option to symlink instead of move/copy, so i wont have to ln -f -s /source/bla/bla /target/bla. can you do that? Smile

edit: all parts under COPY to do symlinks instead, but for a feature release i'd love to see move/copy/symlink option. and maybe something that deletes old dead symlinks hehe.
(This post was last modified: 2010-10-17 03:59 by newphreak.)
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Smile  New version available
Post: #35
A new version of SortTV is now available.

New features:
  • --sort-by:MOVE-AND-LEAVE-SYMLINK-BEHIND
    This option moves the file or directory, then leaves behind a symlink to the newly moved file. This may be handy if you want to continue to seed after sorting.
  • --sort-by:PLACE-SYMLINK
    This does not move the original file, but places a symlink in the sort-to directory. This is probably not what you want, unless you want to keep all your episodes in an unsorted directory and have sorted links to those files. This could be handy if you don't want to change the way your files are organised, but want to have a file organisation compatible with programs such as xbmc.
  • --remove-symlinks:[TRUE|FALSE]
    Deletes symlinks from the directory to sort while sorting. This may be helpful if you want to remove all the symlinks you previously left behind using --sort-by:MOVE-AND-LEAVE-SYMLINK-BEHIND
    You could schedule "perl sorttv.pl --remove-symlinks:TRUE" to remove these once a week/month.
    If this option is enabled and used at the same time as --sort-by:MOVE-AND-LEAVE-SYMLINK-BEHIND, then only the previous links will be removed, and new ones may also be created

Thanks to schmoko for the patch that I incorporated into these features.

I have noticed that a lot of people are not downloading the sample config file. I highly recommend you download the sample and edit it. It is a much simpler way of configuring the script, rather than having to supply the options via the command line arguments.

You can get the new version (and a sample config file) from:
https://sourceforge.net/projects/sorttv/files/

If you find this script helpful then please consider making a $5 paypal donation
http://sourceforge.net/donate/index.php?group_id=330009

newphreak Wrote:i would like to see an option to symlink instead of move/copy, so i wont have to ln -f -s /source/bla/bla /target/bla. can you do that? Smile

edit: all parts under COPY to do symlinks instead, but for a feature release i'd love to see move/copy/symlink option. and maybe something that deletes old dead symlinks hehe.

Check out the new version! Smile

--

These features have been tested on Linux, but should also work with newer versions of Windows (since Vista Windows has supported symbolic links).
(This post was last modified: 2010-10-17 09:54 by cliffe.)
find quote
salithus Offline
Junior Member
Posts: 7
Joined: Sep 2010
Reputation: 0
Post: #36
cliffe Wrote:I have noticed that a lot of people are not downloading the sample config file. I highly recommend you download the sample and edit it. It is a much simpler way of configuring the script, rather than having to supply the options via the command line arguments.

Maybe package them together in a .zip/.tar? The "Download Now!" button only gives you the .pl file, which is probably why no one grabs the config.
find quote
salithus Offline
Junior Member
Posts: 7
Joined: Sep 2010
Reputation: 0
Post: #37
Also, ran into an issue with the latest (may happen with earlier versions, I haven't been keeping mine up to date) where "House" episodes get matched to "Dollhouse". To fix it, I changed:

if(fixtitle($show) =~ /$showname/i || fixtitle2($show) =~ /$simpleshowname/i) {

to

if(fixtitle($show) =~ /^$showname/i || fixtitle2($show) =~ /^$simpleshowname/i) {
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Post: #38
salithus Wrote:Maybe package them together in a .zip/.tar? The "Download Now!" button only gives you the .pl file, which is probably why no one grabs the config.

Ok, now distributed in a .zip, which includes the sorttv.conf

So now it is important to edit that file to the settings you want. Any settings in the conf file can be overwritten by command line arguments.

If you have edited the conf file then doing a sort is as simple as:
Code:
perl sorttv.pl
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Thumbs Up   
Post: #39
salithus Wrote:Also, ran into an issue with the latest (may happen with earlier versions, I haven't been keeping mine up to date) where "House" episodes get matched to "Dollhouse". To fix it, I changed:

if(fixtitle($show) =~ /$showname/i || fixtitle2($show) =~ /$simpleshowname/i) {

to

if(fixtitle($show) =~ /^$showname/i || fixtitle2($show) =~ /^$simpleshowname/i) {

Ok, thanks. Fixed in the latest version, which I have audaciously labelled version 1.0.
find quote
Capt.Insano Offline
Member
Posts: 78
Joined: Mar 2010
Reputation: 0
Location: Dublin, Ireland
Post: #40
Although I made a feature request a few posts back, which was implemented crazily fast (Copy rather than Move), Thank You Cliffe and then even improved upon with Symlink functionality, Thank You Schmoko ; I still haven't started using this great script because no of Episode Naming.

I found a utility called tvnamer with names the episodes from tvdb but doesn't support moving/copying files as well as SortTV. (It supports move, but not copy and no Symlinks)

tvnamer can be found here

http://github.com/dbr/tvnamer

Is there anyway that the tvdb_api can be accessed and used by the SortTV Script to correctly name episodes while sorting them? Or is that beyond the Scope of this Script?

The Capt.

P.S.: I am asking this question, already thinking that SortTV is a fantastic Script and with Thanks to the developer!! Not trying to diss this Script at all!!
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Smile  New version available
Post: #41
Capt.Insano Wrote:Although I made a feature request a few posts back, which was implemented crazily fast (Copy rather than Move), Thank You Cliffe and then even improved upon with Symlink functionality, Thank You Schmoko ; I still haven't started using this great script because no of Episode Naming.

Ok, how's this for crazily fast? I just added a feature to optionally fetch the episode names from thetvdb.com

SortTV Version 1.1 has this new feature:
  • --rename-format:SIMPLE
    As before, files are named "show name S01E01.ext"
  • --rename-format:INCLUDE-EPISODE-TITLE
    Fetches the episode title from thetvdb.com
    Files are named "show name S01E01 - episode title.ext"

SIMPLE is much faster, since INCLUDE-EPISODE-TITLE involves network requests.

The new version also fixes some small bugs.

I guess later I will add image downloading etc. Maybe eventually .nfo generation...

--

Regarding thetvdb.com, this is a free service that has information about tv shows. If you find any information is missing then please log in add add to the database Smile
(This post was last modified: 2010-10-17 21:03 by cliffe.)
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Post: #42
Oh I almost forgot, to upgrade to v1.1 you will need to install the TVDB perl module:

On Linux:
Code:
sudo cpan TVDB::API
On Windows:
Code:
cpan TVDB::API

The first post has been updated with all the new info.
find quote
cliffe Offline
Senior Member
Posts: 185
Joined: Jun 2010
Reputation: 8
Post: #43
Version 1.2 fixes a bug that was introduced in v1.1. So please upgrade.
https://sourceforge.net/projects/sorttv/files/

Regarding installing the perl modules (as described in my last post), it is pretty safe to just hit enter to all the prompts.

I hope the new features come in handy.

I am also interested in hearing more people's experiences with SortTV.

Thanks.
find quote
Capt.Insano Offline
Member
Posts: 78
Joined: Mar 2010
Reputation: 0
Location: Dublin, Ireland
Post: #44
Really looking forward to setting this up, when I'm home from work!!

$10 donation sent, seriously fast development on requests so very well deserved!!

Thanks Cliffe,
The Capt.
find quote
CoinTos Offline
Member
Posts: 87
Joined: Oct 2010
Reputation: 0
Location: Canada
Post: #45
Hi cliffe,

First off really great script. I am just wondering if this script can help me in my migration. I currently have my media on my windows computer, I want to move it my linux raid server I am setting up. Now, correct me if I am wrong but currently you script just sorts to file show title/Season number, which great for most of my shows. An example of a problem for my migration is with new CSI eps I would like it to be sorted to CSI Crime Scene Investigator. Is there a way a custom title support can be added, sort of a extra option in the config or a extra file where I could tell if it find CSI (not Miami/NY) make it CSI Crime Scene Investigator in the sort.

Thanks again for the script.

Edit: Also another example with the current script in my testing, it fails to get the ep title for Mike & Molly since they name the torrented version Mike and Molly. Finally, is there a way to get it to rename Show - S00E00 - Ep Title.avi? Again, sorry to pester and thanks for development on this script, these are just some migration thoughts so I can continue to use tvrename for name changes when needed over samba. I can always adapt if needed. :-)
(This post was last modified: 2010-10-20 18:53 by CoinTos.)
find quote
Post Reply