Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(stremio-core-web): Player - overriding Subtitles id #749

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions stremio-core-web/src/model/serialize_player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ mod model {
pub struct Subtitles<'a> {
#[serde(flatten)]
pub subtitles: &'a stremio_core::types::resource::Subtitles,
// overrides the id of the subtitles in a format that avoids
// conflicts with other subtitle ids
pub id: String,
pub origin: &'a String,
}

#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct LibraryItemState<'a> {
Expand Down Expand Up @@ -206,6 +209,7 @@ pub fn serialize_player<E: stremio_core::runtime::Env + 'static>(
subtitles
.iter()
.enumerate()
// renames the subtitle id to avoid conflicts
.map(move |(position, subtitles)| model::Subtitles {
subtitles,
id: format!("{}_{}", addon.transport_url, position),
Expand Down
Loading