How to Automate TV Show Downloads and Rename Them

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

HOW TO GUIDE TO AUTOMATICALLY DOWNLOADING TV SHOWS
I automate all my tv show downloads with torrents like my computer is my own personal Tivo. For those who don't know how to do this I will explain, and you may wish to set this up for yourself as well.

I use a program called TED (torrent episode downloader) found here http://www.ted.nu. TED will automatically download the torrent for a tv show as soon as it's added to the internet. TED than saves the torrent file in a folder I have designated (I called this folder TED Downloads on my computer.

Then Transmission (my torrent program of choice), I have set up to watch the TED Downloads folder and whenever a torrent file is added to Ted Downloads, Transmission will start downloading it. Once the tv show has completed downloading, Transmission saves the completed file into my Torrent Downloads folder.

At which point I have Hazel set up to watch my Torrent Downloads folder, and I have the rules set up in such a way as it places that tv show file into the folder I wish it to be in.

e.g. Hazel rules for tv show Dexter.
Folder Torrent Downloads
Name starts with Dexter
Move File to folder Dexter - Season 5

Then anytime a new episode of Dexter airs, as soon as it hits the internet, it downloads automatically on my computer and Hazel sorts it into the appropriate folder once finished. I set this up with all the tv shows I watch.

Then I set up my PS3 (or Xbox or Tivo with PyTivoX http://code.google.com/p/pytivox/) to stream all those to my tv when I choose.

But there is a problem...
How can i automatically rename the downloaded tv shows?

When one downloads Dexter for example it reads
Dexter.S05E07.HDTV.XviD-FEVER.avi
Which is formatted very bad, looks ugly, doesn't have title of episode, and has all this unneeded information. I would like it to read something like this...
Dexter - 5x07 - Circle Us.avi

There are lots of programs on the internet that rename tv shows. Such as:
http://filebot.sourceforge.net/
http://www.tvrename.com/ (Windows)
http://amongstbits.com/transmogrifier.html
But none are that good (or automated like Hazel is).

So does anyone have an idea of how renaming TV shows can be automated. Is there a way to take the file name of a torrent, automatically query websites like TVDB.com, IMDB.com, TV.com, and find the tv show name and rename them in a way that makes sense? Filebot renames the tv shows correctly, but one has to manually find the file, and plug in the information. I want something that can be automated. Perhaps a fancy Applescript that Hazel can trigger to rename the file? Anyway, if there are any computer nerds out there that can come up with a solution it would be greatly appreciated.

Also if anyone wants any help or clarification on the steps to automatically downloading TV shows and sorting them into folders. I will gladly respond.

Thanks.
dannymalt
 
Posts: 5
Joined: Mon Nov 15, 2010 8:25 pm

sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene

Yes I saw that post. I am looking into this https://github.com/dbr/tvnamer/ program he uses to rename his tv shows. Perhaps I can get that to work.

However I must say I find his process for steps 1,2 and 3 to be a much more complicated than my way.
dannymalt
 
Posts: 5
Joined: Mon Nov 15, 2010 8:25 pm

dannymalt wrote:Yes I saw that post. I am looking into this https://github.com/dbr/tvnamer/ program he uses to rename his tv shows. Perhaps I can get that to work.

However I must say I find his process for steps 1,2 and 3 to be a much more complicated than my way.


First, let me chime in since that is my thread you are referring to :) Tvrenamer will do EXACTLY what you want. Not only that it will allow you to get rid of all the Hazel rules you have setup for each TV episode - so no need to have move scripts for Dexter, 30 Rock, etc since TVnamer can not only auto move these files into the proper show folders but also into the proper season folders. With your rules, you will need to add a new rule or modify the existing ones every season for every tv show.

I know it wasnt a criticism but when you say your process is less complicated, i agree but its also not as complete. Just for others who are looking into doing this let me make a few points. First, i did not know TED was now available for the Mac. The reason i made my custom rss automator action was because the best Mac TV show downloader app (at least was the best until i now have seen TED) was TV Shows. But TV shows just pulls from EZTV and many of their shows are not in HD (720p). And there is no way to add a custom RSS feed. There is also the Automatic app but it costs money and frankly i just copied the functionality with my automator action. TED it seems not only has predefined RSS feeds but you can add your own. I will be moving to TED as soon as i test it to make sure it works better. If so, i will be revising my post. So a hearty thanks.

