core/playlists: Pick the next track from the currently selected playlist
Unless the user has queued tracks, of course. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
8985e70439
commit
64ceca84c5
|
@ -108,9 +108,20 @@ void playlist_sort(enum playlist_type_t type, const gchar *name,
|
|||
|
||||
struct track *playlist_next(void)
|
||||
{
|
||||
if (playlist_size(PL_SYSTEM, "Queued Tracks") > 0)
|
||||
return playlist_types[PL_SYSTEM]->pl_next("Queued Tracks");
|
||||
return playlist_types[PL_SYSTEM]->pl_next("Collection");
|
||||
enum playlist_type_t type = settings_get(SETTINGS_CUR_TYPE);
|
||||
unsigned int id = settings_get(SETTINGS_CUR_ID);
|
||||
struct track *track;
|
||||
gchar *name;
|
||||
|
||||
if (playlist_size(PL_SYSTEM, "Queued Tracks") > 0) {
|
||||
type = PL_SYSTEM;
|
||||
id = SYS_PL_QUEUED;
|
||||
}
|
||||
|
||||
name = playlist_get_name(type, id);
|
||||
track = playlist_types[type]->pl_next(name);
|
||||
g_free(name);
|
||||
return track;
|
||||
}
|
||||
|
||||
struct track *playlist_prev(void)
|
||||
|
|
|
@ -178,6 +178,7 @@ static void test_queued()
|
|||
__test_playlist_noselect("Queued Tracks");
|
||||
__test_playlist_reinit("Queued Tracks", 2, true, true);
|
||||
|
||||
playlist_select(PL_SYSTEM, "Collection");
|
||||
g_assert(playlist_next() == track_get(0));
|
||||
g_assert_cmpuint(playlist_size(PL_SYSTEM, "Queued Tracks"), ==, 1);
|
||||
g_assert(playlist_next() == track_get(1));
|
||||
|
|
Loading…
Reference in New Issue