Skip to content

Subtitle label field not mapped in protobuf bridge #109

@schobiDotDev

Description

@schobiDotDev

Bug

stremio-core#947 (released in v0.55.0) added a label: Option<String> field to the Subtitles struct, allowing addons to provide custom display names for subtitle tracks. However, the protobuf bridge in this repo does not map this field, so Android/Android TV apps never receive it.

Current behavior

The protobuf Subtitle message only has 4 fields (subtitle.proto):

message Subtitle {
  required string id = 1;
  required string lang = 2;
  required string url = 3;
  optional string name = 4;
}

The name field is set to the addon name in the bridge (subtitle.rs):

impl ToProtobuf<types::Subtitle, Option<&String>> for Subtitles {
    fn to_protobuf<E: stremio_core::runtime::Env + 'static>(
        &self,
        addon_name: &Option<&String>,
    ) -> types::Subtitle {
        types::Subtitle {
            id: self.id.clone(),
            lang: self.lang.to_string(),
            url: self.url.to_string(),
            name: addon_name.cloned(), // addon manifest name, NOT subtitle label
        }
    }
}

Impact

Subtitle addons that serve multiple tracks per language cannot provide distinguishable names on Android. Users see either:

  • "Unknown (und)" when addons use custom text in lang (because java.util.Locale can't parse it)
  • The same language name repeated when addons use ISO codes in lang (e.g., all tracks show "Korean")

With label support, addons could send:

  • lang: "deu" (valid ISO code -> Android shows "Deutsch")
  • label: "MultiSub: DE+KO" (custom name for the subtitle picker)

Suggested changes

  1. Update stremio-core dependency to pick up the label field from v0.55.0 (current pin is at 9a827fdd, 12 commits before the label addition)

  2. Add label to the protobuf definition (subtitle.proto):

message Subtitle {
  required string id = 1;
  required string lang = 2;
  required string url = 3;
  optional string name = 4;   // addon name (keep as-is)
  optional string label = 5;  // addon-provided subtitle display name (new)
}
  1. Map the field in the bridge (subtitle.rs):
types::Subtitle {
    id: self.id.clone(),
    lang: self.lang.to_string(),
    url: self.url.to_string(),
    name: addon_name.cloned(),
    label: self.label.clone(),  // new: pass through addon-provided label
}

This is additive and backward compatible - name keeps its current meaning (addon name), and label is a new optional field.

Related

Note for the Android app

Once the protobuf bridge passes label through, the Android app's subtitle picker UI would need to prefer label over the resolved lang name when displaying variant names. Since the Android app is closed source, this would need to be handled by the Stremio team.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions