aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2026-02-19 17:06:44 +0100
committermetamuffin <metamuffin@disroot.org>2026-02-19 17:06:44 +0100
commite409abe9a4a8b2553d1746c65631b84fdeff7d77 (patch)
treec9cc4488beaa1ef13a9ce588380d198899d94e89
parent41e8ff64585b7a3b77acd027d95e3e7f651d9e0e (diff)
downloadjellything-e409abe9a4a8b2553d1746c65631b84fdeff7d77.tar
jellything-e409abe9a4a8b2553d1746c65631b84fdeff7d77.tar.bz2
jellything-e409abe9a4a8b2553d1746c65631b84fdeff7d77.tar.zst
display credit cats seperatly
-rw-r--r--locale/en.ini25
-rw-r--r--server/src/ui/node.rs27
2 files changed, 43 insertions, 9 deletions
diff --git a/locale/en.ini b/locale/en.ini
index 9054f2e..5d30e76 100644
--- a/locale/en.ini
+++ b/locale/en.ini
@@ -51,7 +51,6 @@ node.watchlist.set=Add to Watchlist
node.watchlist.unset=Remove from Watchlist
node.update_rating=Update Rating
node.chapters=Chapters
-node.credits=Cast & Crew
node.credited=Featured
node.tags=Tags
node.similar=Similar Media
@@ -69,7 +68,26 @@ filter_sort.sort.rating.likes_div_views=Likes per view
filter_sort.order.asc=Ascending
filter_sort.order.desc=Descending
-tag.iden=Identifiers
+tag.cred.kind.arra=Arranger
+tag.cred.kind.art1=Art
+tag.cred.kind.came=Camera
+tag.cred.kind.cast=Cast
+tag.cred.kind.coma=Costume & Makeup
+tag.cred.kind.crby=Created by:
+tag.cred.kind.crew=Crew
+tag.cred.kind.dire=Directing
+tag.cred.kind.edit=Editing
+tag.cred.kind.engi=Engineer
+tag.cred.kind.inst=Instruments
+tag.cred.kind.ligh=Lighting
+tag.cred.kind.perf=Performance
+tag.cred.kind.pro2=Producer
+tag.cred.kind.prod=Production
+tag.cred.kind.sond=Sound
+tag.cred.kind.vfx1=VFX
+tag.cred.kind.voca=Vocals
+tag.cred.kind.writ=Writing
+tag.cred=Credit
tag.iden.actr=AcoustID Track
tag.iden.barc=Barcode
tag.iden.bcmp=Bandcamp
@@ -91,7 +109,7 @@ tag.iden.wkdt=Wikidata
tag.iden.ytc1=YouTube Channel
tag.iden.ytch=YouTube Channel Handle
tag.iden.ytvi=YouTube Video
-tag.kind=Kind
+tag.iden=Identifiers
tag.kind.chnl=Channel
tag.kind.coll=Collection
tag.kind.epsd=Episode
@@ -103,6 +121,7 @@ tag.kind.sfvi=Short Form Video
tag.kind.show=Show
tag.kind.unkn=Unknown
tag.kind.vide=Video
+tag.kind=Kind
theme.dark=Dark
theme.light=Light
diff --git a/server/src/ui/node.rs b/server/src/ui/node.rs
index 87b8446..14c90c1 100644
--- a/server/src/ui/node.rs
+++ b/server/src/ui/node.rs
@@ -3,6 +3,7 @@
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2026 metamuffin <metamuffin.org>
*/
+
use super::error::MyResult;
use crate::{request_info::RequestInfo, ui_responder::UiResponse};
use anyhow::Result;
@@ -12,6 +13,7 @@ use jellycommon::{
};
use jellydb::{Filter, MultiBehaviour, Query, Sort, SortOrder, Transaction, ValueSort};
use rocket::get;
+use std::collections::BTreeMap;
#[get("/n/<slug>")]
pub fn r_node(ri: RequestInfo<'_>, slug: &str) -> MyResult<UiResponse> {
@@ -113,14 +115,11 @@ fn c_credits(
txn: &mut dyn Transaction,
nku: &Object,
) -> Result<()> {
- let mut list = ObjectBufferBuilder::default();
- list.push(NODELIST_DISPLAYSTYLE, NLSTYLE_INLINE);
- list.push(NODELIST_TITLE, "node.credits");
-
if !nku.get(NKU_NODE).unwrap_or_default().has(NO_CREDIT.0) {
return Ok(());
}
+ let mut cats = BTreeMap::<_, Vec<_>>::new();
for cred in nku.get(NKU_NODE).unwrap_or_default().iter(NO_CREDIT) {
let mut o = ObjectBuffer::empty();
if let Some(row) = cred.get(CR_NODE) {
@@ -130,10 +129,26 @@ fn c_credits(
if let Some(role) = cred.get(CR_ROLE) {
o = o.as_object().insert(NKU_ROLE, role)
}
- list.push(NODELIST_ITEM, o.as_object());
+ cats.entry(cred.get(CR_KIND).unwrap_or(CRCAT_CREW))
+ .or_default()
+ .push(o);
+ }
+ let mut cats = cats.into_iter().collect::<Vec<_>>();
+ cats.sort_by_key(|(c, _)| match *c {
+ CRCAT_CAST => 0,
+ CRCAT_CREW => 1,
+ _ => 100,
+ });
+ for (cat, elems) in cats {
+ let mut list = ObjectBufferBuilder::default();
+ list.push(NODELIST_DISPLAYSTYLE, NLSTYLE_INLINE);
+ list.push(NODELIST_TITLE, &format!("tag.cred.kind.{cat}"));
+ for item in elems {
+ list.push(NODELIST_ITEM, item.as_object());
+ }
+ page.push(VIEW_NODE_LIST, list.finish().as_object());
}
- page.push(VIEW_NODE_LIST, list.finish().as_object());
Ok(())
}