diff options
author | metamuffin <metamuffin@disroot.org> | 2023-08-07 13:46:22 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-08-07 13:46:22 +0200 |
commit | a2e557e648cf253d47e9f4b9dd99ee657610f294 (patch) | |
tree | 350fe5868c9f7d890c79b2489b307c263ed7c307 /import/src | |
parent | 908db5458b07d7a13f24c755d340ab3c1917e8a8 (diff) | |
download | jellything-a2e557e648cf253d47e9f4b9dd99ee657610f294.tar jellything-a2e557e648cf253d47e9f4b9dd99ee657610f294.tar.bz2 jellything-a2e557e648cf253d47e9f4b9dd99ee657610f294.tar.zst |
extend sort and filter
Diffstat (limited to 'import/src')
-rw-r--r-- | import/src/main.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/import/src/main.rs b/import/src/main.rs index 26899bb..5d5e715 100644 --- a/import/src/main.rs +++ b/import/src/main.rs @@ -21,6 +21,7 @@ use jellyremuxer::import::{import_metadata, seek_index}; use log::{info, warn}; use rand::random; use std::{ + collections::BTreeMap, fs::{remove_file, File}, io::{stdin, Write}, path::PathBuf, @@ -306,17 +307,17 @@ fn main() -> anyhow::Result<()> { .flatten(); } - let mut ratings = Vec::new(); + let mut ratings = BTreeMap::new(); ratings.extend( infojson .as_ref() - .map(|i| Rating::YoutubeViews(i.view_count)), + .map(|i| (Rating::YoutubeViews, i.view_count as f64)), ); ratings.extend( infojson .as_ref() - .map(|i| i.like_count.map(Rating::YoutubeLikes)) + .map(|i| i.like_count.map(|l| (Rating::YoutubeLikes, l as f64))) .flatten(), ); |