core/tags/track: Move track_commit_db() out of tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
d3bdcf2edc
commit
eea0f57cf8
|
@ -137,7 +137,7 @@ static void scan_path(struct scan_info &scan)
|
||||||
name = g_dir_read_name(dir);
|
name = g_dir_read_name(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
tags :: commit_track_db();
|
track_db_commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void validate_library(struct library *&library)
|
static void validate_library(struct library *&library)
|
||||||
|
|
|
@ -100,7 +100,7 @@ void track :: played()
|
||||||
{
|
{
|
||||||
tr_count++;
|
tr_count++;
|
||||||
date_today(&tr_date);
|
date_today(&tr_date);
|
||||||
tags :: commit_track_db();
|
track_db_commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
int track :: compare_date(const struct track *rhs)
|
int track :: compare_date(const struct track *rhs)
|
||||||
|
@ -157,6 +157,11 @@ void track_db_deinit()
|
||||||
db_deinit(&track_db);
|
db_deinit(&track_db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void track_db_commit()
|
||||||
|
{
|
||||||
|
db_save(&track_db);
|
||||||
|
}
|
||||||
|
|
||||||
struct track *track_add(struct album *album, struct artist *artist,
|
struct track *track_add(struct album *album, struct artist *artist,
|
||||||
struct genre *genre, struct library *library,
|
struct genre *genre, struct library *library,
|
||||||
const std::string &filepath, const std::string &name,
|
const std::string &filepath, const std::string &name,
|
||||||
|
@ -182,7 +187,7 @@ void track_remove_all(struct library *library)
|
||||||
if (it->library() == library)
|
if (it->library() == library)
|
||||||
db_remove(&track_db, it);
|
db_remove(&track_db, it);
|
||||||
}
|
}
|
||||||
tags :: commit_track_db();
|
track_db_commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct track *track_get(const unsigned int index)
|
struct track *track_get(const unsigned int index)
|
||||||
|
@ -194,8 +199,3 @@ unsigned int tags :: track_size()
|
||||||
{
|
{
|
||||||
return db_actual_size(&track_db);
|
return db_actual_size(&track_db);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tags :: commit_track_db()
|
|
||||||
{
|
|
||||||
db_save(&track_db);
|
|
||||||
}
|
|
||||||
|
|
|
@ -124,9 +124,6 @@ namespace tags
|
||||||
* @return The Database::actual_size() of the track_db.
|
* @return The Database::actual_size() of the track_db.
|
||||||
*/
|
*/
|
||||||
unsigned int track_size();
|
unsigned int track_size();
|
||||||
|
|
||||||
/** Called to write the track_db to disk. */
|
|
||||||
void commit_track_db();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,6 +133,9 @@ void track_db_init();
|
||||||
/* Called to clean up the track database. */
|
/* Called to clean up the track database. */
|
||||||
void track_db_deinit();
|
void track_db_deinit();
|
||||||
|
|
||||||
|
/* Called to commit the track database. */
|
||||||
|
void track_db_commit();
|
||||||
|
|
||||||
/* Called to add a track tag to the database. */
|
/* Called to add a track tag to the database. */
|
||||||
struct track *track_add(struct album *, struct artist *, struct genre *,
|
struct track *track_add(struct album *, struct artist *, struct genre *,
|
||||||
struct library *, const std::string &,
|
struct library *, const std::string &,
|
||||||
|
|
|
@ -146,7 +146,7 @@ static void test_track_tag_lookup()
|
||||||
test_equal(track_get(a->index() + 2), (struct track *)NULL);
|
test_equal(track_get(a->index() + 2), (struct track *)NULL);
|
||||||
|
|
||||||
test_track_tag_load_db(0);
|
test_track_tag_load_db(0);
|
||||||
tags :: commit_track_db();
|
track_db_commit();
|
||||||
test_track_tag_load_db(2);
|
test_track_tag_load_db(2);
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ static void test_track_tag_lookup()
|
||||||
track_remove(a);
|
track_remove(a);
|
||||||
test_equal(track_get(index), (struct track *)NULL);
|
test_equal(track_get(index), (struct track *)NULL);
|
||||||
test_track_tag_load_db(2);
|
test_track_tag_load_db(2);
|
||||||
tags :: commit_track_db();
|
track_db_commit();
|
||||||
test_track_tag_load_db(1);
|
test_track_tag_load_db(1);
|
||||||
test_equal(library->li_size, (unsigned)1);
|
test_equal(library->li_size, (unsigned)1);
|
||||||
test_equal(tags :: track_size(), b->index() + 1);
|
test_equal(tags :: track_size(), b->index() + 1);
|
||||||
|
|
Loading…
Reference in New Issue