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) 2025 metamuffin <metamuffin.org>
*/
use crate::{
format::format_duration,
locale::{Language, trs},
};
use jellycommon::{
Node, Rating, Visibility,
chrono::DateTime,
user::{NodeUserData, WatchedState},
};
markup::define! {
Props<'a>(node: &'a Node, udata: &'a NodeUserData, full: bool, lang: &'a Language) {
.props {
@if let Some(m) = &node.media {
p { @format_duration(m.duration) }
p { @m.resolution_name() }
}
@if let Some(d) = &node.release_date {
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 node.visibility {
Visibility::Visible => {}
Visibility::Reduced => {p.visibility{@trs(lang, "prop.vis.reduced")}}
Visibility::Hidden => {p.visibility{@trs(lang, "prop.vis.hidden")}}
}
// TODO
// @if !node.children.is_empty() {
// p { @format!("{} items", node.children.len()) }
// }
@for (kind, value) in &node.ratings {
@match kind {
Rating::YoutubeLikes => {p.likes{ @format_count(*value as usize) " Likes" }}
Rating::YoutubeViews => {p{ @format_count(*value as usize) " Views" }}
Rating::YoutubeFollowers => {p{ @format_count(*value as usize) " Subscribers" }}
Rating::RottenTomatoes => {p.rating{ @value " Tomatoes" }}
Rating::Metacritic if *full => {p{ "Metacritic Score: " @value }}
Rating::Imdb => {p.rating{ "IMDb " @value }}
Rating::Tmdb => {p.rating{ "TMDB " @value }}
Rating::Trakt if *full => {p.rating{ "Trakt " @value }}
_ => {}
}
}
@if let Some(f) = &node.federated {
p.federation { @f }
}
@match udata.watched {
WatchedState::None => {}
WatchedState::Pending => { p.pending { @trs(lang, "prop.watched.pending") } }
WatchedState::Progress(x) => { p.progress { @tr(**lang, "prop.watched.progress").replace("{time}", &format_duration(x)) } }
WatchedState::Watched => { p.watched { @trs(lang, "prop.watched.watched") } }
}
}
}
}
|