1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/*
This file is part of jellything (https://codeberg.org/metamuffin/jellything)
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2026 metamuffin <metamuffin.org>
*/
use crate::{
RenderInfo,
format::{format_count, format_duration},
};
use chrono::DateTime;
use jellycommon::{
jellyobject::{EMPTY, TypedTag},
*,
};
use jellyui_locale::tr;
markup::define! {
Props<'a>(ri: &'a RenderInfo<'a>, nku: &'a Nku<'a>, full: bool) {
.props {
@if let Some(dur) = nku.node.get(NO_DURATION) {
p { @format_duration(dur) }
}
// @if let Some(res) = nku.node.get(NO_TRACK) {
// p { @m.resolution_name() }
// }
@if let Some(d) = nku.node.get(NO_RELEASEDATE) {
p { @if *full {
@DateTime::from_timestamp_millis(d).unwrap().naive_utc().to_string()
} else {
@DateTime::from_timestamp_millis(d).unwrap().date_naive().to_string()
}}
}
@match nku.node.get(NO_VISIBILITY).unwrap_or(VISI_VISIBLE) {
VISI_REDUCED => {p.visibility{@tr(ri.lang, "prop.vis.reduced")}}
VISI_HIDDEN => {p.visibility{@tr(ri.lang, "prop.vis.hidden")}}
VISI_VISIBLE | _ => {}
}
@if nku.child_count > 0 {
p { @format!("{} items", nku.child_count) }
}
@for (kind, value) in nku.node.get(NO_RATINGS).unwrap_or(EMPTY).entries::<f64>() {
@match TypedTag::new(kind) {
RTYP_YOUTUBE_LIKES => {p.likes{ @format_count(value as usize) " Likes" }}
RTYP_YOUTUBE_VIEWS => {p{ @format_count(value as usize) " Views" }}
RTYP_YOUTUBE_SUBSCRIBERS => {p{ @format_count(value as usize) " Subscribers" }}
RTYP_ROTTEN_TOMATOES if *full => {p.rating{ "Rotten Tomatoes: " @value "%" }}
RTYP_METACRITIC if *full => {p.rating{ "Metacritic: " @value "/100" }}
RTYP_IMDB => {p.rating{ "IMDb " @value }}
RTYP_TMDB if *full => {p.rating{ "TMDB " @format!("{:.01}", value) }}
RTYP_TRAKT if *full => {p.rating{ "Trakt " @format!("{:.01}", value) }}
_ => {}
}
}
// @match nodeu.udata.watched {
// WatchedState::None => {}
// WatchedState::Pending => { p.pending { @tr(ri.lang, "prop.watched.pending") } }
// WatchedState::Progress(x) => { p.progress { @tr(ri.lang, "prop.watched.progress").replace("{time}", &format_duration(x)) } }
// WatchedState::Watched => { p.watched { @tr(ri.lang, "prop.watched.watched") } }
// }
}
}
}
|