forked from kenzuya/unshackle
feat(config): add filename_replacements to replace text in output names
This commit is contained in:
@@ -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`, `codec_names`, `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`, `filename_replacements` |
|
||||
| [DRM & CDM](drm.md) | `cdm`, `remote_cdm`, `decryption` |
|
||||
| [Network & proxy](network.md) | `network`, `headers`, `proxy_providers` |
|
||||
| [Key vaults](vaults.md) | `key_vaults`, `vault_timeout` |
|
||||
|
||||
@@ -77,6 +77,7 @@ folder-kind keys.
|
||||
| `tag_imdb_tmdb` | bool | `true` | Write IMDb/TMDB/TVDB external-ID tags into the MKV (needs metadata providers). |
|
||||
| `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. |
|
||||
| [`filename_replacements`](#filename_replacements) | dict | `{}` | Replace text in file and folder names, e.g. `&` with `and`. |
|
||||
|
||||
## `codec_names`
|
||||
|
||||
@@ -107,6 +108,34 @@ The `dl --export` file name does not use `codec_names`.
|
||||
unshackle evaluates [`tag_rules`](#tag_rules) after the rename. With the example above, a
|
||||
rule must match `audio: EAC3`, not `audio: DDP`.
|
||||
|
||||
## `filename_replacements`
|
||||
|
||||
- **Type:** `dict` · **Default:** `{}`
|
||||
|
||||
Replaces text in file and folder names. Each entry of the map names the text to find, and its
|
||||
value is the text to write instead. An empty value removes the text. unshackle applies the map
|
||||
in order, before it sanitises the name, so a later entry also sees the result of an earlier
|
||||
entry. You can also set `filename_replacements` for one service under `services`.
|
||||
|
||||
```yaml title="unshackle.yaml"
|
||||
filename_replacements:
|
||||
"&": and # Tom & Jerry -> Tom.and.Jerry, Tom&Jerry -> Tom.and.Jerry
|
||||
```
|
||||
|
||||
Put quotes around text such as `"&"`: YAML reads a bare `&` as an anchor. When the text to
|
||||
find has no letters or digits and the replacement is a word, unshackle puts a separator on each
|
||||
side of the replacement, so `Tom&Jerry` gives `Tom.and.Jerry`. The map also changes text
|
||||
inside a word: `AT&T` gives `AT.and.T`. An entry that does not map text to text stops
|
||||
unshackle at startup with an error.
|
||||
|
||||
The map applies to the whole name that a template makes, and also to the title part of the
|
||||
`dl --export` file name. Find only text that titles contain: an entry for `-` also changes
|
||||
`WEB-DL` and the `-{tag}` separator. The ` & ` that unshackle writes for `/` and `;` in a
|
||||
multi-episode name stays as it is, unless the map has an entry for `/` or `;`.
|
||||
|
||||
unshackle finds the text before it transliterates the name to ASCII. For a title that uses a
|
||||
variant of a character, such as the fullwidth `&`, add an entry for that variant too.
|
||||
|
||||
## `tag_rules`
|
||||
|
||||
- **Type:** `list` · **Default:** `[]`
|
||||
|
||||
Reference in New Issue
Block a user