diff --git a/docs/guide/downloading.md b/docs/guide/downloading.md index 2f3cda2f..e9d94805 100644 --- a/docs/guide/downloading.md +++ b/docs/guide/downloading.md @@ -800,7 +800,8 @@ The file name tells what the file holds, in the form - The scope is `S01` only when the file holds every episode the service lists for that season. Otherwise it names each run of episodes. Whole seasons in a row become `S01-S03`. After three parts, `+N` counts the parts left out. A movie has no scope. -- The quality parts come from the tracks in the file. Each value shows once. +- The quality parts come from the video and audio tracks selected for the titles in the file. + Each value shows once. - unshackle renames the file after each write, so the name always matches what the file holds. When a run stops early, the file is complete for the titles it holds. - When another file already has the name, unshackle adds `-2`, `-3`, and so on. It never diff --git a/tests/core/test_export_name.py b/tests/core/test_export_name.py index 8a677bf1..ebb7ad8a 100644 --- a/tests/core/test_export_name.py +++ b/tests/core/test_export_name.py @@ -214,7 +214,7 @@ def test_export_messages(tmp_path: Path, caplog: pytest.LogCaptureFixture) -> No instance.log_export_summary() lines = [r.getMessage() for r in caplog.records] - assert "Exporting to Example Movie 2024_1080p_h264_sdr_dash-EXAMPLE.json" in lines + assert "Exporting to Example Movie 2024_1080p_h264_sdr_dash_aac2.0-EXAMPLE.json" in lines assert "Exported 'Example Movie' (2024): 1 video, 2 audio, 0 subtitles, 1 key" in lines final = tmp_path / "Example Movie 2024_1080p_h264_sdr_dash_aac2.0-EXAMPLE.json" assert f"Saved the export to {final}: 1 title, 1 key" in lines diff --git a/unshackle/core/export_name.py b/unshackle/core/export_name.py index 6ef90550..ae6f35d0 100644 --- a/unshackle/core/export_name.py +++ b/unshackle/core/export_name.py @@ -199,8 +199,14 @@ class ExportNamer: self.path: Optional[Path] = None def add(self, title: Title_T, track: AnyTrack) -> None: + """Record ``track`` and the video and audio tracks selected for ``title``. + + The first write of a title is often a subtitle, and a name from that track alone would + leave out the quality of the title. + """ self.titles.setdefault(str(title.id), title) - self.tracks.setdefault(f"{title.id}/{track.id}", track) + for t in [track, *title.tracks.videos, *title.tracks.audio]: + self.tracks.setdefault(f"{title.id}/{t.id}", t) def name(self) -> str: return export_name(list(self.titles.values()), self.tracks.values(), self.service_tag, self.seasons)