0.1.15 upd

This commit is contained in:
Michael Wain 2025-02-15 02:42:36 +03:00
parent 95b7c0cc54
commit 8d388d1b0c
3 changed files with 7 additions and 10 deletions

2
Cargo.lock generated
View File

@ -90,7 +90,7 @@ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
[[package]] [[package]]
name = "itunesdb" name = "itunesdb"
version = "0.1.13" version = "0.1.15"
dependencies = [ dependencies = [
"bincode", "bincode",
"env_logger", "env_logger",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "itunesdb" name = "itunesdb"
version = "0.1.14" version = "0.1.15"
edition = "2021" edition = "2021"
authors = ["alterwain"] authors = ["alterwain"]

View File

@ -93,13 +93,13 @@ impl XPlaylist {
} }
fn update_arg(&mut self, id: u32, val: String) { fn update_arg(&mut self, id: u32, val: String) {
self.args.retain_mut(|t| { self.args.retain(|t| {
if let XPlArgument::String(s) = t { if let XPlArgument::String(s) = t {
if s.arg_type == id { if s.arg_type == id {
return true; return false;
} }
} }
false true
}); });
self.args.push(XPlArgument::String(XArgument { arg_type: id, val })); self.args.push(XPlArgument::String(XArgument { arg_type: id, val }));
} }
@ -156,14 +156,11 @@ impl XTrackItem {
} }
fn get_arg(&self, id: u32) -> String { fn get_arg(&self, id: u32) -> String {
for t in self.args.iter() { self.args.iter().find(|t| t.arg_type == id).map_or(String::new(), |t| t.val.clone())
println!("{} -> {}", t.arg_type, t.val);
}
self.args.iter().find(|t| t.arg_type == id).map_or("none".to_string(), |t| t.val.clone())
} }
fn update_arg(&mut self, id: u32, val: String) { fn update_arg(&mut self, id: u32, val: String) {
self.args.retain(|t| t.arg_type == id); self.args.retain(|t| t.arg_type != id);
self.args.push(XArgument { arg_type: id, val}); self.args.push(XArgument { arg_type: id, val});
} }
} }