diff --git a/Cargo.toml b/Cargo.toml index 5460516..4778714 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "itunesdb" -version = "0.1.92" +version = "0.1.93" edition = "2021" authors = ["alterwain"] diff --git a/src/xobjects.rs b/src/xobjects.rs index d136be7..be29506 100644 --- a/src/xobjects.rs +++ b/src/xobjects.rs @@ -207,7 +207,7 @@ fn rebuild_quick_sort(playlist: &mut XPlaylist) { })); args.push(XPlArgument::RawArgument(vec![109,104,111,100,24,0,0,0,136,2,0,0,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])); - + playlist.data.string_mhod_count = 1; playlist.data.data_object_child_count = args.len() as u32; playlist.args = args; @@ -231,15 +231,6 @@ impl XDatabase { 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) { @@ -252,16 +243,6 @@ impl XDatabase { 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 { @@ -272,14 +253,14 @@ impl XDatabase { } res_pls } - + pub fn if_track_in_library(&mut self, dbid: u64) -> bool { if let XSomeList::TrackList(tracks) = &mut self.find_dataset(1).child { return tracks.iter().any(|t| t.data.dbid == dbid); } false } - + pub fn get_unique_id_by_dbid(&mut self, dbid: u64) -> Option { if let XSomeList::TrackList(tracks) = &mut self.find_dataset(1).child { return Some(tracks.iter().find(|t| t.data.dbid == dbid)?.data.unique_id); @@ -365,19 +346,11 @@ impl XDatabase { if let XSomeList::Playlists(playlists) = &mut self.find_dataset(2).child { 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) { if let XSomeList::Playlists(playlists) = &mut self.find_dataset(2).child { 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); - } } } \ No newline at end of file