1
0
Fork 0
mirror of https://github.com/librespot-org/librespot.git synced 2025-10-05 02:39:53 +02:00

Merge pull request #506 from LaurentLouf/feature-split_cache_folders

Feature split cache folders, resolves #505
This commit is contained in:
Sasha Hilton 2021-01-02 23:17:33 +00:00 committed by GitHub
commit 414383db18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 12 deletions

View file

@ -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")
@ -251,9 +256,16 @@ 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.clone()));
let cache = Some(Cache::new(
PathBuf::from(cache_directory),
PathBuf::from(system_cache_directory),
use_audio_cache,
));
let initial_volume = matches
.opt_str("initial-volume")