Skip to content

Pre-clean stl_subtitle metadata before sidecar imports; import corrected subs as real language shapes - #505

Open
KillerX wants to merge 1 commit into
masterfrom
fix/stl-subtitle-sidecar-import
Open

Pre-clean stl_subtitle metadata before sidecar imports; import corrected subs as real language shapes#505
KillerX wants to merge 1 commit into
masterfrom
fix/stl-subtitle-sidecar-import

Conversation

@KillerX

@KillerX KillerX commented Aug 25, 2026

Copy link
Copy Markdown
Member

Problem

  1. Vidispine sidecar subtitle imports fail with "ambiguous path to group: stl_subtitle". Vidispine writes parsed cues into the stl_subtitle metadata group during sidecar import, and the group name resolves to more than one path when the item already carries multiple/stale instances from earlier imports.
  2. Corrected subtitles (submitted by the external correction tool via ImportSubtitles) landed only as shape Transcribed_Subtitle_SRT, which exports treat as the AI-generated und fallback gated behind SubsAllowAI — instead of as real Norwegian subtitles.

Changes

Pre-clean before sidecar import

  • New vsapi client methods GetMetadataGroupInstances / DeleteMetadataGroupInstances: list every occurrence of a named metadata group across the item's timespans (nested groups included) and remove them via PUT /item/{id}/metadata with <group uuid="..." mode="remove"/> — addressed by uuid, since addressing by name is exactly what Vidispine rejects as ambiguous.
  • New DeleteMetadataGroupInstancesActivity (auto-registered via the worker's reflection loop) and constant vscommon.GroupStlSubtitle.
  • The pre-clean runs before the sidecar import in ImportSubtitles, ImportSidecarSubtitle (TranscribeVX's detached child), and ImportSubtitlesFromSubtrans — in the last one once before the multi-language loop, so one language's import doesn't wipe the previous one's cues.

Corrected subs as real language shapes

  • ImportSubtitles parses input.Language up front (accepts no or nor) and imports the corrected SRT as a third shape sub_<iso>_srt (sub_nor_srt for Norwegian), alongside the existing Transcribed_Subtitle_SRT / transcription_json shapes other consumers rely on. Exports key real subtitles off sub_<iso>_srt, so corrected subs surface as genuine nor subs without SubsAllowAI.

Fail loudly

  • ImportSubtitles now waits for the sidecar Vidispine job to complete.
  • import_subs.go no longer discards job-wait results with _ =; a failed shape or sidecar job fails the workflow with the language in the error.

Tests

  • Unit tests for the removal XML template and the metadata JSON parsing (both MetadataListDocument and bare-document envelopes, nested groups).
  • ImportSubtitles suite: asserts all three shape tags and the pre-clean; new sidecar-job-failure path.
  • New ImportSubtitlesFromSubtrans suite: cleanup runs exactly once across two languages; a failing sidecar job fails the workflow.

Staging verification

The exact JSON envelope of GET /item/{id}/metadata?group=... should be confirmed against a real item — the parser accepts both shapes, but check the first run's DeletedInstances matches expectations, then confirm a previously failing VXID imports cleanly and a VOD export yields nor subs without SubsAllowAI.

🤖 Generated with Claude Code

…ted subs as real language shapes

Vidispine sidecar subtitle imports fail with "ambiguous path to group:
stl_subtitle" when the item already carries stale instances of the group
from earlier imports. Remove them first, addressed by group uuid per
timespan, since addressing by name hits the same ambiguity.

Corrected subtitles submitted through ImportSubtitles previously landed
only as Transcribed_Subtitle_SRT, which exports treat as the AI "und"
fallback gated behind SubsAllowAI. Import them additionally as
sub_<iso>_srt (sub_nor_srt for "no") so exports pick them up as genuine
subtitles for that language.

Sidecar and shape import jobs are now awaited instead of having their
results discarded, so a failed Vidispine job fails the workflow.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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