Add audio_cache_size to set maximum cache size
This commit is contained in:
@@ -185,6 +185,7 @@ Possible configuration values are:
|
|||||||
* `backend_device`: Audio device string to configure the backend
|
* `backend_device`: Audio device string to configure the backend
|
||||||
* `audio_cache`: Enable or disable caching of audio files, on by default
|
* `audio_cache`: Enable or disable caching of audio files, on by default
|
||||||
<true/false>
|
<true/false>
|
||||||
|
* `audio_cache_size`: Maximum size of audio cache in MiB
|
||||||
* `volnorm`: Enable or disable volume normalization, off by default <true/false>
|
* `volnorm`: Enable or disable volume normalization, off by default <true/false>
|
||||||
* `volnorm_pregain`: Normalization pregain to apply (if enabled)
|
* `volnorm_pregain`: Normalization pregain to apply (if enabled)
|
||||||
* `default_keybindings`: If disabled, the default keybindings are discarded, off
|
* `default_keybindings`: If disabled, the default keybindings are discarded, off
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ pub struct ConfigValues {
|
|||||||
pub theme: Option<ConfigTheme>,
|
pub theme: Option<ConfigTheme>,
|
||||||
pub use_nerdfont: Option<bool>,
|
pub use_nerdfont: Option<bool>,
|
||||||
pub audio_cache: Option<bool>,
|
pub audio_cache: Option<bool>,
|
||||||
|
pub audio_cache_size: Option<u32>,
|
||||||
pub backend: Option<String>,
|
pub backend: Option<String>,
|
||||||
pub backend_device: Option<String>,
|
pub backend_device: Option<String>,
|
||||||
pub volnorm: Option<bool>,
|
pub volnorm: Option<bool>,
|
||||||
|
|||||||
@@ -162,7 +162,9 @@ impl Spotify {
|
|||||||
let cache = Cache::new(
|
let cache = Cache::new(
|
||||||
Some(config::cache_path("librespot")),
|
Some(config::cache_path("librespot")),
|
||||||
audio_cache_path,
|
audio_cache_path,
|
||||||
None,
|
cfg.values()
|
||||||
|
.audio_cache_size
|
||||||
|
.map(|size| (size * 1048576) as u64),
|
||||||
)
|
)
|
||||||
.expect("Could not create cache");
|
.expect("Could not create cache");
|
||||||
debug!("opening spotify session");
|
debug!("opening spotify session");
|
||||||
|
|||||||
Reference in New Issue
Block a user