srtrename: rename subtitle files to match video files

I've recently been watching some videos in a tv series. Having obtained the video files and subtitles from different sources, they had different naming conventions. Mplayer requires that the files have the same name (except for the extension, naturally) Renaming them by hand was a bit of an annoyance, so I wrote "srtrename".

"srtrename" operates under the assumption that it is invoked in a folder with only video files and subtitle files, and that the names of both have a "SSxEE" or "SxE" (season / episode) naming convention, plus an arbitrary amount of noise (such as the name of the show itself). It matches up the subtitle and video files, then prints a series of 'mv -i' commands that would perform the renaming to make the subtitle and video files match. I run it once to look at what it would do, then run it a second time piped to sh to actually do the deed.

I've only used this lightly, but it seems to do the trick.

Note: some extensions for video files are hardcoded; if you have files with a different extension, just add them to the video = glob… line in the obvious (I hope!) way.

Files currently attached to this page:

srtrename514 bytes



Entry first conceived on 19 May 2011, 20:49 UTC, last modified on 15 January 2012, 3:46 UTC
Website Copyright © 2004-2024 Jeff Epler