core/tags/library: Move library_db_init() out of the tags namespace
And add the function library_db_deinit(). Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
d7cff5faf4
commit
768f86e802
|
@ -67,12 +67,17 @@ void library :: dec_size()
|
|||
}
|
||||
|
||||
|
||||
void tags :: init_library_db()
|
||||
void library_db_init()
|
||||
{
|
||||
db_init(&library_db, "library.db", true);
|
||||
db_load(&library_db);
|
||||
}
|
||||
|
||||
void library_db_deinit()
|
||||
{
|
||||
db_deinit(&library_db);
|
||||
}
|
||||
|
||||
struct library *library_find(const std::string &path)
|
||||
{
|
||||
return db_find(&library_db, path.c_str());
|
||||
|
|
|
@ -13,6 +13,6 @@ void tags :: init()
|
|||
album_db_init();
|
||||
artist_db_init();
|
||||
genre_db_init();
|
||||
tags :: init_library_db();
|
||||
library_db_init();
|
||||
tags :: init_track_db();
|
||||
}
|
||||
|
|
|
@ -89,9 +89,6 @@ struct library : public DatabaseEntry {
|
|||
namespace tags
|
||||
{
|
||||
|
||||
/** Called to read the library_db from disk. */
|
||||
void init_library_db();
|
||||
|
||||
/**
|
||||
* Called to find the number of rows in the library_db,
|
||||
* including NULL rows.
|
||||
|
@ -99,9 +96,16 @@ namespace tags
|
|||
* @return The Database::actual_size() of the library_db.
|
||||
*/
|
||||
unsigned int library_size();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Called to initialize the library database. */
|
||||
void library_db_init();
|
||||
|
||||
/* Called to clean up the library database. */
|
||||
void library_db_deinit();
|
||||
|
||||
/* Called to find a library tag by library path. */
|
||||
struct library *library_find(const std::string &);
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ static void test_library_db()
|
|||
|
||||
test_equal(tags :: library_size(), 0);
|
||||
|
||||
tags :: init_library_db();
|
||||
library_db_init();
|
||||
library = library_find("/home/Zelda/Music");
|
||||
test_verify_zelda(library);
|
||||
|
||||
|
@ -95,6 +95,7 @@ static void test_library_db()
|
|||
test_equal(library_get(0), (struct library *)NULL);
|
||||
test_equal(tags :: library_size(), 1);
|
||||
|
||||
library_db_deinit();
|
||||
db_deinit(&library_db);
|
||||
db_load(&library_db);
|
||||
test_equal(library_db.db_size, 0);
|
||||
|
|
Loading…
Reference in New Issue