The TVDB File Renamer for Plex (no API key or FileBot needed)

Hi Everyone. Plex is an amazing addition to our home. However, naming the files correctly can turn out to be quite a challenge and a chore. I made a program to make that task easier. Here it is. Since the introduction of the new TVDB api, a lot of stuff was broken. This is just an attempt to allow renaming without needing any API key or FileBot etc.

I would love to get your feedback and suggestions on how to improve it. This is my first give back to the Plex community. I hope it can help someone the way it’s helped me.

Let me know what you think. Thanks :slight_smile:

Any aid is good.

You may want to stick with proper file names and structures:

A TV Show Library/
......A TV Show/ <---name exactly as it appears at TVDB
.........Season 01/ <---required
............A TV Show - S01E01.xxx <---show name in the file name
............A TV Show - S01E02 - Episode Name Optional.xxx <--dash before/after 'Sxx/Exx'

Great feedback, that’s exactly what I need. I’ll work on it and update by end of next week hopefully :slight_smile:

Super - I only mention it 'cause we’ve already found out a lot about the ‘new’ TVDB api - and it really likes ‘the details’ to be correct:

I follow your work with interest… carry on.

I was actually planning to create a website, where you can upload your directory structure and it will download a script on your computer (either bash or bat depending on windows or linux) to rename the files so people who want to use this wont have to install Python on their PCs

Looks pretty neat. I have some similar routines in the package I’ve been working on. You might consider using the TVDb API for getting information instead of scrapping the site.

As for the file naming convention, as long as the directory strucute is correct and the S00E00 info are in the file name, plex will match it. It even states in the documentation that the import part is S00E00.

Poor file naming and structuring may work
may work for a while
may stop working at any time - for no reason - other than it being WRONG.

Proper naming and structuring always works.

Almost - but more often than not - and THAT’S why there’s a Fix Match.

Really good suggestion on using the API. However, this program is supposed to do just that. Add S00E00 to your file names if the episode names are matching. Or suppose they S00E00 info is wrong, correct that and match with TVDB. I had that issue, this helped very beautifully with that.

Right, the utilities I have in my package create the correct directory structure, with all but the series name in the file name to reduce the chance of hitting filename character limits.

From the online doc " The important bit in the file name is the appropriate season and episode number notation s02e17". I realize there is a possibility for this to break, but I’ll update it when that happens haha.

If you build a machine that does things to make your life easier - why not have it do the job properly?

Machines by nature aren’t lazy.
They do have a mindless attention to detail - their inventors should take full advantage of - so their file names and structures won’t come up missing something important - the ‘machine’ was programmed to leave out.

Also, let’s not forget the reason you REALLY want to get it right the first time - is when you have to do this a thousand times:

You realize it was much faster to have ’ the machine’ do it right ‘the first time’.
… and if you think you won’t be needing The Plex Dance anyway…:

let’s not use it more than we absolutely have to…

:wink:

No doubt, your work is waaaayyy more than advanced than what I have right now. I just saw your github repo. Very impressive. I hope to reach your level someday soon too :slight_smile:

Also, just a disclaimer. I’m not a python programmer. I just started coding in python maybe 3 weeks ago. So I still have to learn the tricks of the trade :slight_smile:

True, but I’ve seen posts on here where file names were too long and there were issues in the OS. So, to limit that issue, I decided to leave out the series name as it is already in the directory tree. From the error matching post you cited, it seems that plex cares more about the series directory name than the file name.

I don’t disagree that having the series name in the file name is ‘best’, but my renaming code calls the Plex Media Scanner to automatically update all the info (do the plex dance), and my file names contain the TVDb series ID or TMDb movie ID, so renaming in the future will be extremely fast.

There are still tricks I’m learning hahaha. Feel free to ‘steal’ any of my code that seems useful!

I:\2000 - 2009\
.......Borat Cultural Learnings of America for Make Benefit Glorious Nation of Kazakhstan (2006) [1080p HEVC]\
..........Borat Cultural Learnings of America for Make Benefit Glorious Nation of Kazakhstan (2006) [1080p HEVC].mkv

Filebot and I are really happy our OS is good with - what has to be in ‘The Top Ten’ longest movie file names in history…lol
(and we got an instant, first time match with that one)

I know, I prefer that style too where you have the episode name along with the S00E00 prefix. Just feels more complete to me for some reason. But that’s just how I feel about it, absolutely dont feel strongly how others want to name their files!

As long as they show up good in Plex, it’s paradise either way :slight_smile:

Haven’t gotten to sorting by year in my directory tree yet haha

I once had 28 ‘Genre’ Libraries.
I have since moved back to 1 each - Movies and TV.

I do still like to keep things sorted in storage - and kept in smaller chucks scattered hither and yon over the available 4, no 5, no 6 HDDs in Juicetown.

Made moving stuff off a dying HDD not long ago kinda easy (generally speaking).

Anywho - I don’t filter by folder - never have - never will, but I like a good filing system in storage that makes sense - to me.

Oops, I just realized. To access the API I need to register and get my own API key. That’s a bummer. I’ll stick to scraping the website. Its more user friendly that way. Plus the HTML page is structured, so easy to scrape anyway. Please don’t judge me to be a dick for saying this, that’s not the intention, but if you want to copy my function to scrape the site instead of querying the API using a key, you are most welcome to do it. I assemble a key value pair dictionary with the episode name as the key and S00E00 as the value.

I understand not wanting to make a key; I resisted for the longest time. But I built up a family robust interface to Both TMDb and TVDb now in the videotagger subpackage at this piont haha.

Scrapping is great and is more easily shared!