I've been working on a Linux tool to help get content recorded by Channels DVR to the right place in a Plex media library. On the face of it, not hard to do, and I have written scripts to do it. But somehow I'm not really satisfied with what's practical to do with a bash script. So I've been working on something that's 'much better' :slight_smile:

I'm pretty happy with how it's turning out. Thought I'd canvas people to see if they'd find it useful, and if there are improvements they would like to suggest.

  • Paul

Excerpt from the github follows (lots more on Github)

Why does this exist?

I'm a long-time user of Plex, and also use other tools that contribute content to the Plex library. Both Plex and other tools have a preferred way to organize that library, and things generally go more smoothly if everything is using the same naming strategy.

I'm also a fan of the Channels DVR, which has some features that I find very useful. It has its own 'private' directory where it stores its recordings, and while it is well-orgainized, it's a little different to the 'recommended' stucture that Plex, Sonarr, Radarr, et al. prefer.

You can point Plex at the Channels directories holding the recordings, and Plex will figure things out. But... you shouldn't mess with the contents of those directories - no renaming or moving files, no organizing them into 'Season' folders, etc. Channels DVR is expecting things in its 'private' directory to stay where it put them.

So, I wrote a script that hardlinked the recordings Channels DVR made in its private directory into the 'right place' in my Plex library. A hard link doesn't use any more disk space, but means I can rename/move the one in the Plex library without affecting the one in the Channels DVR 'private' directory. The inverse is also true - the Channels DVR can delete its file in the 'private' directory, but the other link to it in the Plex library will remain. Very handy if you want to tell Channels DVR to 'only keep n episodes' (or TiVo/kmttg, for that matter).

Problem solved, right? mostly... the main issue is that the world hasn't yet settled on how a series is named. For something like "Marvel's Agents of S.H.I.E.L.D." there are several variations you may commonly see, like "Marvel's Agents of S.H.I.E.L.D. (2013)", or "Marvels Agents of S.H.I.E.L.D" (no single quote, no trailing period), all the way to "marvels.agents.of.shield". You find that you quickly build up a number of 'alternate' directories containing episodes of the same series - often duplicates (particularly if you have more than one source of recordings as I do - TiVo/kmttg, and Channels DVR)

Not good. This is the itch this tool scratches.

OK, but what does it do?

In a nutshell, it's a specialized string manipulation tool. You feed it the name of a media file, it parses out the series, season, episode, episode title, etc. from the name, and allows you to easily reassemble a new name from the parts it identified.

That in itself is something you could do with sed or awk. So why write this?

The pattern matching is done in a loose/fuzzy way that would be very hard to do in bash script or general-purpose string manipulation tools. It uses a different technique than the usual simple character-by-character string comparison or regular expression methods.

See "How does it work?" below, if you're curious about the details.