0.1.71 upd
This commit is contained in:
parent
15b1f7e6bc
commit
fc0366f833
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -90,7 +90,7 @@ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itunesdb"
|
name = "itunesdb"
|
||||||
version = "0.1.64"
|
version = "0.1.71"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "itunesdb"
|
name = "itunesdb"
|
||||||
version = "0.1.70"
|
version = "0.1.71"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["alterwain"]
|
authors = ["alterwain"]
|
||||||
|
|
||||||
|
173
src/artworkdb.rs
173
src/artworkdb.rs
@ -231,6 +231,131 @@ pub mod aobjects {
|
|||||||
pub(crate) fn find_dataset(&mut self, p0: u32) -> &mut ADataSet {
|
pub(crate) fn find_dataset(&mut self, p0: u32) -> &mut ADataSet {
|
||||||
self.children.iter_mut().find(|d| d.data.data_type == p0).unwrap()
|
self.children.iter_mut().find(|d| d.data.data_type == p0).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn add_images(&mut self, small_image_path: &str, large_image_path: &str, song_dbid: u64) {
|
||||||
|
let ds = self.find_dataset(1);
|
||||||
|
let image_items = &mut ds.child;
|
||||||
|
let image_item = crate::artworkdb::objects::ImageItem {
|
||||||
|
number_of_children: 3,
|
||||||
|
id: image_items.last().map_or(100, |p| p.data.as_ref().unwrap().id + 1),
|
||||||
|
song_dbid,
|
||||||
|
unknown4: 0,
|
||||||
|
rating: 0,
|
||||||
|
unknown6: 0,
|
||||||
|
original_date: 0,
|
||||||
|
digitized_date: 0,
|
||||||
|
source_image_size: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
let small_tag = SecondTypeTag {
|
||||||
|
data: LocationTag {
|
||||||
|
tag_type: 2,
|
||||||
|
unk1: 0,
|
||||||
|
unk2: 0
|
||||||
|
},
|
||||||
|
str: None,
|
||||||
|
child: Some(
|
||||||
|
AImageName {
|
||||||
|
iname: ImageName {
|
||||||
|
number_of_children: 1,
|
||||||
|
correlation_id: 1028, // TODO: make iterable corr_id
|
||||||
|
ithmb_offset: 0,
|
||||||
|
image_size: 20000,
|
||||||
|
vertical_padding: 0,
|
||||||
|
horizontal_padding: 0,
|
||||||
|
image_height: 100,
|
||||||
|
image_width: 100,
|
||||||
|
unknown: 0,
|
||||||
|
image_size_n: 20000,
|
||||||
|
},
|
||||||
|
tag: Some(
|
||||||
|
ThirdTypeTag {
|
||||||
|
data: LocationTag {
|
||||||
|
tag_type: 3,
|
||||||
|
unk1: 0,
|
||||||
|
unk2: 0,
|
||||||
|
},
|
||||||
|
str: Some(
|
||||||
|
[":", small_image_path].concat(),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
|
let large_tag = SecondTypeTag {
|
||||||
|
data: LocationTag {
|
||||||
|
tag_type: 2,
|
||||||
|
unk1: 0,
|
||||||
|
unk2: 0
|
||||||
|
},
|
||||||
|
str: None,
|
||||||
|
child: Some(
|
||||||
|
AImageName {
|
||||||
|
iname: ImageName {
|
||||||
|
number_of_children: 1,
|
||||||
|
correlation_id: 1029, // TODO: make iterable corr_id
|
||||||
|
ithmb_offset: 80000,
|
||||||
|
image_size: 80000,
|
||||||
|
vertical_padding: 0,
|
||||||
|
horizontal_padding: 0,
|
||||||
|
image_height: 200,
|
||||||
|
image_width: 200,
|
||||||
|
unknown: 0,
|
||||||
|
image_size_n: 80000,
|
||||||
|
},
|
||||||
|
tag: Some(
|
||||||
|
ThirdTypeTag {
|
||||||
|
data: LocationTag {
|
||||||
|
tag_type: 3,
|
||||||
|
unk1: 0,
|
||||||
|
unk2: 0,
|
||||||
|
},
|
||||||
|
str: Some(
|
||||||
|
[":", large_image_path].concat(),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
image_items.push(AImageItem {
|
||||||
|
tag: vec![small_tag, large_tag],
|
||||||
|
data: Some(image_item),
|
||||||
|
file: None,
|
||||||
|
});
|
||||||
|
|
||||||
|
let files = self.find_dataset(3);
|
||||||
|
let image_files = &mut files.child;
|
||||||
|
|
||||||
|
image_files.append(&mut vec![
|
||||||
|
AImageItem {
|
||||||
|
tag: Vec::new(),
|
||||||
|
data: None,
|
||||||
|
file: Some(
|
||||||
|
ImageFile {
|
||||||
|
unknown1: 0,
|
||||||
|
correlation_id: 1028, // TODO: make corr_id iterable
|
||||||
|
image_size: 20000,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
AImageItem {
|
||||||
|
tag: Vec::new(),
|
||||||
|
data: None,
|
||||||
|
file: Some(
|
||||||
|
ImageFile {
|
||||||
|
unknown1: 0,
|
||||||
|
correlation_id: 1029, // TODO: make corr_id iterable
|
||||||
|
image_size: 80000,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, serde::Serialize)]
|
#[derive(Debug, serde::Serialize)]
|
||||||
@ -347,41 +472,41 @@ pub mod objects {
|
|||||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Copy)]
|
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone, Copy)]
|
||||||
pub struct LocationTag {
|
pub struct LocationTag {
|
||||||
pub tag_type: u32,
|
pub tag_type: u32,
|
||||||
unk1: u32,
|
pub unk1: u32,
|
||||||
unk2: u32,
|
pub unk2: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
||||||
pub struct ImageItem {
|
pub struct ImageItem {
|
||||||
number_of_children: u32,
|
pub number_of_children: u32,
|
||||||
id: u32,
|
pub id: u32,
|
||||||
song_dbid: u64,
|
pub song_dbid: u64,
|
||||||
unknown4: u32,
|
pub unknown4: u32,
|
||||||
rating: u32,
|
pub rating: u32,
|
||||||
unknown6: u32,
|
pub unknown6: u32,
|
||||||
original_date: u32,
|
pub original_date: u32,
|
||||||
digitized_date: u32,
|
pub digitized_date: u32,
|
||||||
source_image_size: u32
|
pub source_image_size: u32
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
||||||
pub struct ImageFile {
|
pub struct ImageFile {
|
||||||
unknown1: u32,
|
pub(crate) unknown1: u32,
|
||||||
correlation_id: u32,
|
pub(crate) correlation_id: u32,
|
||||||
image_size: u32
|
pub(crate) image_size: u32
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
||||||
pub struct ImageName {
|
pub struct ImageName {
|
||||||
number_of_children: u32,
|
pub(crate) number_of_children: u32,
|
||||||
correlation_id: u32,
|
pub(crate) correlation_id: u32,
|
||||||
ithmb_offset: u32,
|
pub(crate) ithmb_offset: u32,
|
||||||
image_size: u32,
|
pub(crate) image_size: u32,
|
||||||
vertical_padding: u16,
|
pub(crate) vertical_padding: u16,
|
||||||
horizontal_padding: u16,
|
pub(crate) horizontal_padding: u16,
|
||||||
image_height: u16,
|
pub(crate) image_height: u16,
|
||||||
image_width: u16,
|
pub(crate) image_width: u16,
|
||||||
unknown: u32,
|
pub(crate) unknown: u32,
|
||||||
image_size_n: u32,
|
pub(crate) image_size_n: u32,
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user