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 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.
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");