core/tags/album: Move album_find() out of the tags namespace

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-09-24 11:13:12 -04:00
parent 1f5668bd72
commit 0fa2d8acc2
5 changed files with 8 additions and 16 deletions

View File

@ -96,7 +96,7 @@ static void tag_track(Library *library, const std::string &filepath)
audio = ref.audioProperties();
track = tags :: add_track(
tags :: get_album(tag->album().stripWhiteSpace().to8Bit(true), tag->year()),
album_find(tag->album().stripWhiteSpace().to8Bit(true), tag->year()),
tags :: get_artist(tag->artist().stripWhiteSpace().to8Bit(true)),
tags :: get_genre(tag->genre().stripWhiteSpace().to8Bit(true)),
library, filepath,

View File

@ -69,7 +69,7 @@ void tags :: init_album_db()
db_load(&album_db);
}
struct album *tags :: get_album(const std::string &name, unsigned int year)
struct album *album_find(const std::string &name, unsigned int year)
{
return db_find(&album_db, make_key(name, year).c_str());
}

View File

@ -68,20 +68,12 @@ namespace tags
/** Called to read the album_db from disk. */
void init_album_db();
/**
* Called to look up an Album tag by name and year. If no
* existing tag is found a new one will be created and
* returned to the caller.
*
* @param name The name of the album.
* @param year The year of the album.
* @return A matching Album tag.
*/
struct album *get_album(const std::string &, unsigned int);
} /* Namespace: tags */
/* Called to find an album tag by name and year. */
struct album *album_find(const std::string &, unsigned int);
/* Called to get an album tag with a specific index. */
struct album *album_get(const unsigned int);

View File

@ -66,11 +66,11 @@ static void test_album_db()
struct album *album;
tags :: init_album_db();
album = tags :: get_album("Hyrule Symphony", 1998);
album = album_find("Hyrule Symphony", 1998);
test_verify_hyrule(album);
test_equal(tags :: get_album("Hyrule Symphony", 1998), album);
test_equal(album_find("Hyrule Symphony", 1998), album);
test_equal(album_get(0), album);
test_equal(album_get(1), (struct album *)NULL);

View File

@ -65,7 +65,7 @@ static void test_track_tag_constructor()
filter_init();
tags :: init();
album = tags :: get_album("Hyrule Symphony", 1998);
album = album_find("Hyrule Symphony", 1998);
artist = tags :: get_artist("Koji Kondo");
genre = tags :: get_genre("Video Game Music");
library = tags :: get_library(MUSIC_DIR);