I often DVR the streaming files from PBS kids, Nick jr., and Disney channel for my kids using PlayOn/PlayLater. The problem I was having was that most to none of the files were named with a season and episode number which is needed for Plex to collect meta data. So I wrote a little python script that reads all the recorded files from the PlayOn directory and then parses them and queries thetvdb.com to get the desired info and then renames the files.
It will only attempt to rename your files if it finds the series and episode names. It strips whitespace and some special chars before doing the comparison in order to better find the episode name the script is not incredibly efficient as it was my first run at both python and JSON/REST and was written for functionality and overcoming any differences in naming conventions as opposed to for clean or speedy code. It was able to properly rename about 90% of the tv show files recorded by PlayOn. The rest it couldn’t fix due to naming inconsistencies between thetvdb and the what the network views as the correct episode name.
To use it you will need to:
Install Python and the requests module.
Sign-up for an account with thetvdb.com.
Create an API key with thetvdb.com.
Enter this information into the payload line of the script.
Edit the rootdir variable to point to your playon files directory.
I hope this helps someone out! cheers!