From c80ccf66cea346b697b62cde5b0cc7f237c35539 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 13 Feb 2023 21:25:53 +0100 Subject: [PATCH 1/2] fix: fully extend album playlists for replacement --- src/client/music_playlist.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/music_playlist.rs b/src/client/music_playlist.rs index 664a122..016b023 100644 --- a/src/client/music_playlist.rs +++ b/src/client/music_playlist.rs @@ -88,7 +88,11 @@ impl RustyPipeQuery { .collect::>(); if !to_replace.is_empty() { - let playlist = self.music_playlist(playlist_id).await?; + let mut playlist = self.music_playlist(playlist_id).await?; + playlist + .tracks + .extend_limit(&self, album.tracks.len()) + .await?; for (i, title) in to_replace { let found_track = playlist.tracks.items.iter().find_map(|track| { From 2a4233e5d529c527ab7db0e6da23eb28b08a534f Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Sat, 18 Feb 2023 20:42:00 +0100 Subject: [PATCH 2/2] fix: use regex crate in codegen --- codegen/Cargo.toml | 2 +- codegen/src/collect_large_numbers.rs | 3 +-- codegen/src/gen_dictionary.rs | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index f935a03..c1e41c8 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -17,7 +17,7 @@ env_logger = "0.10.0" clap = { version = "4.0.29", features = ["derive"] } phf_codegen = "0.11.1" once_cell = "1.12.0" -fancy-regex = "0.10.0" +regex = "1.7.1" indicatif = "0.17.0" num_enum = "0.5.7" path_macro = "1.0.0" diff --git a/codegen/src/collect_large_numbers.rs b/codegen/src/collect_large_numbers.rs index 98d1479..8e90f2a 100644 --- a/codegen/src/collect_large_numbers.rs +++ b/codegen/src/collect_large_numbers.rs @@ -2,10 +2,10 @@ use std::collections::{HashMap, HashSet}; use std::{collections::BTreeMap, fs::File, io::BufReader, path::Path}; use anyhow::{Context, Result}; -use fancy_regex::Regex; use futures::{stream, StreamExt}; use once_cell::sync::Lazy; use path_macro::path; +use regex::Regex; use reqwest::{header, Client}; use rustypipe::param::{locale::LANGUAGES, Language}; use serde::Deserialize; @@ -139,7 +139,6 @@ pub fn write_samples_to_dict(project_root: &Path) { .find_map(|(mag, (txt, _))| { let point = POINT_REGEX .captures(txt) - .unwrap() .map(|c| c.get(1).unwrap().as_str()); if let Some(point) = point { diff --git a/codegen/src/gen_dictionary.rs b/codegen/src/gen_dictionary.rs index 70bbca6..a932011 100644 --- a/codegen/src/gen_dictionary.rs +++ b/codegen/src/gen_dictionary.rs @@ -1,8 +1,8 @@ use std::fmt::Write; use std::path::Path; -use fancy_regex::Regex; use once_cell::sync::Lazy; +use regex::Regex; use rustypipe::timeago::TimeUnit; use crate::util; @@ -11,7 +11,7 @@ const TARGET_PATH: &str = "src/util/dictionary.rs"; fn parse_tu(tu: &str) -> (u8, Option) { static TU_PATTERN: Lazy = Lazy::new(|| Regex::new(r"^(\d*)(\w?)$").unwrap()); - match TU_PATTERN.captures(tu).unwrap() { + match TU_PATTERN.captures(tu) { Some(cap) => ( cap.get(1).unwrap().as_str().parse().unwrap_or(1), match cap.get(2).unwrap().as_str() {