Second, if you are using the defaults for TED then you are likely getting downloads that come as MKVs or AVIs with no need to uncompress (many other torrent sites uploads are broken up into separate RAR files that need to be compiled into the MKV). My process allows you to add RSS feeds with this in mind and hence the extra steps.

Lastly, since you are moving your downloaded files you are likely not seeding them as the locations will have changed. That is fine but many people like to seed, especially if you are on custom torrent sites which require it. Hence that part of my process.

Your process is excellent, streamlined and very simple. Once you see how TVnamer works you will have total bliss!

Let me know if you need help with TVnamer.
dhy8386
 
Posts: 94
Joined: Tue Nov 09, 2010 12:19 pm

Hey dhy8386, first let me say you are right. I didn't fully elaborate on TED. I use a custom feed that I find from http://ezrss.it/ as that way it will only download a single file, as if you use the feeds TED generates you may download some RARs or MKVs or have the video in a folder, and other problems. I also don't understand why Transmission/utorrent(for mac) doesn't have RSS downloading capabilities.

But anyway, onto the renaming issue.

I would like your help getting this TVnamer (https://github.com/dbr/tvnamer/) to work. I've downloaded it, and installed it, using the "sudo easy_install tvnamer" command line. I believe all that worked properly. But I am lost after that.

So can you explain the steps involved once you have your finished tv download, and how to set it up to rename/move it to the appropriate folder, and keep that process automated for the future?

Any help would be appreciated.
dannymalt
 
Posts: 5
Joined: Mon Nov 15, 2010 8:25 pm

Ok. First, we should test that its working. First the naming. Then we can move on to the moving.
1) Open up terminal.
2) Either use a real file or just rename a text document with a .avi extension and use a name like Dexter.5x5.x264-CTU.avi
3) In terminal, type in tvnamer and then just drag the created file onto the terminal window. This will auto populate terminal with the path to the file. Then hit enter.

TVnamer should do its thing and present you with a list of possible matches 1 through 6. Type 1, which would be the english option, and hit return. It will then ask you to confirm the new filename, type y and return. Tvnamer should say complete and your file should be renamed.

The next step is to create a configuration file which you can edit. It is here you would enter the exact format you want (so as you can see, the default is Dexter - [05x05] - Show name.avi; i prefer Dexter - S05E05 - Show Name.avi) as well as configure the location as to where you will move the file. Frankly, its probably easier for me to send you my default config file and then you can simply edit from there. There are a bunch of other standard configs you will want to make that i have already done. If you PM me your email, i can send you my config file.

In the config file, you will see an entry for "move_files_destination". It is here where you just need to change the path to the path where all your TV show folders exist. So in mine, its /Volumes/TV Shows. Under TV Shows I have folders for Dexter, 30 Rock, Glee, etc. Then within those i have folders for the respective seasons. Assuming you have it setup the same way, you can leave the default part of the movescript untouched after the path name (so my full entry is "/Volumes/TV Shows/%(seriesname)s/Season %(seasonnumber)d").

Then save this file. Now we will test the move script.

1) Open up terminal again.
2) Type TVnamer
3) Now you have to tell TVnamer to use your config file so type --config= then drag the config file onto the terminal. Again this is the easiest way to create the path to the config file. Then rename the test Dexter file back to Dexter.5x5.x264-CTU or whatever you named it and then drag the file onto the terminal. Yours will look different than mine but my terminal line looks like this: Tvnamer --config=/Users/dillanscomputer/Documents/mytvnamer.json /Users/dillanscomputer/Desktop/Dexter.5x5.x264-CTU.avi

Note that the config file i sent you (or will send you) is configured to auto rename the file and never asked for confirmations so when you hit return on the line above to kick off the process, TVnamer will run through and do its thing. If you are using Tvnamer on a show that you do not have a folder for, it will create it for you on your target volume. If you use it on a season of a show that does not exist, it will create that subfolder for you. When TVnamer completes, you should not see any errors in the terminal window and your file should have disappeared. Check the target volume you specified in the config script and you should see you file properly labeled and filed under the respective TV show.

