0.1.89 upd

This commit is contained in:
Michael Wain 2025-02-22 00:25:51 +03:00
parent 0dfe85f5c1
commit 2a867778b7
2 changed files with 10 additions and 17 deletions

View File

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

View File

@ -233,14 +233,7 @@ pub mod aobjects {
self.children.iter_mut().find(|d| d.data.data_type == p0).unwrap() self.children.iter_mut().find(|d| d.data.data_type == p0).unwrap()
} }
fn get_last_cor_id(&mut self) -> u32{ pub fn add_images(&mut self, song_dbid: u64, song_unique: u32) -> (String, String) {
let files = self.find_dataset(3);
let image_files = &mut files.child;
image_files.iter().map(|p| p.file.as_ref().unwrap().correlation_id).max().unwrap_or(1027)
}
pub fn add_images(&mut self, song_dbid: u64) -> (String, String) {
let last_cor_id = self.get_last_cor_id();
let ds = self.find_dataset(1); let ds = self.find_dataset(1);
let image_items = &mut ds.child; let image_items = &mut ds.child;
let new_id = image_items.last().map_or(100, |p| p.data.as_ref().unwrap().id + 1); let new_id = image_items.last().map_or(100, |p| p.data.as_ref().unwrap().id + 1);
@ -267,7 +260,7 @@ pub mod aobjects {
AImageName { AImageName {
iname: ImageName { iname: ImageName {
number_of_children: 1, number_of_children: 1,
correlation_id: last_cor_id + 1, correlation_id: 1028,
ithmb_offset: 0, ithmb_offset: 0,
image_size: 20000, image_size: 20000,
vertical_padding: 0, vertical_padding: 0,
@ -285,7 +278,7 @@ pub mod aobjects {
unk2: 0, unk2: 0,
}, },
str: Some( str: Some(
[":F", &(last_cor_id + 1).to_string(), "_1.ithmb"].concat(), [":F", &format!("{:X}", song_unique) ,".ithmb"].concat(),
), ),
} }
), ),
@ -304,7 +297,7 @@ pub mod aobjects {
AImageName { AImageName {
iname: ImageName { iname: ImageName {
number_of_children: 1, number_of_children: 1,
correlation_id: last_cor_id + 2, correlation_id: 1029,
ithmb_offset: 0, ithmb_offset: 0,
image_size: 80000, image_size: 80000,
vertical_padding: 0, vertical_padding: 0,
@ -322,7 +315,7 @@ pub mod aobjects {
unk2: 0, unk2: 0,
}, },
str: Some( str: Some(
[":F", &(last_cor_id + 2).to_string(), "_1.ithmb"].concat(), [":F", &format!("{:X}", song_unique) ,"_1.ithmb"].concat(),
), ),
} }
), ),
@ -338,7 +331,7 @@ pub mod aobjects {
let files = self.find_dataset(3); let files = self.find_dataset(3);
let image_files = &mut files.child; let image_files = &mut files.child;
image_files.clear();
image_files.append(&mut vec![ image_files.append(&mut vec![
AImageItem { AImageItem {
tag: Vec::new(), tag: Vec::new(),
@ -346,7 +339,7 @@ pub mod aobjects {
file: Some( file: Some(
ImageFile { ImageFile {
unknown1: 0, unknown1: 0,
correlation_id: last_cor_id + 1, correlation_id: 1028,
image_size: 20000, image_size: 20000,
}, },
), ),
@ -357,14 +350,14 @@ pub mod aobjects {
file: Some( file: Some(
ImageFile { ImageFile {
unknown1: 0, unknown1: 0,
correlation_id: last_cor_id + 2, correlation_id: 1029,
image_size: 80000, image_size: 80000,
}, },
), ),
}, },
]); ]);
self.data.as_mut().unwrap().next_id_for_mhii = new_id + 1; self.data.as_mut().unwrap().next_id_for_mhii = new_id + 1;
(["F", &(last_cor_id + 1).to_string(), "_1.ithmb"].concat(), ["F", &(last_cor_id + 2).to_string(), "_1.ithmb"].concat()) (["F", &format!("{:X}", song_unique) ,".ithmb"].concat(), ["F", &format!("{:X}", song_unique) ,"_1.ithmb"].concat())
} }
} }