core/tags/library: Move library_find() out of the tags namespace

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-09-28 10:00:06 -04:00
parent e1093f7eab
commit a288922b65
5 changed files with 8 additions and 15 deletions

View File

@ -182,7 +182,7 @@ struct library *collection :: add(const std::string &dir)
if (g_file_test(dir.c_str(), G_FILE_TEST_IS_DIR) == false)
return library;
library = tags :: get_library(dir);
library = library_find(dir);
if (library)
update(library);
return library;

View File

@ -73,7 +73,7 @@ void tags :: init_library_db()
db_load(&library_db);
}
struct library *tags :: get_library(const std::string &path)
struct library *library_find(const std::string &path)
{
return db_find(&library_db, path.c_str());
}

View File

@ -92,16 +92,6 @@ namespace tags
/** Called to read the library_db from disk. */
void init_library_db();
/**
* Called to look up a Library tag by library path. If no
* existing tag is found a new one will be created and
* returned to the caller.
*
* @param path The path to the library directory on disk.
* @return A matching Library tag.
*/
struct library *get_library(const std::string &);
/**
* Called to remove a specific Library tag.
*
@ -119,6 +109,9 @@ namespace tags
}
/* Called to find a library tag by library path. */
struct library *library_find(const std::string &);
/* Called to get a library tag with a specific index. */
struct library *library_get(const unsigned int);

View File

@ -74,11 +74,11 @@ static void test_library_db()
test_equal(tags :: library_size(), 0);
tags :: init_library_db();
library = tags :: get_library("/home/Zelda/Music");
library = library_find("/home/Zelda/Music");
test_verify_zelda(library);
test_equal(tags :: library_size(), 1);
test_equal(tags :: get_library("/home/Zelda/Music"), library);
test_equal(library_find("/home/Zelda/Music"), library);
test_equal(library_get(0), library);
test_equal(library_get(1), (struct library *)NULL);

View File

@ -68,7 +68,7 @@ static void test_track_tag_constructor()
album = album_find("Hyrule Symphony", 1998);
artist = artist_find("Koji Kondo");
genre = genre_find("Video Game Music");
library = tags :: get_library(MUSIC_DIR);
library = library_find(MUSIC_DIR);
Track a(album, artist, genre, library,
"Hyrule Symphony/13 - Legend of Zelda Medley.mp3",