feat(naming): add codec_names to rename codec and HDR labels in filenames

A codec name that ends in a digit now gets a separator before the channels, so AC-4 2.0 gives AC-4.2.0 and no longer AC-42.0.
This commit is contained in:
imSp4rky
2026-10-28 14:19:23 -06:00
parent 2e75cc35a1
commit b0c006d7f6
7 changed files with 89 additions and 6 deletions
+2 -2
View File
@@ -163,9 +163,9 @@ For custom templates there is also a standalone [`{part}`](../reference/configur
| Variable | Meaning | Example |
|---|---|---|
| `audio` | Audio codec | `DDP`, `DD`, `AAC`, `DTS-X` |
| `audio` | Audio codec; rename it with [`codec_names`](../reference/configuration/output.md#codec_names) | `DDP`, `DD`, `AAC`, `DTS-X` |
| `audio_channels` | Channel layout; bed.LFE.heights when the track has height channels | `5.1`, `2.0`, `5.1.4` |
| `audio_full` | Codec + channels combined | `DDP5.1`, `DTS-X.5.1.4` |
| `audio_full` | Codec + channels combined; a name that ends in a digit gets a separator | `DDP5.1`, `DTS-X.5.1.4`, `AC-4.2.0` |
| `atmos` | `Atmos` when any track carries JOC | `Atmos` |
| `dual` | `DUAL` for two audio languages (see [`dual_multi_mode`](../reference/configuration/download.md#dual_multi_mode)) | `DUAL` |
| `multi` | `MULTi` for more than two audio languages | `MULTi` |
+1 -1
View File
@@ -32,7 +32,7 @@ Where the file lives, how unshackle discovers it, and how to edit it:
| [Directories](directories.md) | `directories`, `filenames`, `services_repo_force` |
| [Services & authentication](services.md) | `services`, `credentials`, `firefox_cookies`, `remote_services`, `serve` |
| [Download & processing](download.md) | `dl`, `continue_downloads`, `merge_segments`, `subtitle`, `audio`, `muxing`, `language_tags`, `dual_multi_mode`, `generate_dv_mode`, `hdr10plus_probe` |
| [Output & naming](output.md) | `output_template`, `tag`, `tag_rules`, `tag_group_name`, `tag_imdb_tmdb`, `chapter_fallback_name`, `unicode_filenames` |
| [Output & naming](output.md) | `output_template`, `tag`, `tag_rules`, `codec_names`, `tag_group_name`, `tag_imdb_tmdb`, `chapter_fallback_name`, `unicode_filenames` |
| [DRM & CDM](drm.md) | `cdm`, `remote_cdm`, `decryption` |
| [Network & proxy](network.md) | `network`, `headers`, `proxy_providers` |
| [Key vaults](vaults.md) | `key_vaults`, `vault_timeout` |
+26
View File
@@ -69,6 +69,32 @@ folder-kind keys.
| `chapter_fallback_name` | str | `""` | Fallback template for chapter names, e.g. `"Chapter {i:02}"`. |
| `unicode_filenames` | bool | `false` | Allow Unicode in filenames; when `false`, names are ASCII-sanitised. |
## `codec_names`
- **Type:** `dict`  ·  **Default:** `{}`
Renames the codec and HDR names in the filename. Each map key is a name that unshackle writes by
default, and its value is the name to write instead. The map applies to the `video`, `audio`,
and `hdr` [template variables](../../guide/output-and-naming.md#template-variables), and so
also to `audio_full`. A name that is not in the map stays as it is, and an empty value removes
the name. You can also set `codec_names` for one service under `services`.
```yaml title="unshackle.yaml"
codec_names:
DDP: EAC3 # DDP5.1 -> EAC3.5.1
DD: AC3 # DD5.1 -> AC3.5.1
H.265: HEVC # H.265 -> HEVC
HDR10P: HDR10+ # DV.HDR10P -> DV.HDR10+
```
For `hdr`, unshackle renames each part of a Dolby Vision label separately, so `HDR10P` also
changes `DV.HDR10P` to `DV.HDR10+`. When an audio name ends in a digit, `audio_full` puts a
separator before the channels: `EAC3.5.1`, not `EAC35.1`.
!!! note "`tag_rules` see the new names"
unshackle evaluates [`tag_rules`](#tag_rules) after the rename. With the example above, a
rule must match `audio: EAC3`, not `audio: DDP`.
## `tag_rules`
- **Type:** `list`  ·  **Default:** `[]`