pub struct Config {
pub cache_dir: PathBuf,
pub data_dir: PathBuf,
pub music_dir: PathBuf,
pub socket_name: String,
pub addr_claim_mode: AddrClaimMode,
pub socket_type: SocketType,
pub can_raise: bool,
pub can_set_fullscreen: bool,
pub can_quit: bool,
pub playback_config: Config,
}Expand description
Configuration options for the daemon.
Used with the start function.
Fields§
§cache_dir: PathBufThe directory containing daemon cache.
data_dir: PathBufThe directory containing the program data, eg. the playlist file.
music_dir: PathBufThe directory containing the music library/audio files to load.
socket_name: StringThe name of the socket to listen on.
This will either resolve to a namespaced socket with the same name, or, in case of a filesystem socket, a file with the same name in the temporary directory.
addr_claim_mode: AddrClaimModeDefines under which conditions should the daemon claim an occupied socket address.
socket_type: SocketTypeDefines the type of socket the daemon should use.
can_raise: boolWhether the player’s user interface can be brought to the front using any appropriate mechanism available.
Players that have no ability to raise (eg. players CLI or TUI interfaces) should set this to false.
can_set_fullscreen: bool§can_quit: boolWhether clients can request the daemon to quit.
This only affects clients that connect to the daemon over a local socket, it does not
affect the quit function.
playback_config: ConfigConfiguration options specific to the playback module.
Implementations§
Source§impl Config
impl Config
Sourcepub fn try_default() -> Result<Self, ConfigError>
pub fn try_default() -> Result<Self, ConfigError>
Get the default daemon config.
For a custom music player, you probably want to create your own config from
scratch, or use the Config::try_from_name constructor.
§Examples
let conf = chilen_daemon::Config::try_default().unwrap();Sourcepub fn try_from_name(name: &str, socket_name: &str) -> Result<Self, ConfigError>
pub fn try_from_name(name: &str, socket_name: &str) -> Result<Self, ConfigError>
Create a new config from program and socket names.
The generated paths will contain the name of the program, eg. ~/.cache/<PROGRAM_NAME>,
~/.local/share/<PROGRAM_NAME>.
Fails if the path to the home directory cannot be obtained.
§Examples
let conf = chilen_daemon::Config::try_from_name("my-player", "MY_PLAYER");