From e428b96440c7f0bf43aae8ff47b5c3bd05c47025 Mon Sep 17 00:00:00 2001 From: waker Date: Fri, 20 May 2011 14:36:50 +0200 Subject: in shuffle albums mode, skip previous album tracks if user selects track manually --- playlist.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'playlist.c') diff --git a/playlist.c b/playlist.c index af978032..e7f4391b 100644 --- a/playlist.c +++ b/playlist.c @@ -2702,11 +2702,6 @@ plt_reshuffle (playlist_t *playlist, playItem_t **ppmin, playItem_t **ppmax) { UNLOCK; } -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; @@ -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 (); +} -- cgit v1.2.3