65 lines
1.9 KiB
C
65 lines
1.9 KiB
C
/*
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
*
|
|
* The Artist tag is used to store the name of artists
|
|
* added to the tag database.
|
|
*
|
|
* When writing an Artist tag to disk, only write out the
|
|
* artist_name field:
|
|
*
|
|
* ... Koji Kondo
|
|
* ... Hajime Wakai
|
|
*/
|
|
#ifndef OCARINA_CORE_TAGS_ARTIST_H
|
|
#define OCARINA_CORE_TAGS_ARTIST_H
|
|
|
|
#include <core/database.h>
|
|
|
|
struct artist {
|
|
gchar *ar_name; /* This artist's name. */
|
|
gchar **ar_tokens; /* This artist's tokenized strings. */
|
|
gchar **ar_alts; /* This artist's alternate ascii tokens. */
|
|
void *ar_playlist; /* This artist's associated playlist. */
|
|
struct db_entry ar_dbe;
|
|
};
|
|
|
|
#define ARTIST(dbe) ((struct artist *)DBE_DATA(dbe))
|
|
|
|
|
|
/* Called to initialize the artist database. */
|
|
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,
|
|
* but library_lookup() will return NULL in this situation.
|
|
*/
|
|
struct artist *artist_find(const gchar *);
|
|
struct artist *artist_lookup(const gchar *);
|
|
|
|
/* Called to get an artist tag with a specific index. */
|
|
struct artist *artist_get(const unsigned int);
|
|
|
|
/* Called to compare two artist tags. */
|
|
int artist_compare(struct artist *, struct artist *);
|
|
|
|
/* Called to check if an artist has a token that matches the given string. */
|
|
bool artist_match_token(struct artist *artist, const gchar *);
|
|
|
|
/* Called to find the database index of the artist tag. */
|
|
static inline unsigned int artist_index(struct artist *artist)
|
|
{
|
|
return artist->ar_dbe.dbe_index;
|
|
}
|
|
|
|
#ifdef CONFIG_TESTING
|
|
const struct db_ops *test_artist_ops();
|
|
#endif /* CONFIG_TESTING */
|
|
#endif /* OCARINA_CORE_TAGS_ARTIST_H */
|