0.1.72 upd

This commit is contained in:
Michael Wain 2025-02-21 05:34:50 +03:00
parent fc0366f833
commit 636fef07a4
2 changed files with 13 additions and 6 deletions

View File

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

View File

@ -232,7 +232,14 @@ 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{
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(1028)
}
pub fn add_images(&mut self, small_image_path: &str, large_image_path: &str, song_dbid: u64) { pub fn add_images(&mut self, small_image_path: &str, large_image_path: &str, song_dbid: u64) {
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 image_item = crate::artworkdb::objects::ImageItem { let image_item = crate::artworkdb::objects::ImageItem {
@ -258,7 +265,7 @@ pub mod aobjects {
AImageName { AImageName {
iname: ImageName { iname: ImageName {
number_of_children: 1, number_of_children: 1,
correlation_id: 1028, // TODO: make iterable corr_id correlation_id: last_cor_id + 1,
ithmb_offset: 0, ithmb_offset: 0,
image_size: 20000, image_size: 20000,
vertical_padding: 0, vertical_padding: 0,
@ -295,7 +302,7 @@ pub mod aobjects {
AImageName { AImageName {
iname: ImageName { iname: ImageName {
number_of_children: 1, number_of_children: 1,
correlation_id: 1029, // TODO: make iterable corr_id correlation_id: last_cor_id + 2,
ithmb_offset: 80000, ithmb_offset: 80000,
image_size: 80000, image_size: 80000,
vertical_padding: 0, vertical_padding: 0,
@ -338,7 +345,7 @@ pub mod aobjects {
file: Some( file: Some(
ImageFile { ImageFile {
unknown1: 0, unknown1: 0,
correlation_id: 1028, // TODO: make corr_id iterable correlation_id: last_cor_id + 1,
image_size: 20000, image_size: 20000,
}, },
), ),
@ -349,7 +356,7 @@ pub mod aobjects {
file: Some( file: Some(
ImageFile { ImageFile {
unknown1: 0, unknown1: 0,
correlation_id: 1029, // TODO: make corr_id iterable correlation_id: last_cor_id + 2,
image_size: 80000, image_size: 80000,
}, },
), ),