63 lines
1.1 KiB
Rust
63 lines
1.1 KiB
Rust
use serde::Deserialize;
|
|
|
|
// https://github.com/UoC-Radio/audio-scheduler/blob/45275818423220de90b4ae578b57acdc138e5f50/config_schema.xsd
|
|
// TODO: Extensively check constraints such as `minOccurs` and `use="required".
|
|
|
|
#[derive(Deserialize)]
|
|
struct Fader {
|
|
fade_in_duration_secs: i8,
|
|
fade_out_duration_secs: i8,
|
|
min_level: f32,
|
|
max_level: f32,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
struct Playlist {
|
|
path: String,
|
|
shuffle: bool,
|
|
fader: Fader,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
struct IntermediatePlaylist {
|
|
path: String,
|
|
shuffle: bool,
|
|
fader: Fader,
|
|
sched_interval_mins: u16,
|
|
num_sched_items: u32,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
enum ZoneContent {
|
|
Main(Playlist),
|
|
Fallback(Playlist),
|
|
Intermediate(IntermediatePlaylist),
|
|
Maintainer(String),
|
|
Description(String),
|
|
Comment(String),
|
|
}
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
struct Zone {
|
|
name: String,
|
|
// TODO: Use a time struct
|
|
start: String,
|
|
zone_content: ZoneContent,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
struct Day {
|
|
zones: Vec<Zone>,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
struct WeekSchedule {
|
|
mon: Day,
|
|
tue: Day,
|
|
wed: Day,
|
|
thu: Day,
|
|
fri: Day,
|
|
sat: Day,
|
|
sun: Day,
|
|
}
|