Skip to content

Commit

Permalink
docs(stremio-core-web): Player - overriding Subtitles id
Browse files Browse the repository at this point in the history
Signed-off-by: Lachezar Lechev <[email protected]>
  • Loading branch information
elpiel committed Dec 6, 2024
1 parent 2938380 commit f51f83b
Showing 1 changed file with 4 additions and 0 deletions.
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

0 comments on commit f51f83b

Please sign in to comment.