summaryrefslogtreecommitdiff
path: root/src/queue/PlaylistState.cxx
diff options
context:
space:
mode:
authorPatryk HachuĊ‚a <hahiserw@gmail.com>2018-02-05 17:13:00 +0100
committerMax Kellermann <max@musicpd.org>2018-02-25 09:50:03 +0100
commit1628d801f9534ab33a711d337cdd691dca2c5710 (patch)
tree2cd898e2769fe9a897b7c67acf13ac7422df4ed2 /src/queue/PlaylistState.cxx
parent1fb358249b2a4f63d82103348d2904fcef608353 (diff)
playlist/Queue: add one-shot to single mode
Diffstat (limited to 'src/queue/PlaylistState.cxx')
-rw-r--r--src/queue/PlaylistState.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/queue/PlaylistState.cxx b/src/queue/PlaylistState.cxx
index 614f01c19..bb916f2c7 100644
--- a/src/queue/PlaylistState.cxx
+++ b/src/queue/PlaylistState.cxx
@@ -26,6 +26,7 @@
#include "PlaylistState.hxx"
#include "PlaylistError.hxx"
#include "Playlist.hxx"
+#include "SingleMode.hxx"
#include "queue/QueueSave.hxx"
#include "fs/io/TextFile.hxx"
#include "fs/io/BufferedOutputStream.hxx"
@@ -88,7 +89,8 @@ playlist_state_save(BufferedOutputStream &os, const struct playlist &playlist,
os.Format(PLAYLIST_STATE_FILE_RANDOM "%i\n", playlist.queue.random);
os.Format(PLAYLIST_STATE_FILE_REPEAT "%i\n", playlist.queue.repeat);
- os.Format(PLAYLIST_STATE_FILE_SINGLE "%i\n", playlist.queue.single);
+ os.Format(PLAYLIST_STATE_FILE_SINGLE "%i\n",
+ (int)playlist.queue.single);
os.Format(PLAYLIST_STATE_FILE_CONSUME "%i\n", playlist.queue.consume);
os.Format(PLAYLIST_STATE_FILE_CROSSFADE "%i\n",
(int)pc.GetCrossFade());
@@ -153,7 +155,7 @@ playlist_state_restore(const char *line, TextFile &file,
} else if ((p = StringAfterPrefix(line, PLAYLIST_STATE_FILE_REPEAT))) {
playlist.SetRepeat(pc, StringIsEqual(p, "1"));
} else if ((p = StringAfterPrefix(line, PLAYLIST_STATE_FILE_SINGLE))) {
- playlist.SetSingle(pc, StringIsEqual(p, "1"));
+ playlist.SetSingle(pc, SingleFromString(p));
} else if ((p = StringAfterPrefix(line, PLAYLIST_STATE_FILE_CONSUME))) {
playlist.SetConsume(StringIsEqual(p, "1"));
} else if ((p = StringAfterPrefix(line, PLAYLIST_STATE_FILE_CROSSFADE))) {
@@ -233,9 +235,10 @@ playlist_state_get_hash(const playlist &playlist,
: 0) ^
((int)pc.GetCrossFade() << 20) ^
(unsigned(player_status.state) << 24) ^
+ /* note that this takes 2 bits */
+ ((int)playlist.queue.single << 25) ^
(playlist.queue.random << 27) ^
(playlist.queue.repeat << 28) ^
- (playlist.queue.single << 29) ^
(playlist.queue.consume << 30) ^
(playlist.queue.random << 31);
}