Skip to content

Added subtitle track duration to manual search to tell same-language tracks apart#3416

Open
andersonviudes wants to merge 2 commits into
morpheus65535:developmentfrom
andersonviudes:feature/manual-search-embedded-duration
Open

Added subtitle track duration to manual search to tell same-language tracks apart#3416
andersonviudes wants to merge 2 commits into
morpheus65535:developmentfrom
andersonviudes:feature/manual-search-embedded-duration

Conversation

@andersonviudes

@andersonviudes andersonviudes commented Jul 4, 2026

Copy link
Copy Markdown

Summary

  • Adds a per-track duration hint to embedded subtitle results in manual search, so tracks sharing the same language show up as distinguishable entries instead of duplicates.
  • Reads the per-track MKV DURATION tag (falling back to the language-suffixed DURATION-eng tag, then the container duration) and surfaces it as Duration: h:mm:ss in the release info shown to the user.
  • Small refactor of release-info assembly in manual.py into _build_release_info() to make room for the new hint; no behavior change for existing single-track-per-language cases.

Context

When an MKV has multiple subtitle tracks in the same language, embeddedsubtitles.py only exposed stream.duration, which reflects the container's total duration for every stream — so every same-language track looked identical in manual search, with nothing to tell them apart.

Per-track MKV DURATION tags actually differ between tracks and are the right signal here. For same-language tracks, mkvmerge/ffprobe often reports this tag language-suffixed instead (e.g. DURATION-eng), which the vendored fese library already exposes as stream.tags.duration_eng (mirroring how it already falls back for number_of_frames/number_of_frames_eng). The fix stays fully scoped to Bazarr's own custom_libs/subliminal_patch/providers/embeddedsubtitles.py — no changes to vendored libs/fese/*.

#Exemple:
screenshot-1783183690

Test plan

  • Added test_get_extra_release_info_mkv_tag_duration_wins_over_container_duration and test_get_extra_release_info_mkv_language_suffixed_tag_wins_over_container_duration in tests/subliminal_patch/test_embeddedsubtitles.py, plus coverage for _build_release_info() in the new tests/bazarr/test_subtitles_manual.py.
  • Ran the targeted suites locally: pytest tests/subliminal_patch/test_embeddedsubtitles.py tests/bazarr/test_subtitles_manual.py → 45 passed (2 pre-existing, unrelated failures in the same file untouched by this change).
  • Also includes an unrelated no log: commit adding ruff to dev-requirements.txt + a pyproject.toml excluding libs//custom_libs//frontend//migrations/, so ruff check . doesn't lint vendored code for other contributors.

…tracks apart

The embedded subtitles provider surfaced the same release info for every
track sharing a language, since the only distinguishing text came from
stream/container naming. When an MKV has multiple tracks in the same
language, manual search showed indistinguishable entries.

- embeddedsubtitles.py: expose an extra_release_info list on
  EmbeddedSubtitle, populated from the per-track MKV DURATION tag
  (falling back to the language-suffixed DURATION-eng tag, then the
  container duration) so tracks with different lengths show a
  "Duration: h:mm:ss" hint.
- manual.py: factor release info assembly into _build_release_info()
  and append extra_release_info so the new hint reaches the manual
  search results.
… vendored libs

pyproject.toml was untracked locally with the ruff config (excluding
libs/, custom_libs/, frontend/, migrations/); adding it so other
contributors' `ruff check .` matches the excludes described in
AGENTS.md instead of linting vendored code.
@andersonviudes andersonviudes force-pushed the feature/manual-search-embedded-duration branch from 8a7b1ca to 684437d Compare July 4, 2026 18:07
@andersonviudes andersonviudes changed the title Show subtitle track duration in manual search to disambiguate same-language tracks Added subtitle track duration to manual search to tell same-language tracks apart Jul 4, 2026
@andersonviudes andersonviudes marked this pull request as ready for review July 4, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant