core/tags/library: Remove unused li_size variable
This was used to display the number of tracks in each library path. We can use playlist functions to get this information now. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
30cebb4a45
commit
85bfe717dd
|
@ -12,7 +12,6 @@ static struct library *__library_alloc(gchar *path)
|
||||||
struct library *library = g_malloc(sizeof(struct library));
|
struct library *library = g_malloc(sizeof(struct library));
|
||||||
|
|
||||||
dbe_init(&library->li_dbe, library);
|
dbe_init(&library->li_dbe, library);
|
||||||
library->li_size = 0;
|
|
||||||
library->li_path = path;
|
library->li_path = path;
|
||||||
library->li_playlist = NULL;
|
library->li_playlist = NULL;
|
||||||
|
|
||||||
|
|
|
@ -100,8 +100,6 @@ static void track_free(struct db_entry *dbe)
|
||||||
play_count -= track->tr_count;
|
play_count -= track->tr_count;
|
||||||
if (track->tr_count == 0)
|
if (track->tr_count == 0)
|
||||||
unplayed_count--;
|
unplayed_count--;
|
||||||
if (track->tr_library)
|
|
||||||
track->tr_library->li_size--;
|
|
||||||
|
|
||||||
g_strfreev(track->tr_tokens);
|
g_strfreev(track->tr_tokens);
|
||||||
g_strfreev(track->tr_alts);
|
g_strfreev(track->tr_alts);
|
||||||
|
@ -111,8 +109,6 @@ static void track_free(struct db_entry *dbe)
|
||||||
|
|
||||||
static void track_setup(struct db_entry *dbe)
|
static void track_setup(struct db_entry *dbe)
|
||||||
{
|
{
|
||||||
struct track *track = TRACK(dbe);
|
|
||||||
track->tr_library->li_size++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *track_key(struct db_entry *dbe)
|
static gchar *track_key(struct db_entry *dbe)
|
||||||
|
|
|
@ -16,10 +16,9 @@
|
||||||
#include <core/database.h>
|
#include <core/database.h>
|
||||||
|
|
||||||
struct library {
|
struct library {
|
||||||
unsigned int li_size; /* This library's track count. */
|
gchar *li_path; /* This library's root path. */
|
||||||
gchar *li_path; /* This library's root path. */
|
void *li_playlist; /* This library's associated playlist. */
|
||||||
void *li_playlist; /* This library's associated playlist. */
|
struct db_entry li_dbe;
|
||||||
struct db_entry li_dbe;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LIBRARY(dbe) ((struct library *)DBE_DATA(dbe))
|
#define LIBRARY(dbe) ((struct library *)DBE_DATA(dbe))
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
static void test_verify_zelda(struct library *library)
|
static void test_verify_zelda(struct library *library)
|
||||||
{
|
{
|
||||||
const struct db_ops *library_ops = test_library_ops();
|
const struct db_ops *library_ops = test_library_ops();
|
||||||
g_assert_cmpuint(library->li_size, ==, 0);
|
|
||||||
g_assert_null(library->li_playlist);
|
g_assert_null(library->li_playlist);
|
||||||
g_assert_cmpstr(library_ops->dbe_key(&library->li_dbe), ==, "/home/Zelda/Music");
|
g_assert_cmpstr(library_ops->dbe_key(&library->li_dbe), ==, "/home/Zelda/Music");
|
||||||
}
|
}
|
||||||
|
@ -15,7 +14,6 @@ static void test_verify_zelda(struct library *library)
|
||||||
static void test_verify_link(struct library *library)
|
static void test_verify_link(struct library *library)
|
||||||
{
|
{
|
||||||
const struct db_ops *library_ops = test_library_ops();
|
const struct db_ops *library_ops = test_library_ops();
|
||||||
g_assert_cmpuint(library->li_size, ==, 0);
|
|
||||||
g_assert_null(library->li_playlist);
|
g_assert_null(library->li_playlist);
|
||||||
g_assert_cmpstr(library_ops->dbe_key(&library->li_dbe), ==, "/home/Link/Music");
|
g_assert_cmpstr(library_ops->dbe_key(&library->li_dbe), ==, "/home/Link/Music");
|
||||||
}
|
}
|
||||||
|
@ -32,9 +30,6 @@ static void test_library()
|
||||||
test_verify_link(link);
|
test_verify_link(link);
|
||||||
test_verify_zelda(zelda);
|
test_verify_zelda(zelda);
|
||||||
|
|
||||||
link->li_size = 21;
|
|
||||||
zelda->li_size = 42;
|
|
||||||
|
|
||||||
file_init(&f, "library_tag", 0, 0);
|
file_init(&f, "library_tag", 0, 0);
|
||||||
file_open(&f, OPEN_WRITE);
|
file_open(&f, OPEN_WRITE);
|
||||||
library_ops->dbe_write(&f, &link->li_dbe);
|
library_ops->dbe_write(&f, &link->li_dbe);
|
||||||
|
|
|
@ -71,21 +71,19 @@ static void test_track()
|
||||||
const struct db_ops *track_ops = test_track_ops();
|
const struct db_ops *track_ops = test_track_ops();
|
||||||
time_t rawtime = time(NULL);
|
time_t rawtime = time(NULL);
|
||||||
struct tm *now = localtime(&rawtime);
|
struct tm *now = localtime(&rawtime);
|
||||||
struct library *library;
|
|
||||||
struct track *track;
|
struct track *track;
|
||||||
struct file f;
|
struct file f;
|
||||||
gchar *date;
|
gchar *date;
|
||||||
|
|
||||||
file_init(&f, "track_tag", 1, 1);
|
file_init(&f, "track_tag", 1, 1);
|
||||||
date = string_tm2str(now);
|
g_assert_nonnull(library_find("tests/Music"));
|
||||||
library = library_find("tests/Music");
|
date = string_tm2str(now);
|
||||||
|
|
||||||
track = test_alloc("0/Hyrule Symphony/01 - Title Theme.ogg");
|
track = test_alloc("0/Hyrule Symphony/01 - Title Theme.ogg");
|
||||||
g_assert_nonnull(track);
|
g_assert_nonnull(track);
|
||||||
track->tr_dbe.dbe_index = 0;
|
track->tr_dbe.dbe_index = 0;
|
||||||
track_ops->dbe_setup(&track->tr_dbe);
|
track_ops->dbe_setup(&track->tr_dbe);
|
||||||
test_verify_track(track);
|
test_verify_track(track);
|
||||||
g_assert_cmpuint(library->li_size, ==, 1);
|
|
||||||
|
|
||||||
g_assert_true( track_match_token(track, "title"));
|
g_assert_true( track_match_token(track, "title"));
|
||||||
g_assert_true( track_match_token(track, "theme"));
|
g_assert_true( track_match_token(track, "theme"));
|
||||||
|
@ -99,14 +97,12 @@ static void test_track()
|
||||||
|
|
||||||
g_free(track->tr_path);
|
g_free(track->tr_path);
|
||||||
track_ops->dbe_free(&track->tr_dbe);
|
track_ops->dbe_free(&track->tr_dbe);
|
||||||
g_assert_cmpuint(library->li_size, ==, 0);
|
|
||||||
|
|
||||||
file_open(&f, OPEN_READ);
|
file_open(&f, OPEN_READ);
|
||||||
track = TRACK(track_ops->dbe_read(&f));
|
track = TRACK(track_ops->dbe_read(&f));
|
||||||
track->tr_dbe.dbe_index = 0;
|
track->tr_dbe.dbe_index = 0;
|
||||||
track_ops->dbe_setup(&track->tr_dbe);
|
track_ops->dbe_setup(&track->tr_dbe);
|
||||||
test_verify_notrack(track);
|
test_verify_notrack(track);
|
||||||
g_assert_cmpuint(library->li_size, ==, 1);
|
|
||||||
|
|
||||||
g_free(track->tr_path);
|
g_free(track->tr_path);
|
||||||
track_ops->dbe_free(&track->tr_dbe);
|
track_ops->dbe_free(&track->tr_dbe);
|
||||||
|
@ -115,7 +111,6 @@ static void test_track()
|
||||||
track->tr_dbe.dbe_index = 0;
|
track->tr_dbe.dbe_index = 0;
|
||||||
track_ops->dbe_setup(&track->tr_dbe);
|
track_ops->dbe_setup(&track->tr_dbe);
|
||||||
test_verify_track(track);
|
test_verify_track(track);
|
||||||
g_assert_cmpuint(library->li_size, ==, 1);
|
|
||||||
file_close(&f);
|
file_close(&f);
|
||||||
|
|
||||||
track_played(track);
|
track_played(track);
|
||||||
|
|
Loading…
Reference in New Issue