diff --git a/Cargo.toml b/Cargo.toml index 180eada..2c426cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "itunesdb" -version = "0.1.32" +version = "0.1.33" edition = "2021" authors = ["alterwain"] diff --git a/src/artworkdb.rs b/src/artworkdb.rs index 4891c06..f1ce894 100644 --- a/src/artworkdb.rs +++ b/src/artworkdb.rs @@ -55,20 +55,26 @@ pub mod deserializer { let ds: LocationTag = bincode::deserialize(&data[i..i + u]).unwrap(); let images = &mut adb.find_dataset(last_type).child; let mut str = None; - if ds.tag_type == 3 { - let mut bytes = Vec::new(); - let str_end = u32::from_le_bytes(data[i+12..i+16].try_into().unwrap()) as usize; - let mut h = i+24; - u += 12 + str_end; - while h < i+24+str_end { - bytes.push(u16::from_le_bytes(data[h..h+2].try_into().unwrap())); - h+=2; - } - let g = String::from_utf16(&bytes).unwrap(); - info!("str: {}", g); - str = Some(g); + match ds.tag_type { + 3 => { + let mut bytes = Vec::new(); + let str_end = u32::from_le_bytes(data[i+12..i+16].try_into().unwrap()) as usize; + let mut h = i+24; + u += 12 + str_end; + while h < i+24+str_end { + bytes.push(u16::from_le_bytes(data[h..h+2].try_into().unwrap())); + h+=2; + } + let g = String::from_utf16(&bytes).unwrap(); + info!("str: {}", g); + str = Some(g); + images.last_mut().unwrap().args.push(ALocationTag { data: ds, str, child: None }); + }, + 2 => { + images.last_mut().unwrap().args.push(ALocationTag { data: ds, str, child: None }); + }, + _ => { u = usize::try_from(header.children_count).unwrap() - 12; } } - images.last_mut().unwrap().args.push(ALocationTag { data: ds, str, child: None }); }, ChunkType::ImageName => { info!("ImageName tag");