A tool for renaming films / tv series based on named regex capture groups and Go templates.
go install git.gryffyn.io/gryffyn/osiris@latest
or
git clone https://git.gryffyn.io/gryffyn/osiris
cd osiris
go buildUsage:
osiris [OPTIONS] [filename...]
Application Options:
-d, --dryrun don't modify files
-s, --silent don't print file names
--no-color disables colored output
-f, --film uses film output format
-Y, --seriesyear whether series year is output
-S, --scene whether scene info is output
-y, --year= release year override
-t, --title= release title override
-c, --config= config file (default ~/.config/osiris/osiris.yml)
-r, --regex= input regex pattern
-p, --preset= preset input regex
Help Options:
-h, --help Show this help message
the regex argument takes in a regex with specifically-named named capture groups.
| name | Output Template Name | example | required | series | film | description |
|---|---|---|---|---|---|---|
| title | Title | (?P<title>\w+) |
✅ | ✅ | ✅ | title of the series/film |
| year | Year | (?P<year>\d{4}) |
❌ | ✅ | ✅ | release year |
| ep | Episode | (?P<ep>S\d{2}E\d{2}) |
✅ | ✅ | ❌ | episode number (ex. S01E01) |
| eptitle | EpisodeTitle | (?P<eptitle>\w+) |
❌ | ✅ | ❌ | episode title |
| scene | Scene | (?P<scene>[\w-\.]+) |
❌ | ✅ | ✅ | scene / release info |
| Type | Template | Example |
|---|---|---|
| Series | {{ .Title }}{{if .Options.SeriesYear}} ({{ .Year }}){{end}} - {{ .Episode}}{{if EpisodeTitle}} - {{ .EpisodeTitle}}{{end}}{{if .Options.Scene }} ({{ .Scene }}){{end}} | Series Title - S01E01 - Episode Title.ext |
| Film | {{ .Title }} ({{ .Year }}){{if .Options.Scene }} ({{ .Scene }}){{end}} | Film Title (YEAR).ext |
The configuration file is by default loaded from a file named osiris.yml (or osiris.yaml, or osiris.toml) in the current user's configuration directory (~/.config/osiris on Linux). The config file location can be overridden with the -c flag.
See contrib/osiris.example.yml or contrib/osiris.example.toml. Copy one of them to the configuration directory and modify as needed.
$ osiris -d '(?P<title>\w+)\.(?P<ep>S\d{2}E\d{2})\.(?P<eptitle>[\w\.]+)\.(?P<scene>WEB-.+)' Title.S01E01.Episode.Title.WEB-DL.H264.SCENE.mkv
Title.S01E01.Episode.Title.WEB-DL.H264.SCENE.mkv -> Title - S01E01 - Episode Title.mkv