core/tags/genre: Move genre_find() out of the tags namespace

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-09-28 08:22:51 -04:00
parent c611eb306d
commit 9522da88d0
5 changed files with 8 additions and 15 deletions

View File

@ -98,7 +98,7 @@ static void tag_track(Library *library, const std::string &filepath)
track = tags :: add_track( track = tags :: add_track(
album_find(tag->album().stripWhiteSpace().to8Bit(true), tag->year()), album_find(tag->album().stripWhiteSpace().to8Bit(true), tag->year()),
artist_find(tag->artist().stripWhiteSpace().to8Bit(true)), artist_find(tag->artist().stripWhiteSpace().to8Bit(true)),
tags :: get_genre(tag->genre().stripWhiteSpace().to8Bit(true)), genre_find(tag->genre().stripWhiteSpace().to8Bit(true)),
library, filepath, library, filepath,
tag->title().stripWhiteSpace().to8Bit(true), tag->title().stripWhiteSpace().to8Bit(true),
audio->length(), tag->track() audio->length(), tag->track()

View File

@ -21,7 +21,7 @@ void tags :: init_genre_db()
db_load(&genre_db); db_load(&genre_db);
} }
struct genre *tags :: get_genre(const std::string &name) struct genre *genre_find(const std::string &name)
{ {
return db_find(&genre_db, name.c_str()); return db_find(&genre_db, name.c_str());
} }

View File

@ -28,19 +28,12 @@ namespace tags
/** Called to read the genre_db from disk. */ /** Called to read the genre_db from disk. */
void init_genre_db(); void init_genre_db();
/**
* Called to look up a Genre tag by name. If no existing
* tag is found a new one will be created and returned to
* the caller.
*
* @param name The name of the genre.
* @return A matching Genre tag.
*/
struct genre *get_genre(const std::string &);
} }
/* Called to find a genre tag by name. */
struct genre *genre_find(const std::string &);
/* Called to get a genre tag with a specific index. */ /* Called to get a genre tag with a specific index. */
struct genre *genre_get(const unsigned int); struct genre *genre_get(const unsigned int);

View File

@ -67,11 +67,11 @@ static void test_genere_db()
struct genre *genre; struct genre *genre;
tags :: init_genre_db(); tags :: init_genre_db();
genre = tags :: get_genre("Video Game Music"); genre = genre_find("Video Game Music");
test_verify_vg(genre); test_verify_vg(genre);
test_equal(tags :: get_genre("Video Game Music"), genre); test_equal(genre_find("Video Game Music"), genre);
test_equal(genre_get(0), genre); test_equal(genre_get(0), genre);
test_equal(genre_get(1), (struct genre *)NULL); test_equal(genre_get(1), (struct genre *)NULL);

View File

@ -67,7 +67,7 @@ static void test_track_tag_constructor()
tags :: init(); tags :: init();
album = album_find("Hyrule Symphony", 1998); album = album_find("Hyrule Symphony", 1998);
artist = artist_find("Koji Kondo"); artist = artist_find("Koji Kondo");
genre = tags :: get_genre("Video Game Music"); genre = genre_find("Video Game Music");
library = tags :: get_library(MUSIC_DIR); library = tags :: get_library(MUSIC_DIR);
Track a(album, artist, genre, library, Track a(album, artist, genre, library,