Assuming this all works, last piece is to incorporate all of this into Hazel. Again, i can send you all my rules and you can look at the shell script i created to run TVnamer.

One final note. So I had a folder for Dexter already created when i ran TVnamer for the first time on a bunch of Dexter episodes. When i looked, it had created a new Dexter folder for me. I wasnt sure why it didnt use my existing one since they looked exactly the same. Turns out in my existing one there was a space after the r in Dexter and TVnamer saw this and built a new Dexter folder thinking it did not exist. So make sure there are no random spaces at the end of your folder names.

Report back and let us know. Also dont forget to PM your email so i can send you the config file. Or again, someone tell me how to post attachments. :)
dhy8386
 
Posts: 94
Joined: Tue Nov 09, 2010 12:19 pm

dhy8386 wrote:Or again, someone tell me how to post attachments. :)

Attachments aren't supported/enabled here, but links in img and url BBCode can be used for off-forum references.
sjk
 
Posts: 332
Joined: Thu Aug 02, 2007 5:43 pm
Location: Eugene

It took me an hour and a half but I did it. :D

This is by no means user friendly. Someone should create an easy to use program that does this so more people in the general public can get on this thing.

But anyway, this works beautifully. Once the tv show enters my Torrent Folder, it is automatically is moved and renamed to my liking. But what makes this even better, is that it creates the tv season folder for you.

So anyway my thanks for all the help.
dannymalt
 
Posts: 5
Joined: Mon Nov 15, 2010 8:25 pm

Hello!

I tried to make tvnamer work via Hazel, but I cannot get tvnamer to certainly move my files. It seems more that it copies them and just occasionally moves them.
this ist my config.json:

{
"always_rename": true,
"batch": true,
"custom_filename_character_blacklist": "",
"episode_separator": " ",
"episode_single": "%02d",
"filename_with_date_and_episode": "%(seriesname)s e%(episode)s %(episodename)s%(ext)s",
"filename_with_date_without_episode": "%(seriesname)s e%(episode)s%(ext)s",
"filename_with_episode": "%(seriesname)s s%(seasonno)02de%(episode)s %(episodename)s%(ext)s",
"filename_with_episode_no_season": "%(seriesname)s e%(episode)s %(episodename)s%(ext)s",
"filename_without_episode": "%(seriesname)s - s%(seasonno)02de%(episode)s%(ext)s",
"filename_without_episode_no_season": "%(seriesname)s e%(episode)s%(ext)s",
"input_filename_replacements": [],
"language": "en",
"lowercase_filename": false,
"move_files_confirmation": false,
"move_files_destination": "/Volumes/Elements/Media/Series/%(seriesname)s s%(seasonnumber)02d/",
"move_files_enable": true,
"move_files_fullpath_replacements": [],
"multiep_join_name_with": ", ",
"normalize_unicode_filenames": false,
"output_filename_replacements": [],
"recursive": true,
"replace_invalid_characters_with": "_",
"search_all_languages": true,
"select_first": false,
"skip_file_on_error": true,
"valid_extensions": ["avi","mp4","m4v","wmv","mkv","mov"],
"verbose": false,
"windows_safe_filenames": true
}

What do yours look like? Does tvnamer have an option to force moving files?

greets, codenaga
CodeNaga
 
Posts: 1
Joined: Tue Jan 18, 2011 9:17 am

I believe the problem is because you have to rename where it says:
"move_files_destination": Then input the correct series path where you want it to save on your computer. Mine is this:

"move_files_destination": "/Users/Dan/Movies/TV Shows/%(seriesname)s s%(seasonnumber)02d/"

You rename the path to where you want it to save.
dannymalt
 
Posts: 5
Joined: Mon Nov 15, 2010 8:25 pm

HI is it possible to post the shell script for starting up tvnamer?

thank you
shmerek
 
Posts: 5
Joined: Wed Sep 16, 2009 7:48 pm

CodeNaga wrote:Hello!

I tried to make tvnamer work via Hazel, but I cannot get tvnamer to certainly move my files. It seems more that it copies them and just occasionally moves them.


