Show series name in video player titlebar for episodes
This commit is contained in:
@@ -3,10 +3,25 @@ use jellyfin_api::types::BaseItemDto;
|
||||
use crate::tr;
|
||||
|
||||
pub trait ItemName {
|
||||
fn series_and_episode(&self) -> Option<String>;
|
||||
fn episode_name_with_number(&self) -> Option<String>;
|
||||
}
|
||||
|
||||
impl ItemName for BaseItemDto {
|
||||
fn series_and_episode(&self) -> Option<String> {
|
||||
match (&self.series_name, self.episode_name_with_number()) {
|
||||
(Some(series_name), Some(episode_name)) => Some(
|
||||
tr!("library-series-and-episode-name", {
|
||||
"seriesName" => series_name.to_string(),
|
||||
"episodeName" => episode_name,
|
||||
})
|
||||
.to_string(),
|
||||
),
|
||||
(_, Some(episode_name)) => Some(episode_name),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn episode_name_with_number(&self) -> Option<String> {
|
||||
let name = match &self.name {
|
||||
Some(name) => name,
|
||||
|
@@ -115,7 +115,7 @@ impl Component for VideoPlayer {
|
||||
#[watch]
|
||||
set_title: &model.media.as_ref()
|
||||
.and_then(|media| media
|
||||
.episode_name_with_number()
|
||||
.series_and_episode()
|
||||
.or(media.name.clone()))
|
||||
.unwrap_or(tr!("app-name").to_string()),
|
||||
|
||||
|
@@ -14,6 +14,7 @@ library-section-title =
|
||||
.latest-music = Latest Music
|
||||
|
||||
library-episode-name-with-season-and-episode = S{$seasonNumber}:E{$episodeNumber} - {$episodeName}
|
||||
library-series-and-episode-name = {$seriesName} - {$episodeName}
|
||||
|
||||
library-media-tile-unnamed-item = Unnamed Item
|
||||
|
||||
|
Reference in New Issue
Block a user