aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-04-23 12:34:06 +0200
committermetamuffin <metamuffin@disroot.org>2025-04-23 12:34:06 +0200
commitac31201ba788dbaae1606fc0ee8a1021681d2776 (patch)
treef7c8efbeb3e335d70115d65bc81ca6da1978540b /server
parent81b7026e10cb4aa131e61920449cd52a54897952 (diff)
downloadjellything-ac31201ba788dbaae1606fc0ee8a1021681d2776.tar
jellything-ac31201ba788dbaae1606fc0ee8a1021681d2776.tar.bz2
jellything-ac31201ba788dbaae1606fc0ee8a1021681d2776.tar.zst
show external ids in node page
Diffstat (limited to 'server')
-rw-r--r--server/src/routes/ui/node.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/server/src/routes/ui/node.rs b/server/src/routes/ui/node.rs
index 6a8d8be..8d06f36 100644
--- a/server/src/routes/ui/node.rs
+++ b/server/src/routes/ui/node.rs
@@ -299,6 +299,23 @@ markup::define! {
}}
}
}
+ @if !node.external_ids.is_empty() {
+ details {
+ summary { @trs(lang, "node.external_ids") }
+ table {
+ @for (key, value) in &node.external_ids { tr {
+ tr {
+ td { @trs(lang, &format!("eid.{}", key)) }
+ @if let Some(url) = external_id_url(key, value) {
+ td { a[href=url] { pre { @value } } }
+ } else {
+ td { pre { @value } }
+ }
+ }
+ }}
+ }
+ }
+ }
@if !node.tags.is_empty() {
details {
summary { @trs(lang, "node.tags") }
@@ -525,3 +542,17 @@ fn chapter_key_time(c: &Chapter, dur: f64) -> f64 {
let end = c.time_end.unwrap_or(dur);
start * 0.8 + end * 0.2
}
+
+fn external_id_url(key: &str, value: &str) -> Option<String> {
+ Some(match key {
+ "youtube.video" => format!("https://youtube.com/watch?v={value}"),
+ "youtube.channel" => format!("https://youtube.com/channel/{value}"),
+ "youtube.channelname" => format!("https://youtube.com/channel/@{value}"),
+ "musicbrainz.album" => format!("https://musicbrainz.org/release/{value}"),
+ "musicbrainz.albumartist" => format!("https://musicbrainz.org/artist/{value}"),
+ "musicbrainz.artist" => format!("https://musicbrainz.org/artist/{value}"),
+ "musicbrainz.releasegroup" => format!("https://musicbrainz.org/releasegroup/{value}"),
+ "musicbrainz.track" => format!("https://musicbrainz.org/recording/{value}"),
+ _ => return None,
+ })
+}