diff options
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/routes/progress.rs | 5 | ||||
-rw-r--r-- | server/src/routes/ui/node.rs | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/server/src/routes/progress.rs b/server/src/routes/progress.rs index 0ba5b31..c4eb182 100644 --- a/server/src/routes/progress.rs +++ b/server/src/routes/progress.rs @@ -1,3 +1,8 @@ +/* + 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) 2023 metamuffin <metamuffin.org> +*/ use super::ui::{account::session::Session, error::MyResult}; use crate::routes::ui::node::rocket_uri_macro_r_library_node; use anyhow::anyhow; diff --git a/server/src/routes/ui/node.rs b/server/src/routes/ui/node.rs index fbbf012..6e2f532 100644 --- a/server/src/routes/ui/node.rs +++ b/server/src/routes/ui/node.rs @@ -215,6 +215,7 @@ pub fn format_duration(mut d: f64) -> String { let mut s = String::new(); for (unit, k) in [("h", 60. * 60.), ("m", 60.), ("s", 1.)] { let mut h = 0; + // TODO dont iterate like that. can be a simple rem and div while d > k { d -= k; h += 1; @@ -257,15 +258,17 @@ trait MediaInfoExt { } impl MediaInfoExt for MediaInfo { fn resolution_name(&self) -> &'static str { - let mut maxw = 0; + let mut maxdim = 0; for t in &self.tracks { match &t.kind { - SourceTrackKind::Video { width, .. } => maxw = maxw.max(*width), + SourceTrackKind::Video { width, height, .. } => maxdim = maxdim.max(*width.max(height)), _ => (), } } - match maxw { + match maxdim { + 30720.. => "32K", + 15360.. => "16K", 7680.. => "8K", 3840.. => "4K", 2560.. => "WQHD", |