pub mod constants;
mod read;
pub mod sv4to6;
pub mod sv7;
pub mod sv8;
use crate::ape::tag::ApeTag;
use crate::id3::v1::tag::Id3v1Tag;
use crate::id3::v2::tag::Id3v2Tag;
use crate::properties::FileProperties;
use lofty_attr::LoftyFile;
#[derive(Debug, Clone, PartialEq)]
pub enum MpcProperties {
Sv8(sv8::MpcSv8Properties),
Sv7(sv7::MpcSv7Properties),
Sv4to6(sv4to6::MpcSv4to6Properties),
}
impl Default for MpcProperties {
fn default() -> Self {
Self::Sv8(sv8::MpcSv8Properties::default())
}
}
impl From<MpcProperties> for FileProperties {
fn from(input: MpcProperties) -> Self {
match input {
MpcProperties::Sv8(sv8prop) => sv8prop.into(),
MpcProperties::Sv7(sv7prop) => sv7prop.into(),
MpcProperties::Sv4to6(sv4to6prop) => sv4to6prop.into(),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum MpcStreamVersion {
#[default]
Sv8,
Sv7,
Sv4to6,
}
#[derive(LoftyFile, Default)]
#[lofty(read_fn = "read::read_from")]
#[lofty(internal_write_module_do_not_use_anywhere_else)]
pub struct MpcFile {
pub(crate) stream_version: MpcStreamVersion,
#[lofty(tag_type = "Id3v2")]
pub(crate) id3v2_tag: Option<Id3v2Tag>,
#[lofty(tag_type = "Id3v1")]
pub(crate) id3v1_tag: Option<Id3v1Tag>,
#[lofty(tag_type = "Ape")]
pub(crate) ape_tag: Option<ApeTag>,
pub(crate) properties: MpcProperties,
}
impl MpcFile {
pub fn stream_version(&self) -> MpcStreamVersion {
self.stream_version
}
}