core/tags/artist: Add an artist_db_get() function
This will be called to scan the artist database when setting up playlists. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
b3922cc731
commit
20e0a85a5d
|
@ -68,6 +68,11 @@ void artist_db_deinit()
|
|||
db_deinit(&artist_db);
|
||||
}
|
||||
|
||||
const struct database *artist_db_get()
|
||||
{
|
||||
return &artist_db;
|
||||
}
|
||||
|
||||
struct artist *artist_find(const gchar *name)
|
||||
{
|
||||
return ARTIST(db_find(&artist_db, name));
|
||||
|
|
|
@ -31,6 +31,9 @@ void artist_db_init();
|
|||
/* Called to clean up the artist database. */
|
||||
void artist_db_deinit();
|
||||
|
||||
/* Called to access the artist database. */
|
||||
const struct database *artist_db_get();
|
||||
|
||||
/*
|
||||
* Called to find an artist tag by name. The difference is that artist_find()
|
||||
* will allocate a new artiststruct if the requested one doesn't exist yet,
|
||||
|
|
|
@ -79,12 +79,16 @@ static void test_artist_db()
|
|||
struct database artist_db;
|
||||
struct artist *artist;
|
||||
|
||||
test_not_equal((void *)artist_db_get(), NULL);
|
||||
test_equal(artist_db_get()->db_size, 0);
|
||||
|
||||
artist_db_init();
|
||||
artist = artist_lookup("Koji Kondo");
|
||||
test_equal((void *)artist, NULL);
|
||||
artist = artist_find("Koji Kondo");
|
||||
test_verify_koji(artist);
|
||||
|
||||
test_equal(artist_db_get()->db_size, 1);
|
||||
test_equal((void *)artist_lookup("Koji Kondo"), (void *)artist);
|
||||
test_equal((void *)artist_find("Koji Kondo"), (void *)artist);
|
||||
test_equal((void *)artist_get(0), (void *)artist);
|
||||
|
|
Loading…
Reference in New Issue