diff options
author | metamuffin <metamuffin@disroot.org> | 2023-12-17 20:58:10 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-12-17 20:58:10 +0100 |
commit | 2a26a6030e25127a3967dd5bccba1fb05d485ab1 (patch) | |
tree | db2ecba63bde78804277ec66915dc3b4512a4991 /server/src/routes/ui/node.rs | |
parent | e7155ec05458ed00035ce8bc5c087306cfeedbc1 (diff) | |
download | jellything-2a26a6030e25127a3967dd5bccba1fb05d485ab1.tar jellything-2a26a6030e25127a3967dd5bccba1fb05d485ab1.tar.bz2 jellything-2a26a6030e25127a3967dd5bccba1fb05d485ab1.tar.zst |
chapters
Diffstat (limited to 'server/src/routes/ui/node.rs')
-rw-r--r-- | server/src/routes/ui/node.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/server/src/routes/ui/node.rs b/server/src/routes/ui/node.rs index 6ce82c2..fbbf012 100644 --- a/server/src/routes/ui/node.rs +++ b/server/src/routes/ui/node.rs @@ -26,7 +26,7 @@ use anyhow::{anyhow, Context, Result}; use jellybase::permission::NodePermissionExt; use jellycommon::{ user::{NodeUserData, WatchedState}, - MediaInfo, NodeKind, NodePublic, Rating, SourceTrackKind, + Chapter, MediaInfo, NodeKind, NodePublic, Rating, SourceTrackKind, }; use rocket::{get, serde::json::Json, Either, State}; @@ -142,6 +142,14 @@ markup::define! { li { @format!("{track}") } }} } + @if !media.chapters.is_empty() { + details { + summary { "Chapters" } + ol { @for chap in &media.chapters { + li { @format_chapter(chap) } + }} + } + } } } @if matches!(node.kind, NodeKind::Collection | NodeKind::Channel) { @@ -280,3 +288,12 @@ fn format_count(n: impl Into<usize>) -> String { format!("{n}") } } + +fn format_chapter(c: &Chapter) -> String { + format!( + "{}-{}: {}", + c.time_start.map(format_duration).unwrap_or_default(), + c.time_end.map(format_duration).unwrap_or_default(), + c.labels.first().map(|l| l.1.clone()).unwrap_or_default() + ) +} |