mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-12 20:15:10 +00:00
feat(tracks): add muxing.track_names none to leave unnamed tracks unnamed
A track the service gives no name keeps none (--list shows [VTT] | en); SDH, CC, Forced and Descriptive labels still apply.
This commit is contained in:
@@ -377,7 +377,7 @@ The server sorts tracks by bitrate, descending. Episodes the server cannot get g
|
|||||||
|
|
||||||
The `drm` array on a track is a list of `{type, pssh?, kids?, content_keys?, license_url?}` objects.
|
The `drm` array on a track is a list of `{type, pssh?, kids?, content_keys?, license_url?}` objects.
|
||||||
|
|
||||||
Every track carries the same fields as a local track: `is_original_lang`, `name`, `needs_repack`, `edition`, and `data`. `name` is the name the service set, or null. `track_name` is the name `--list` shows and the mux writes to an audio or subtitle track: `name` when the service set one, else the name of the language (English, or in the language itself when the server sets `muxing.track_names: native`), with the SDH, CC, Forced or Descriptive label. `bitrate` is in kb/s, and `bitrate_bps` gives the exact bits/s. `data` holds the part of the service-set `track.data` that fits in JSON, without the `hls`, `dash`, and `ism` parser keys. Audio keeps `is_original` and `atmos` for clients that read them, and adds the exact `joc` object count.
|
Every track carries the same fields as a local track: `is_original_lang`, `name`, `needs_repack`, `edition`, and `data`. `name` is the name the service set, or null. `track_name` is the name `--list` shows and the mux writes to an audio or subtitle track: `name` when the service set one, else the name of the language (English, or in the language itself when the server sets `muxing.track_names: native`, or no name when it sets `none`), with the SDH, CC, Forced or Descriptive label. `bitrate` is in kb/s, and `bitrate_bps` gives the exact bits/s. `data` holds the part of the service-set `track.data` that fits in JSON, without the `hls`, `dash`, and `ism` parser keys. Audio keeps `is_original` and `atmos` for clients that read them, and adds the exact `joc` object count.
|
||||||
|
|
||||||
| Status | Error code | Meaning |
|
| Status | Error code | Meaning |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
|||||||
@@ -321,6 +321,9 @@ muxing:
|
|||||||
| `es-419` | Español (Latinoamérica) |
|
| `es-419` | Español (Latinoamérica) |
|
||||||
| `ja-JP` | 日本語 |
|
| `ja-JP` | 日本語 |
|
||||||
|
|
||||||
|
Set `muxing.track_names` to `none` to leave a track unnamed when the service gives it no name. An
|
||||||
|
SDH, CC, Forced or Descriptive track then has only that label as its name.
|
||||||
|
|
||||||
The option also changes the names in `--list` and in the `track_name` field of the REST API.
|
The option also changes the names in `--list` and in the `track_name` field of the REST API.
|
||||||
|
|
||||||
!!! note "Players that show the language next to the name"
|
!!! note "Players that show the language next to the name"
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ Matroska (MKV) muxing options.
|
|||||||
| `default_language` | dict | `{}` | Force which language is flagged *default* per track type, e.g. `{audio: en, subtitle: en}`. A tag with a region, such as `en-US`, matches only that variant. |
|
| `default_language` | dict | `{}` | Force which language is flagged *default* per track type, e.g. `{audio: en, subtitle: en}`. A tag with a region, such as `en-US`, matches only that variant. |
|
||||||
| `merge_audio` | bool | `true` | Merge all audio into one file. `--split-audio` on the CLI flips this off. |
|
| `merge_audio` | bool | `true` | Merge all audio into one file. `--split-audio` on the CLI flips this off. |
|
||||||
| `merge_video` | bool | `false` | Merge video tracks that share height, range, and codec into one file, so only language varies inside a file. `--merge-video` on the CLI flips this on. |
|
| `merge_video` | bool | `false` | Merge video tracks that share height, range, and codec into one file, so only language varies inside a file. `--merge-video` on the CLI flips this on. |
|
||||||
| `track_names` | str | `english` | The language of the name unshackle gives a track that the service left unnamed: `english` (`Chinese (Traditional)`) or `native`, the name in the language itself (`中文(繁體)`). Read [Track names and language tags](../../guide/output-and-naming.md#track-names-and-language-tags). |
|
| `track_names` | str | `english` | The language of the name unshackle gives a track that the service left unnamed: `english` (`Chinese (Traditional)`), `native`, the name in the language itself (`中文(繁體)`), or `none`, which leaves the track unnamed. Read [Track names and language tags](../../guide/output-and-naming.md#track-names-and-language-tags). |
|
||||||
| `concurrency` | int | `4` | How many mkvmerge processes run at the same time when a title muxes more than one output file (one per video variant or audio codec). Each process uses one CPU core, so this shortens the mux step on an SSD. Set it to `1` on a hard disk, where parallel writes are slower. |
|
| `concurrency` | int | `4` | How many mkvmerge processes run at the same time when a title muxes more than one output file (one per video variant or audio codec). Each process uses one CPU core, so this shortens the mux step on an SSD. Set it to `1` on a hard disk, where parallel writes are slower. |
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
@@ -107,6 +107,16 @@ def test_native_subtitle_name_keeps_the_flag(monkeypatch: pytest.MonkeyPatch) ->
|
|||||||
assert sub("zh", name="Mandarin").get_track_name() == "Mandarin"
|
assert sub("zh", name="Mandarin").get_track_name() == "Mandarin"
|
||||||
|
|
||||||
|
|
||||||
|
def test_no_language_name_when_track_names_is_none(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
|
monkeypatch.setattr(config, "muxing", {"track_names": "none"})
|
||||||
|
assert sub("en").get_track_name() is None
|
||||||
|
assert sub("en", sdh=True).get_track_name() == "SDH"
|
||||||
|
assert sub("en", name="English [Full]").get_track_name() == "English [Full]"
|
||||||
|
video = Video(id_="v", url="https://x/v", codec=Video.Codec.AVC, language="en")
|
||||||
|
video.data["audio_language"] = "en"
|
||||||
|
assert video.embedded_audio_name() == ""
|
||||||
|
|
||||||
|
|
||||||
def test_subtitle_names_and_tags_the_script_but_keeps_its_language() -> None:
|
def test_subtitle_names_and_tags_the_script_but_keeps_its_language() -> None:
|
||||||
track = sub("zh-TW")
|
track = sub("zh-TW")
|
||||||
assert track.name is None
|
assert track.name is None
|
||||||
|
|||||||
@@ -1019,11 +1019,17 @@ class Track:
|
|||||||
def embedded_audio_name(self) -> str:
|
def embedded_audio_name(self) -> str:
|
||||||
"""Name the audio a service keeps inside this track's file, by its language when the service set none."""
|
"""Name the audio a service keeps inside this track's file, by its language when the service set none."""
|
||||||
lang = self.data["audio_language"]
|
lang = self.data["audio_language"]
|
||||||
return self.data.get("audio_language_name") or language_name(Language.get(lang)) or lang
|
if name := self.data.get("audio_language_name"):
|
||||||
|
return name
|
||||||
|
if config.muxing.get("track_names") == "none":
|
||||||
|
return ""
|
||||||
|
return language_name(Language.get(lang)) or lang
|
||||||
|
|
||||||
def get_track_name(self) -> Optional[str]:
|
def get_track_name(self) -> Optional[str]:
|
||||||
"""Get the Track Name, or the name of its language when the service set none."""
|
"""Get the Track Name, or the name of its language when the service set none."""
|
||||||
return self.name if self.name is not None else language_name(self.mux_language)
|
if self.name is not None or config.muxing.get("track_names") == "none":
|
||||||
|
return self.name
|
||||||
|
return language_name(self.mux_language)
|
||||||
|
|
||||||
def get_drm_for_cdm(self, cdm: Optional[object]) -> Optional[DRM_T]:
|
def get_drm_for_cdm(self, cdm: Optional[object]) -> Optional[DRM_T]:
|
||||||
"""Return the DRM matching the provided CDM, if available."""
|
"""Return the DRM matching the provided CDM, if available."""
|
||||||
|
|||||||
Reference in New Issue
Block a user