ginjaninja 570 Posted May 22, 2022 Posted May 22, 2022 (edited) TVDB constantly changing episodes from specials into a season and vice versa prompted this. I wanted a tool which would align my episode filenames and their indexes to TVDB. #Purpose Renames Files to conform to a prescribed naming scheme. Uses episode name in filename to conform the index in the filename to the matching episode name on TVDB, renaming and moving as necessary. Conservative when recommending a change in index, option for manual operator approval. #Requirements Powershell 7+ Needs access to Measure-StringDistance function add url, api key and server id to config #Constraints Windows Only. Must be run on machine with access to library paths as stored in db. TVDB indexed shows only, will stop processing shows without tvdb index. Only supports aired and dvd display orders, support for others could be changed in code Fixed File Naming Scheme - aligns to Sonarr's treatment of special characters in shows and episodes. eg. trailing . or ?/- in show name, and aggregation of multepisode episodenames with a common root) note - inspect function (extracts names and indexes from path) regex might be tweaked for different naming schemes. Only works with seasons stored as SXX not XX (S is required in filename) - less flexible than embys widest supported naming scheme the filename design is hardcoded to "\Season XX\Showname - SXXEYYEZZ - episodename.ext" , this could be changed in code note: the shows root folder is never touched but the filenames and related season parent folders are prescribed by the filename design Hardcoded to English TVDB, can be changed in code #> changes 0.0.0.4 New - One,More or All shows GUI selection 0.0.0.3 bug fix - file move function broken after subtitle support. 0.0.0.2 new - also rename/move associated subtitle files....limited testing download Assisted Library Clean v0.0.0.4.zip notes Full disclosure, the file matching and confidence engine is sub optimal (if being nice). The script errs on operator assisted matching rather than automation. I had cleaned my library before I got to end, so testing was more academic than practical (less thorough) towards the end. I want to make the recommended matching much stronger/automated but there will always be case when a script can not know, eg for two 'switched' files in season, has the index changed or have the names just switched. So some human intervention might always be required. Example of TVDB Alignment issues / suggestions welcome Edited May 25, 2022 by ginjaninja 1 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now