-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store last loaded playlist #2101
Store last loaded playlist #2101
Conversation
src/queue/Playlist.hxx
Outdated
@@ -102,6 +102,9 @@ struct playlist { | |||
[[gnu::pure]] | |||
int GetNextPosition() const noexcept; | |||
|
|||
const std::string getLastLoadedPlaylist() const noexcept; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad method name, but the worst thing is that this allocates a copy of the string on the heap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to starting uppercase and converted to std::string_view. I hope this is correct!
src/queue/Queue.cxx
Outdated
@@ -270,6 +270,7 @@ Queue::Clear() noexcept | |||
} | |||
|
|||
length = 0; | |||
last_loaded_playlist = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has a smell - last_loaded_playlist.clear();
is better and faster
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced
src/queue/Queue.hxx
Outdated
@@ -85,6 +85,9 @@ struct Queue { | |||
/** play back songs in random order? */ | |||
bool random = false; | |||
|
|||
/** Last loaded playlist */ | |||
std::string last_loaded_playlist = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This initializer has no effect (except for adding runtime overhead)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
f7c08dc
to
bb36989
Compare
There's no protocol documentation; and the |
Stores the last loaded playlist uri in the queue struct. Last loaded playlist is set on load command and cleared with the clear command. The last loaded playlist is printed in the status command and saved / restored from the partition state file. Resolves issue MusicPlayerDaemon#938
bb36989
to
bfbff31
Compare
Added documentation and inlined the functions. |
Stores the last loaded playlist uri in the queue struct. Last loaded playlist is set on load command and cleared with the clear command. The last loaded playlist is printed in the status command and saved / restored from the partition state file.
Resolves issue #938