0.1.93 upd

This commit is contained in:
Michael Wain 2025-02-23 04:54:16 +03:00
parent db366cfba3
commit f0cbffe692
2 changed files with 4 additions and 31 deletions

View File

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

View File

@ -231,15 +231,6 @@ impl XDatabase {
playlist.data.playlist_item_count -= (s as u32); playlist.data.playlist_item_count -= (s as u32);
} }
} }
if let XSomeList::Playlists(playlists) = &mut self.find_dataset(3).child {
for playlist in playlists.iter_mut() {
let mut s = playlist.elems.len();
playlist.elems.retain_mut(|t| t.0.track_id != unique_id);
s -= playlist.elems.len();
playlist.data.playlist_item_count -= (s as u32);
}
}
} }
pub fn remove_track(&mut self, unique_id: u32, playlist_id: u64) { pub fn remove_track(&mut self, unique_id: u32, playlist_id: u64) {
@ -252,16 +243,6 @@ impl XDatabase {
playlist.data.playlist_item_count -= (s as u32); playlist.data.playlist_item_count -= (s as u32);
} }
} }
if let XSomeList::Playlists(playlists) = &mut self.find_dataset(3).child {
for playlist in playlists.iter_mut() {
if playlist.data.persistent_playlist_id != playlist_id { continue }
let mut s = playlist.elems.len();
playlist.elems.retain_mut(|t| t.0.track_id != unique_id);
s -= playlist.elems.len();
playlist.data.playlist_item_count -= (s as u32);
}
}
} }
pub fn get_playlists(&mut self) -> Vec<XPlaylist> { pub fn get_playlists(&mut self) -> Vec<XPlaylist> {
@ -365,19 +346,11 @@ impl XDatabase {
if let XSomeList::Playlists(playlists) = &mut self.find_dataset(2).child { if let XSomeList::Playlists(playlists) = &mut self.find_dataset(2).child {
playlists.push(playlist.clone()); playlists.push(playlist.clone());
} }
if let XSomeList::Playlists(playlists) = &mut self.find_dataset(3).child {
playlists.push(playlist);
}
} }
pub fn remove_playlist(&mut self, pl_id: u64) { pub fn remove_playlist(&mut self, pl_id: u64) {
if let XSomeList::Playlists(playlists) = &mut self.find_dataset(2).child { if let XSomeList::Playlists(playlists) = &mut self.find_dataset(2).child {
playlists.retain_mut(|p| p.data.persistent_playlist_id != pl_id); playlists.retain_mut(|p| p.data.persistent_playlist_id != pl_id);
} }
if let XSomeList::Playlists(playlists) = &mut self.find_dataset(3).child {
playlists.retain_mut(|p| p.data.persistent_playlist_id != pl_id);
}
} }
} }