#[derive(Clone, Debug)]
pub struct PlayerConfig {
pub identity: String,
pub bus_name: String,
pub desktop_entry: String,
pub track_id_prefix: String,
pub supported_uri_schemes: Vec<String>,
pub supported_mime_types: Vec<String>,
pub hwnd: Option<u64>,
}
impl Default for PlayerConfig {
fn default() -> Self {
Self {
identity: "Media Player".to_string(),
bus_name: "MediaPlayer".to_string(),
desktop_entry: String::new(),
track_id_prefix: "/org/mpris/MediaPlayer2/Track".to_string(),
supported_uri_schemes: vec!["http".to_string(), "https".to_string()],
supported_mime_types: Vec::new(),
hwnd: None,
}
}
}
impl PlayerConfig {
pub fn new(name: impl Into<String>) -> Self {
let name = name.into();
Self {
identity: name.clone(),
bus_name: name,
..Self::default()
}
}
pub fn desktop_entry(mut self, entry: impl Into<String>) -> Self {
self.desktop_entry = entry.into();
self
}
pub fn track_id_prefix(mut self, prefix: impl Into<String>) -> Self {
self.track_id_prefix = prefix.into();
self
}
pub fn supported_uri_schemes(mut self, schemes: Vec<String>) -> Self {
self.supported_uri_schemes = schemes;
self
}
pub fn supported_mime_types(mut self, types: Vec<String>) -> Self {
self.supported_mime_types = types;
self
}
pub fn hwnd(mut self, hwnd: u64) -> Self {
self.hwnd = Some(hwnd);
self
}
}