summaryrefslogtreecommitdiff
path: root/playlist.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-11-03 18:58:50 +0100
committerGravatar waker <wakeroid@gmail.com>2011-11-03 18:58:50 +0100
commitd565d295038bc65e06d4be871183dae9fcf3f823 (patch)
tree561adcd27a1feda2d10048074bdd732bf4696366 /playlist.c
parent095c21789c8210f5e51452b83b8e4b3caa6989dd (diff)
parent9e4a5021eb7bd880b90fde42b6b19bbeda7ffd01 (diff)
Merge branch 'master' into devel
Conflicts: configure.ac scripts/quickinstall.sh
Diffstat (limited to 'playlist.c')
-rw-r--r--playlist.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/playlist.c b/playlist.c
index 5acbf680..b73d4ad3 100644
--- a/playlist.c
+++ b/playlist.c
@@ -105,7 +105,7 @@ static playlist_t dummy_playlist = {
.refc = 1
};
-static int pl_order; // mirrors "playback.order" config variable
+static int pl_order = -1; // mirrors "playback.order" config variable
static int no_remove_notify;
@@ -113,12 +113,16 @@ static playlist_t *addfiles_playlist; // current playlist for adding files/folde
void
pl_set_order (int order) {
- if (pl_order != order || pl_order == PLAYBACK_ORDER_SHUFFLE_TRACKS || pl_order == PLAYBACK_ORDER_SHUFFLE_ALBUMS) {
+ int prev_order = pl_order;
+
+ if (pl_order != order) {
pl_order = order;
for (playlist_t *plt = playlists_head; plt; plt = plt->next) {
plt_reshuffle (plt, NULL, NULL);
}
}
+
+ streamer_notify_order_changed (prev_order, pl_order);
}
int
@@ -2724,12 +2728,17 @@ plt_reshuffle (playlist_t *playlist, playItem_t **ppmin, playItem_t **ppmax) {
playItem_t *pmin = NULL;
playItem_t *pmax = NULL;
playItem_t *prev = NULL;
+ const char *alb = NULL;
+ const char *art = NULL;
for (playItem_t *it = playlist->head[PL_MAIN]; it; it = it->next[PL_MAIN]) {
- if (pl_order == PLAYBACK_ORDER_SHUFFLE_ALBUMS && prev && pl_find_meta_raw (prev, "album") == pl_find_meta_raw (it, "album") && pl_find_meta_raw (prev, "artist") == pl_find_meta_raw (it, "artist")) {
+ if (pl_order == PLAYBACK_ORDER_SHUFFLE_ALBUMS && prev && alb == pl_find_meta_raw (it, "album") && art == pl_find_meta_raw (it, "artist")) {
it->shufflerating = prev->shufflerating;
}
else {
+ prev = it;
it->shufflerating = rand ();
+ alb = pl_find_meta_raw (it, "album");
+ art = pl_find_meta_raw (it, "artist");
}
if (!pmin || it->shufflerating < pmin->shufflerating) {
pmin = it;
@@ -2738,7 +2747,6 @@ plt_reshuffle (playlist_t *playlist, playItem_t **ppmin, playItem_t **ppmax) {
pmax = it;
}
it->played = 0;
- prev = it;
}
if (ppmin) {
*ppmin = pmin;