core/tags/track: Move track_db_init() out of the tags namespace

And add the functions track_db_deinit() and tags :: db_deinit().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-10-25 04:46:56 -04:00
parent d0ec3e2cac
commit d3bdcf2edc
4 changed files with 23 additions and 5 deletions

View File

@ -14,5 +14,14 @@ void tags :: init()
artist_db_init();
genre_db_init();
library_db_init();
tags :: init_track_db();
track_db_init();
}
void tags :: deinit()
{
track_db_deinit();
library_db_deinit();
genre_db_deinit();
artist_db_deinit();
album_db_deinit();
}

View File

@ -146,12 +146,17 @@ void track :: write(file &file)
}
void tags :: init_track_db()
void track_db_init()
{
db_init(&track_db, "track.db", false);
db_load(&track_db);
}
void track_db_deinit()
{
db_deinit(&track_db);
}
struct track *track_add(struct album *album, struct artist *artist,
struct genre *genre, struct library *library,
const std::string &filepath, const std::string &name,

View File

@ -12,6 +12,7 @@ namespace tags
/** Called to read all databases from disk. */
void init();
void deinit();
}

View File

@ -117,9 +117,6 @@ struct track : public GenericTag {
namespace tags
{
/** Called to read the track_db from disk. */
void init_track_db();
/**
* Called to find the number of rows in the track_db,
* including NULL rows.
@ -133,6 +130,12 @@ namespace tags
}
/* Called to initialize the track database. */
void track_db_init();
/* Called to clean up the track database. */
void track_db_deinit();
/* Called to add a track tag to the database. */
struct track *track_add(struct album *, struct artist *, struct genre *,
struct library *, const std::string &,