aboutsummaryrefslogtreecommitdiff
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
parent81b7026e10cb4aa131e61920449cd52a54897952 (diff)
downloadjellything-ac31201ba788dbaae1606fc0ee8a1021681d2776.tar
jellything-ac31201ba788dbaae1606fc0ee8a1021681d2776.tar.bz2
jellything-ac31201ba788dbaae1606fc0ee8a1021681d2776.tar.zst
show external ids in node page
-rw-r--r--import/src/lib.rs16
-rw-r--r--locale/en.ini13
-rw-r--r--server/src/routes/ui/node.rs31
-rw-r--r--web/style/layout.css3
4 files changed, 55 insertions, 8 deletions
diff --git a/import/src/lib.rs b/import/src/lib.rs
index 4ee4a6e..452d9b9 100644
--- a/import/src/lib.rs
+++ b/import/src/lib.rs
@@ -249,11 +249,11 @@ fn import_file(
node.kind = NodeKind::Channel;
node.title = Some(clean_uploader_name(&data.title).to_owned());
if let Some(cid) = data.channel_id {
- node.external_ids.insert("youtube:channel".to_string(), cid);
+ node.external_ids.insert("youtube.channel".to_string(), cid);
}
if let Some(uid) = data.uploader_id {
node.external_ids
- .insert("youtube:channel-name".to_string(), uid);
+ .insert("youtube.channelname".to_string(), uid);
}
if let Some(desc) = data.description {
node.description = Some(desc);
@@ -373,19 +373,19 @@ fn import_media_file(
match key.as_str() {
"MUSICBRAINZ_TRACKID" => node
.external_ids
- .insert("musicbrainz:track".to_string(), value.to_owned()),
+ .insert("musicbrainz.track".to_string(), value.to_owned()),
"MUSICBRAINZ_ARTISTID" => node
.external_ids
- .insert("musicbrainz:artist".to_string(), value.to_owned()),
+ .insert("musicbrainz.artist".to_string(), value.to_owned()),
"MUSICBRAINZ_ALBUMID" => node
.external_ids
- .insert("musicbrainz:album".to_string(), value.to_owned()),
+ .insert("musicbrainz.album".to_string(), value.to_owned()),
"MUSICBRAINZ_ALBUMARTISTID" => node
.external_ids
- .insert("musicbrainz:albumarists".to_string(), value.to_owned()),
+ .insert("musicbrainz.albumartist".to_string(), value.to_owned()),
"MUSICBRAINZ_RELEASEGROUPID" => node
.external_ids
- .insert("musicbrainz:releasegroup".to_string(), value.to_owned()),
+ .insert("musicbrainz.releasegroup".to_string(), value.to_owned()),
"ISRC" => node
.external_ids
.insert("isrc".to_string(), value.to_owned()),
@@ -474,7 +474,7 @@ fn import_media_file(
match infojson.extractor.as_str() {
"youtube" => {
node.external_ids
- .insert("youtube:video".to_string(), infojson.id);
+ .insert("youtube.video".to_string(), infojson.id);
node.ratings.insert(
Rating::YoutubeViews,
infojson.view_count.unwrap_or_default() as f64,
diff --git a/locale/en.ini b/locale/en.ini
index 2e8f479..cd8e5e9 100644
--- a/locale/en.ini
+++ b/locale/en.ini
@@ -53,6 +53,7 @@ node.chapters=Chapters
node.people=Cast & Crew
node.tags=Tags
node.similar=Similar Media
+node.external_ids=External Identifiers
filter_sort=Filter and Sort
filter_sort.filter.kind=By Kind
@@ -155,3 +156,15 @@ settings.immutable=Immutable
settings.apply=Apply
settings.player_preference=Preferred Media Player
settings.player_preference.changed=Media Player preference changed.
+
+eid.isrc=ISRC
+eid.barcode=Barcode
+eid.musicbrainz.album=MusicBrainz Album ID
+eid.musicbrainz.albumartist=MusicBrainz Album Artist ID
+eid.musicbrainz.artist=MusicBrainz Artist ID
+eid.musicbrainz.releasegroup=MusicBrainz Release Group ID
+eid.musicbrainz.track=MusicBrainz Track ID
+eid.youtube.channelname=YouTube Channel Handle
+eid.youtube.channelname=YouTube Channel ID
+eid.youtube.video=YouTube Video ID
+eid.bandcamp=Bandcamp ID
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,
+ })
+}
diff --git a/web/style/layout.css b/web/style/layout.css
index a14c86e..677ee39 100644
--- a/web/style/layout.css
+++ b/web/style/layout.css
@@ -56,6 +56,9 @@ h1 {
p, span, a, td, th, label, input, legend, pre, summary, li {
color: var(--font);
}
+pre {
+ margin: 0px;
+}
code {
font-family: monospace !important;