mirror of
https://github.com/librespot-org/librespot.git
synced 2025-10-04 02:09:26 +02:00
Add the option to specify the system cache for credentials and volume files and adapt Cache to use two cache directories instead of one
This commit is contained in:
parent
e3abb87da1
commit
8fc9ebfa8c
2 changed files with 23 additions and 12 deletions
14
src/main.rs
14
src/main.rs
|
@ -97,6 +97,11 @@ fn setup(args: &[String]) -> Setup {
|
|||
"cache",
|
||||
"Path to a directory where files will be cached.",
|
||||
"CACHE",
|
||||
).optopt(
|
||||
"",
|
||||
"system-cache",
|
||||
"Path to a directory where system files (credentials, volume) will be cached. Can be different from cache option value",
|
||||
"SYTEMCACHE",
|
||||
).optflag("", "disable-audio-cache", "Disable caching of the audio data.")
|
||||
.reqopt("n", "name", "Device name", "NAME")
|
||||
.optopt("", "device-type", "Displayed device type", "DEVICE_TYPE")
|
||||
|
@ -244,9 +249,12 @@ fn setup(args: &[String]) -> Setup {
|
|||
|
||||
let use_audio_cache = !matches.opt_present("disable-audio-cache");
|
||||
|
||||
let cache = matches
|
||||
.opt_str("c")
|
||||
.map(|cache_location| Cache::new(PathBuf::from(cache_location), use_audio_cache));
|
||||
let cache_directory = matches.opt_str("c").unwrap_or(String::from(""))
|
||||
let system_cache_directory = matches.opt_str("system-cache").unwrap_or(String::from(cache_directory))
|
||||
let cache = Cache::new(
|
||||
PathBuf::from(cache_directory),
|
||||
PathBuf::from(system_cache_directory),
|
||||
use_audio_cache));
|
||||
|
||||
let initial_volume = matches
|
||||
.opt_str("initial-volume")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue