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();
|
filter_init();
|
||||||
tags_init();
|
tags_init();
|
||||||
collection_init(init->collection_ops);
|
collection_init(init->collection_ops);
|
||||||
playlist :: init(init->playlist_ops);
|
playlist_init(init->playlist_ops);
|
||||||
deck :: init(init->history_ops, init->tempq_ops);
|
deck :: init(init->history_ops, init->tempq_ops);
|
||||||
audio :: init();
|
audio :: init();
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ static PlaylistQueue playlist_q;
|
||||||
static std::string cur_plist;
|
static std::string cur_plist;
|
||||||
|
|
||||||
|
|
||||||
void playlist :: init(struct queue_ops *ops)
|
void playlist_init(struct queue_ops *ops)
|
||||||
{
|
{
|
||||||
struct set_iter it;
|
struct set_iter it;
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ void playlist :: init(struct queue_ops *ops)
|
||||||
index_init(&playlist_db, "playlist.db", true);
|
index_init(&playlist_db, "playlist.db", true);
|
||||||
db_load(&playlist_db);
|
db_load(&playlist_db);
|
||||||
|
|
||||||
index_entry *ent = get_tracks("Banned");
|
index_entry *ent = playlist :: get_tracks("Banned");
|
||||||
if (!ent)
|
if (!ent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,6 @@ extern "C" {
|
||||||
namespace playlist
|
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.
|
* 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 */
|
#endif /* OCARINA_CORE_PLAYLIST_H */
|
||||||
|
|
|
@ -10,36 +10,36 @@ extern "C" {
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
static index_entry *IDX_NULL = NULL;
|
static index_entry *IDX_NULL = NULL;
|
||||||
static queue *Q_NULL = NULL;
|
|
||||||
|
|
||||||
static void test_init()
|
static void test_init()
|
||||||
{
|
{
|
||||||
index_entry *ent;
|
|
||||||
queue *q = playlist :: get_queue();
|
queue *q = playlist :: get_queue();
|
||||||
|
GSList *list;
|
||||||
|
|
||||||
test_cp_data_dir();
|
|
||||||
filter_init();
|
filter_init();
|
||||||
tags_init();
|
tags_init();
|
||||||
collection_init(NULL);
|
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_ENABLED), true);
|
||||||
test_equal(queue_has_flag(q, Q_REPEAT), true);
|
test_equal(queue_has_flag(q, Q_REPEAT), true);
|
||||||
test_equal(queue_has_flag(q, Q_NO_SORT), true);
|
test_equal(queue_has_flag(q, Q_NO_SORT), true);
|
||||||
|
test_equal(queue_size(q), 0);
|
||||||
|
|
||||||
ent = playlist :: get_tracks("Banned");
|
list = q->q_sort;
|
||||||
test_equal(set_size(&ent->ie_set), (size_t)4);
|
test_equal(g_slist_length(q->q_sort), 3);
|
||||||
test_equal(queue_size(collection_get_queue()), (unsigned)20);
|
test_equal(GPOINTER_TO_INT(list->data), COMPARE_ARTIST);
|
||||||
ent = playlist :: get_tracks("Favorites");
|
list = g_slist_next(list);
|
||||||
test_equal(set_size(&ent->ie_set), (size_t)8);
|
test_equal(GPOINTER_TO_INT(list->data), COMPARE_YEAR);
|
||||||
ent = playlist :: get_tracks("No Such Playlist");
|
list = g_slist_next(list);
|
||||||
test_equal(ent, IDX_NULL);
|
test_equal(GPOINTER_TO_INT(list->data), COMPARE_TRACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_queue()
|
static void test_queue()
|
||||||
{
|
{
|
||||||
queue *q = playlist :: get_queue();
|
queue *q = playlist :: get_queue();
|
||||||
|
test_cp_data_dir();
|
||||||
|
|
||||||
playlist :: select("Banned");
|
playlist :: select("Banned");
|
||||||
test_equal(queue_size(q), (unsigned)4);
|
test_equal(queue_size(q), (unsigned)4);
|
||||||
|
@ -121,7 +121,7 @@ static void test_has()
|
||||||
}
|
}
|
||||||
|
|
||||||
DECLARE_UNIT_TESTS(
|
DECLARE_UNIT_TESTS(
|
||||||
UNIT_TEST("Playlist Init", test_init),
|
UNIT_TEST("Playlist Initialization", test_init),
|
||||||
UNIT_TEST("Playlist Queue", test_queue),
|
UNIT_TEST("Playlist Queue", test_queue),
|
||||||
UNIT_TEST("Playlist Add", test_add),
|
UNIT_TEST("Playlist Add", test_add),
|
||||||
UNIT_TEST("Playlist Delete", test_delete),
|
UNIT_TEST("Playlist Delete", test_delete),
|
||||||
|
|
Loading…
Reference in New Issue