From a2e557e648cf253d47e9f4b9dd99ee657610f294 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 7 Aug 2023 13:46:22 +0200 Subject: extend sort and filter --- import/src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'import/src/main.rs') 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(), ); -- cgit v1.2.3-70-g09d2