Changes to be committed:

modified:   src/main.rs
This commit is contained in:
Michael Wain 2025-02-01 03:44:11 +03:00
parent 45f90c65d4
commit d458a84d4d

View File

@ -3,6 +3,36 @@ use env_logger::Builder;
use log::{error, info, LevelFilter};
use rkyv::{deserialize, rancor::Error, Archive, Deserialize, Serialize};
enum ChunkType {
Database,
DataSet,
AlbumList,
AlbumItem,
TrackList,
TrackItem,
StringTypes,
PlaylistList,
Playlist,
Unknown
}
impl From<[u8; 4]> for ChunkType {
fn from(value: [u8; 4]) -> Self {
match value {
[109, 104, 98, 100] => ChunkType::Database,
[109, 104, 115, 100] => ChunkType::DataSet,
[109, 104, 105, 97] => ChunkType::AlbumList,
[109, 104, 108, 97] => ChunkType::AlbumItem,
[109, 104, 108, 116] => ChunkType::TrackList,
[109, 104, 105, 116] => ChunkType::TrackItem,
[109, 104, 111, 100] => ChunkType::StringTypes,
[0x6D, 0x68, 0x6C, 0x70] => ChunkType::PlaylistList,
[0x6D, 0x68, 0x79, 0x70] => ChunkType::Playlist,
_ => ChunkType::Unknown
}
}
}
#[derive(Archive, Deserialize, Serialize, Debug, PartialEq)]
#[rkyv(compare(PartialEq), derive(Debug))]
struct ChunkHeader {