Add context command (windows) to rename media folder and contained file in a format Jellyfin expects: Film Name (Year)
The vast majority of public domain media you can acquire from the internet arrives in the format:
Title.Year.Resolution.Bitrate.Encoding.Etc, e.g. Manos.the.Hands.of.Fate.1966.1080p.REPACK.WEB-DL.AAC2.0.x264
This renaming tool uses the following formatting logic:
- Search for a date string using a simple regex pattern match
\d{4}\., 4 digits followed by a period. Bail if not found. - Drop any characters after the date, wrap the date in parenthesis and replace periods with spaces.
- Apply formatted name to the largest media file (".mp4", ".mkv" or ".avi") found within folder.
- Apply formatted name to folder.
- Compile via
go build main.go- If you have never used go, simply head to https://go.dev/doc/install and follow the instructions, then navigate to the code folder in file explorer, then right click the blank space and select
Open in terminal- then typego build main.go
- If you have never used go, simply head to https://go.dev/doc/install and follow the instructions, then navigate to the code folder in file explorer, then right click the blank space and select
- Edit
install.regto point to the path of the executable you built- Right-click executable, select
Copy as Path, openinstall.reg, replace the file location on the last line
- Right-click executable, select
- Double click
install.reg - Profit (when right clicking folders you will now have the
Rename Downloaded Mediacommand available)
- On newer windows versions you may have to click
Show more optionsto find theRename Downloaded Mediacommand - This currently only works with folders/files using dot notation, e.g.
Manos.the.Hands.of.Fate.1966.1080p.REPACK.WEB-DL.AAC2.0.x264 - You can select multiple folders and run the command
- This will drop periods from public domain films which contain periods, e.g.
D.O.A., and will require manual formatting