0.1.67 upd
This commit is contained in:
parent
4d44f8b3e5
commit
9a6dfa7ae6
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "itunesdb"
|
name = "itunesdb"
|
||||||
version = "0.1.66"
|
version = "0.1.67"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["alterwain"]
|
authors = ["alterwain"]
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
|
||||||
use crate::objects::{AlbumItem, ChunkHeader, DataSet, Database, JumpTable, LetterJumpEntry, ListSortOrder, Playlist, PlaylistIndexEntry, PlaylistItem, TrackItem};
|
use crate::objects::{AlbumItem, ChunkHeader, DataSet, Database, JumpTable, LetterJumpEntry, ListSortOrder, Playlist, PlaylistIndexEntry, PlaylistItem, TrackItem};
|
||||||
use crate::xobjects::XPlArgument::RawArgument;
|
|
||||||
|
|
||||||
#[derive(Debug, serde::Serialize)]
|
#[derive(Debug, serde::Serialize)]
|
||||||
pub struct XDatabase {
|
pub struct XDatabase {
|
||||||
@ -183,6 +182,37 @@ impl XTrackItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_ipods_name(args: Vec<XPlArgument> ) -> String {
|
||||||
|
let mut s = String::from("iPod");
|
||||||
|
for arg in args {
|
||||||
|
if let XPlArgument::String(a) = arg {
|
||||||
|
if a.arg_type == 1 {
|
||||||
|
s = a.val;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rebuild_quick_sort(playlist: &mut XPlaylist) {
|
||||||
|
//playlist.data.data_object_child_count all 52/53 args + raw args + str args
|
||||||
|
//playlist.data.string_mhod_count only str args count (1)
|
||||||
|
let ipod_name = get_ipods_name(playlist.args.clone());
|
||||||
|
|
||||||
|
let mut args = Vec::new();
|
||||||
|
args.push(XPlArgument::String(XArgument {
|
||||||
|
arg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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]));
|
||||||
|
|
||||||
|
playlist.data.string_mhod_count = 1;
|
||||||
|
playlist.data.data_object_child_count = args.len() as u32;
|
||||||
|
playlist.args = args;
|
||||||
|
}
|
||||||
|
|
||||||
impl XDatabase {
|
impl XDatabase {
|
||||||
pub fn find_dataset(&mut self, data_type: u32) -> &mut XDataSet {
|
pub fn find_dataset(&mut self, data_type: u32) -> &mut XDataSet {
|
||||||
self.children.iter_mut().find(|d| d.data.data_type == data_type).unwrap()
|
self.children.iter_mut().find(|d| d.data.data_type == data_type).unwrap()
|
||||||
@ -254,7 +284,7 @@ impl XDatabase {
|
|||||||
return n + 1;
|
return n + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let XSomeList::Playlists(playlists) = &mut self.find_dataset(2).child {
|
/*if let XSomeList::Playlists(playlists) = &mut self.find_dataset(2).child {
|
||||||
for playlist in playlists {
|
for playlist in playlists {
|
||||||
if playlist.data.is_master_playlist_flag != 0 {
|
if playlist.data.is_master_playlist_flag != 0 {
|
||||||
let a = playlist.args.iter().filter(|s| matches!(s, RawArgument(b))).last().unwrap();
|
let a = playlist.args.iter().filter(|s| matches!(s, RawArgument(b))).last().unwrap();
|
||||||
@ -263,8 +293,8 @@ impl XDatabase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
1
|
102
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_track(&mut self, id: u32) -> Option<XTrackItem> {
|
pub fn get_track(&mut self, id: u32) -> Option<XTrackItem> {
|
||||||
@ -311,6 +341,7 @@ impl XDatabase {
|
|||||||
let raw: Vec<u8> = vec![ 109,104,111,100,24,0,0,0,44,0,0,0,100,0,0,0,0,0,0,0,0,0,0,0,gr[0],gr[1],gr[2],gr[3],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ];
|
let raw: Vec<u8> = vec![ 109,104,111,100,24,0,0,0,44,0,0,0,100,0,0,0,0,0,0,0,0,0,0,0,gr[0],gr[1],gr[2],gr[3],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ];
|
||||||
pl_item.data_object_child_count = 1;
|
pl_item.data_object_child_count = 1;
|
||||||
playlist.elems.push((pl_item, vec![RawArgument(raw)]));
|
playlist.elems.push((pl_item, vec![RawArgument(raw)]));
|
||||||
|
rebuild_quick_sort(playlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if let XSomeList::Playlists(playlists) = &mut self.find_dataset(n).child {
|
/*if let XSomeList::Playlists(playlists) = &mut self.find_dataset(n).child {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user