diff options
author | metamuffin <metamuffin@disroot.org> | 2023-12-21 09:21:02 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-12-21 09:21:02 +0100 |
commit | 9a52852f736692e5319da49478e16bfba30fbd39 (patch) | |
tree | d07feab55c6a4549b604b289833cf53a075f32c5 /server/src/routes/ui/node.rs | |
parent | cb0d830a0105cafe7a4e7f2606693826585acad9 (diff) | |
parent | a8b2480e898e269e7e0d41dbd46d9a18c7d1e4ba (diff) | |
download | jellything-9a52852f736692e5319da49478e16bfba30fbd39.tar jellything-9a52852f736692e5319da49478e16bfba30fbd39.tar.bz2 jellything-9a52852f736692e5319da49478e16bfba30fbd39.tar.zst |
Merge branch 'master' of codeberg.org:metamuffin/jellything
Diffstat (limited to 'server/src/routes/ui/node.rs')
-rw-r--r-- | server/src/routes/ui/node.rs | 9 |
1 files changed, 6 insertions, 3 deletions
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", |