core/tags/album: Add album_match_token() function
This is called to check if any string in an album's token list is prefixed by the given string. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
c3bc8e9c02
commit
be29f53eaa
|
@ -266,6 +266,12 @@ int album_compare_year(struct album *lhs, struct album *rhs)
|
|||
return lhs->al_year - rhs->al_year;
|
||||
}
|
||||
|
||||
bool album_match_token(struct album *album, const gchar *string)
|
||||
{
|
||||
return string_match_token(string, album->al_tokens) ||
|
||||
string_match_token(string, album->al_alts);
|
||||
}
|
||||
|
||||
bool album_artwork_exists(struct album *album)
|
||||
{
|
||||
struct cache_file file;
|
||||
|
|
|
@ -47,6 +47,9 @@ int album_compare(struct album *, struct album *);
|
|||
/* Called to compare two album tags by year. */
|
||||
int album_compare_year(struct album *, struct album *);
|
||||
|
||||
/* Called to check if an artist has a token that matches the given string. */
|
||||
bool album_match_token(struct album *album, const gchar *);
|
||||
|
||||
/* Called to check if album artwork has been downloaded. */
|
||||
bool album_artwork_exists(struct album *);
|
||||
|
||||
|
|
|
@ -37,6 +37,9 @@ static void test_album()
|
|||
|
||||
album = ALBUM(album_ops->dbe_alloc("1998/Hyrule Symphony"));
|
||||
test_verify_hyrule(album);
|
||||
test_equal(album_match_token(album, "hyrule"), (bool)true);
|
||||
test_equal(album_match_token(album, "symphony"), (bool)true);
|
||||
test_equal(album_match_token(album, "skyward"), (bool)false);
|
||||
|
||||
file_init(&f, "album_tag", 0, 0);
|
||||
file_open(&f, OPEN_WRITE);
|
||||
|
|
Loading…
Reference in New Issue