mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[PR #218] [CLOSED] Persist software volume across restarts #840
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#840
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/librespot-org/librespot/pull/218
Author: @bricedp
Created: 5/10/2018
Status: ❌ Closed
Base:
master← Head:persist-volume📝 Commits (6)
e23c233add persist-volume to command line optionsfa66dd3add persist-volume to ConnectConfigf2be053import fs, io, path modules to read and write volume persistence filefed8988pass persist_volume to volume_to_mixer function calls9cd9737add logic to read and write persistent volume41480e7rustfmt changes📊 Changes
5 files changed (+72 additions, -14 deletions)
View changed files
📝
connect/src/spirc.rs(+37 -8)📝
core/src/config.rs(+1 -0)📝
examples/play.rs(+1 -1)📝
playback/src/audio_backend/jackaudio.rs(+4 -2)📝
src/main.rs(+29 -3)📄 Description
This pull request adds the ability to persist the software volume across restarts of librespot. A user can now specify a file path using the
--persist-volumeflag where the volume will be written to disk. If the file exists, the volume will be read from it and it will override the--initial-volumevalue. If not, it will be written upon the first connection of a client. This way,--initial-volumecan still be used to set the volume for the first run of librespot, after which the persistent volume will take precedence.For example,
librespot --initial-volume 25 --persist-volume /tmp/librespot.volwill start at 25%, but all future runs of the program will read the most recent volume from /tmp/librespot.vol.In the event that the file cannot be written to or read from, the current logic intends for librespot to fail fast and hard, so that the user is made aware and not led to believe that the volume is being persisted when in fact it isn't.
Builds against the latest nightly version of rust (1.27.0) pass without errors or warnings, and rustfmt has been used to standardize the code. Please let me know if you need me to make any changes. Rust is a relatively new language to me, so I am not sure if the
unwrap()andclone()calls are considered best practice as implemented here.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.