If you are moving files to networked volume they will not move they will copy. Thats how OSX works by default as does the script. Do a test. Change the move location to the same disk as the where the file you want to move are stored on. Just set up a test folder. I would bet that then they will move when its run.
dhy8386
 
Posts: 94
Joined: Tue Nov 09, 2010 12:19 pm

shmerek wrote:HI is it possible to post the shell script for starting up tvnamer?
thank you


The shell script and all other script are here in a thread i made. Just download my hazel rules and you will see the tvnamer shell script. its very very straight fwd.

viewtopic.php?f=3&t=874
dhy8386
 
Posts: 94
Joined: Tue Nov 09, 2010 12:19 pm

personally I found out that filebot has an automation feature/script that you can add to transmission so that when the download completes it will rename the file correctly, pull artwork (banners,poster,fan art) copy OR move into folder structure of your choice even on different /Volumes. Cleanup left over files and other parameters that you can choose.


I'm using TVShows http://tvshowsapp.com (this automates the download process with many shows supported)
Couchpotato found at https://couchpota.to (this automates my movie downloads)
Transmission http://www.transmissionbt.com to download said TVShows and Movies
and Finally Filebot at http://www.filebot.net/#download to automate the renaming of Movies and Shows.

see this link http://www.filebot.net/forums/viewtopic.php?f=4&t=520 regarding the automation process

my specific setup is
Code: Select all
#!/bin/bash
/Applications/Filebot.app/Contents/MacOS/filebot -script fn:amc --output "/Volumes/Media/Incomplete/complete" --log-file amc.log --action copy --conflict override -non-strict --def deleteAfterExtract=y artwork=y subtitles=en clean=y backdrops=y  "seriesFormat=/Volumes/Media/TV/{n.replaceTrailingBrackets()}/Season {s}/{n.replaceTrailingBrackets()} -S{s}E{e.pad(2)} - {t}" "movieFormat=/Volumes/Video/M0vies/{n} ({y})/{n} ({y}) [{certification}]" "musicFormat=/Volumes/Media/Muzik\ to\ add\ to\ iTunes/{n}/{fn}"  plex=gallo "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME"


in my case I have filebot process any file in /Volumes/Media/Incomplete/complete/ which will in turn COPY said into my specified Movie, TV or Music folder based on matches. I do this so the downloaded (complete) files are not altered and I keep my seeding ratio UP. The {} are the naming parameters that can be further explained by searching through the filebot forum.

ALSO when the files are processed it will tell my Plex host to refresh library data. it also works with XMBC. since Plex is my endgame I have no need to transcode or remux any files.

In case anyone needs/wants this information I use
Code: Select all
{n.replaceTrailingBrackets()}
to rename a show by name and delete anything in parenthesis. TVDB.com pulls up Archer as "Archer (2009)" Shameless as "Shameless (US)", "Intelligence (2014)" this can confuse hazel for other rules I have it run later as my movies are named "movieName (year)"

for movies I have it add the {certification} which is the MPAA rating G,PG,PG-13,R. Once every things sorted out I use Hazel
if ALL the following...
Kind is Movie
AND
Date last Modified IS NOT in the last 3 hours
AND
Name matches tokens | "movieName" "(year)" [G] |
DO ....
Move to /Volumes/Childrens movies
AND
sort into subfolder with pattern "movieName" "(year)"


hopefully at least ONE person besides myself will find this useful
elgallo
 
Posts: 17
Joined: Sat Apr 19, 2014 7:41 am

Late reply here, but I just stumbled up on your solution...

LET ME BE THE ONE PERSON (or first among millions) to find this extremely useful, thank you!

Just a few quick questions:

1) so you basically run this script in the Mac GUI Transmission, can it be run in Raspberry Pi flavored transmission? Or could hazel run this script when items show up in my "complete" folder? (copied to mac, like you to keep ratio up, from Pi)

2) plex=gallo I didn't know plex was scriptable, is that your mac admin user name? or plex login name? username? The plex part of the script totally baffles me

3) how do you deal with filebot's trouble with incompatible characters : ? etc

MANY THANKS! this is awesome.
redzep
 
Posts: 5
Joined: Sun Nov 03, 2013 5:30 pm

Next

Return to Open Discussion