core/tags/library: Move library_find() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
e1093f7eab
commit
a288922b65
|
@ -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)
|
if (g_file_test(dir.c_str(), G_FILE_TEST_IS_DIR) == false)
|
||||||
return library;
|
return library;
|
||||||
|
|
||||||
library = tags :: get_library(dir);
|
library = library_find(dir);
|
||||||
if (library)
|
if (library)
|
||||||
update(library);
|
update(library);
|
||||||
return library;
|
return library;
|
||||||
|
|
|
@ -73,7 +73,7 @@ void tags :: init_library_db()
|
||||||
db_load(&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());
|
return db_find(&library_db, path.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,16 +92,6 @@ namespace tags
|
||||||
/** Called to read the library_db from disk. */
|
/** Called to read the library_db from disk. */
|
||||||
void init_library_db();
|
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.
|
* 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. */
|
/* Called to get a library tag with a specific index. */
|
||||||
struct library *library_get(const unsigned int);
|
struct library *library_get(const unsigned int);
|
||||||
|
|
||||||
|
|
|
@ -74,11 +74,11 @@ static void test_library_db()
|
||||||
test_equal(tags :: library_size(), 0);
|
test_equal(tags :: library_size(), 0);
|
||||||
|
|
||||||
tags :: init_library_db();
|
tags :: init_library_db();
|
||||||
library = tags :: get_library("/home/Zelda/Music");
|
library = library_find("/home/Zelda/Music");
|
||||||
test_verify_zelda(library);
|
test_verify_zelda(library);
|
||||||
|
|
||||||
test_equal(tags :: library_size(), 1);
|
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(0), library);
|
||||||
test_equal(library_get(1), (struct library *)NULL);
|
test_equal(library_get(1), (struct library *)NULL);
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ static void test_track_tag_constructor()
|
||||||
album = album_find("Hyrule Symphony", 1998);
|
album = album_find("Hyrule Symphony", 1998);
|
||||||
artist = artist_find("Koji Kondo");
|
artist = artist_find("Koji Kondo");
|
||||||
genre = genre_find("Video Game Music");
|
genre = genre_find("Video Game Music");
|
||||||
library = tags :: get_library(MUSIC_DIR);
|
library = library_find(MUSIC_DIR);
|
||||||
|
|
||||||
Track a(album, artist, genre, library,
|
Track a(album, artist, genre, library,
|
||||||
"Hyrule Symphony/13 - Legend of Zelda Medley.mp3",
|
"Hyrule Symphony/13 - Legend of Zelda Medley.mp3",
|
||||||
|
|
Loading…
Reference in New Issue