use std::time::Duration;
#[derive(Clone, Debug, PartialEq)]
pub enum Command {
Rem(String, String),
Catalog(String),
CdTextFile(String),
Flags(Vec<String>),
Isrc(String),
Songwriter(String),
Performer(String),
Title(String),
File(String, String),
Track(String, String),
Index(String, String),
Pregap(String),
Postgap(String),
Unknown(String),
None,
}
#[derive(Clone, Debug, PartialEq)]
pub struct Track {
pub no: String,
pub format: String,
pub title: Option<String>,
pub performer: Option<String>,
pub indices: Vec<(String, Duration)>,
pub pregap: Option<Duration>,
pub postgap: Option<Duration>,
pub comments: Vec<(String, String)>,
pub isrc: Option<String>,
pub flags: Vec<String>,
pub songwriter: Option<String>,
pub unknown: Vec<String>,
}
impl Track {
pub fn new(no: &str, format: &str) -> Self {
Self {
songwriter: None,
no: no.to_string(),
format: format.to_string(),
title: None,
performer: None,
pregap: None,
postgap: None,
indices: Vec::new(),
comments: Vec::new(),
unknown: Vec::new(),
flags: Vec::new(),
isrc: None,
}
}
}
#[derive(Clone, Debug, PartialEq)]
pub struct CueFile {
pub file: String,
pub format: String,
pub tracks: Vec<Track>,
pub comments: Vec<(String, String)>,
}
impl CueFile {
pub fn new(file: &str, format: &str) -> Self {
Self {
file: file.to_string(),
tracks: Vec::new(),
format: format.to_string(),
comments: Vec::new(),
}
}
}
#[derive(Clone, Debug, Default)]
pub struct Cue {
pub files: Vec<CueFile>,
pub title: Option<String>,
pub performer: Option<String>,
pub songwriter: Option<String>,
pub cd_text_file: Option<String>,
pub catalog: Option<String>,
pub comments: Vec<(String, String)>, pub unknown: Vec<String>,
}
impl Cue {
pub fn new() -> Self {
Self {
files: Vec::new(),
songwriter: None,
cd_text_file: None,
title: None,
performer: None,
catalog: None,
comments: Vec::new(),
unknown: Vec::new(),
}
}
}