summaryrefslogtreecommitdiff
path: root/playlist.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-05-20 14:36:50 +0200
committerGravatar waker <wakeroid@gmail.com>2011-05-20 14:36:50 +0200
commite428b96440c7f0bf43aae8ff47b5c3bd05c47025 (patch)
treeccf3be8e89d3ea60a9099c1b56cba0f0020ecf3c /playlist.c
parent4c6ee7ff8dcb31d07f4c8f012e8338a17ecbb119 (diff)
in shuffle albums mode, skip previous album tracks if user selects track manually
Diffstat (limited to 'playlist.c')
-rw-r--r--playlist.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/playlist.c b/playlist.c
index af978032..e7f4391b 100644
--- a/playlist.c
+++ b/playlist.c
@@ -2703,11 +2703,6 @@ plt_reshuffle (playlist_t *playlist, playItem_t **ppmin, playItem_t **ppmax) {
}
void
-pl_reshuffle (playItem_t **ppmin, playItem_t **ppmax) {
- plt_reshuffle (playlist, ppmin, ppmax);
-}
-
-void
plt_set_item_duration (playlist_t *playlist, playItem_t *it, float duration) {
LOCK;
if (it->in_playlist) {
@@ -3873,3 +3868,26 @@ pl_get_playlist (playItem_t *it) {
UNLOCK;
return NULL;
}
+
+// this function must be called user starts track manually in shuffle albums mode
+// r is an index of current track
+// mark previous songs in the album as played
+void
+plt_init_shuffle_albums (playlist_t *plt, int r) {
+ printf ("init_shuffle_albums %d\n", r);
+ pl_lock ();
+ playItem_t *first = plt_get_item_for_idx (plt, r, PL_MAIN);
+ if (first->played) {
+ plt_reshuffle (plt, NULL, NULL);
+ }
+ if (first) {
+ int rating = first->shufflerating;
+ playItem_t *it = first->prev[PL_MAIN];
+ pl_item_unref (first);
+ while (it && rating == it->shufflerating) {
+ it->played = 1;
+ it = it->prev[PL_MAIN];
+ }
+ }
+ pl_unlock ();
+}