core/playlist: Move playlist_init() out of the playlist namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
ce618e35a1
commit
b1c5d42387
|
@ -17,7 +17,7 @@ void core :: init(struct core_init_data *init)
|
|||
filter_init();
|
||||
tags_init();
|
||||
collection_init(init->collection_ops);
|
||||
playlist :: init(init->playlist_ops);
|
||||
playlist_init(init->playlist_ops);
|
||||
deck :: init(init->history_ops, init->tempq_ops);
|
||||
audio :: init();
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ static PlaylistQueue playlist_q;
|
|||
static std::string cur_plist;
|
||||
|
||||
|
||||
void playlist :: init(struct queue_ops *ops)
|
||||
void playlist_init(struct queue_ops *ops)
|
||||
{
|
||||
struct set_iter it;
|
||||
|
||||
|
@ -93,7 +93,7 @@ void playlist :: init(struct queue_ops *ops)
|
|||
index_init(&playlist_db, "playlist.db", true);
|
||||
db_load(&playlist_db);
|
||||
|
||||
index_entry *ent = get_tracks("Banned");
|
||||
index_entry *ent = playlist :: get_tracks("Banned");
|
||||
if (!ent)
|
||||
return;
|
||||
|
||||
|
|
|
@ -26,12 +26,6 @@ extern "C" {
|
|||
namespace playlist
|
||||
{
|
||||
|
||||
/**
|
||||
* Read playlist information from disk and removed banned tracks
|
||||
* from the Library queue.
|
||||
*/
|
||||
void init(struct queue_ops *);
|
||||
|
||||
/**
|
||||
* Check if a specific track is in a playlist.
|
||||
*
|
||||
|
@ -85,4 +79,8 @@ namespace playlist
|
|||
|
||||
};
|
||||
|
||||
|
||||
/* Called to initialize the playlist manager. */
|
||||
void playlist_init(struct queue_ops *);
|
||||
|
||||
#endif /* OCARINA_CORE_PLAYLIST_H */
|
||||
|
|
|
@ -10,36 +10,36 @@ extern "C" {
|
|||
#include "test.h"
|
||||
|
||||
static index_entry *IDX_NULL = NULL;
|
||||
static queue *Q_NULL = NULL;
|
||||
|
||||
static void test_init()
|
||||
{
|
||||
index_entry *ent;
|
||||
queue *q = playlist :: get_queue();
|
||||
GSList *list;
|
||||
|
||||
test_cp_data_dir();
|
||||
filter_init();
|
||||
tags_init();
|
||||
collection_init(NULL);
|
||||
playlist :: init(NULL);
|
||||
playlist_init(NULL);
|
||||
|
||||
test_not_equal(q, Q_NULL);
|
||||
test_not_equal(q, NULL);
|
||||
test_equal(queue_has_flag(q, Q_ENABLED), true);
|
||||
test_equal(queue_has_flag(q, Q_REPEAT), true);
|
||||
test_equal(queue_has_flag(q, Q_NO_SORT), true);
|
||||
test_equal(queue_size(q), 0);
|
||||
|
||||
ent = playlist :: get_tracks("Banned");
|
||||
test_equal(set_size(&ent->ie_set), (size_t)4);
|
||||
test_equal(queue_size(collection_get_queue()), (unsigned)20);
|
||||
ent = playlist :: get_tracks("Favorites");
|
||||
test_equal(set_size(&ent->ie_set), (size_t)8);
|
||||
ent = playlist :: get_tracks("No Such Playlist");
|
||||
test_equal(ent, IDX_NULL);
|
||||
list = q->q_sort;
|
||||
test_equal(g_slist_length(q->q_sort), 3);
|
||||
test_equal(GPOINTER_TO_INT(list->data), COMPARE_ARTIST);
|
||||
list = g_slist_next(list);
|
||||
test_equal(GPOINTER_TO_INT(list->data), COMPARE_YEAR);
|
||||
list = g_slist_next(list);
|
||||
test_equal(GPOINTER_TO_INT(list->data), COMPARE_TRACK);
|
||||
}
|
||||
|
||||
static void test_queue()
|
||||
{
|
||||
queue *q = playlist :: get_queue();
|
||||
test_cp_data_dir();
|
||||
|
||||
playlist :: select("Banned");
|
||||
test_equal(queue_size(q), (unsigned)4);
|
||||
|
@ -121,7 +121,7 @@ static void test_has()
|
|||
}
|
||||
|
||||
DECLARE_UNIT_TESTS(
|
||||
UNIT_TEST("Playlist Init", test_init),
|
||||
UNIT_TEST("Playlist Initialization", test_init),
|
||||
UNIT_TEST("Playlist Queue", test_queue),
|
||||
UNIT_TEST("Playlist Add", test_add),
|
||||
UNIT_TEST("Playlist Delete", test_delete),
|
||||
|
|
Loading…
Reference in New Issue