c34f0c160d
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
59 lines
1.6 KiB
C
59 lines
1.6 KiB
C
/*
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
*
|
|
* The Library tag is used to store a single directory added
|
|
* to Ocarina by the user.
|
|
*
|
|
* When writing a Library tag to disk, write out the library_enabled
|
|
* and library_path fields for each tag.
|
|
*
|
|
* ... true /home/Zelda/Music
|
|
* ... false /home/Link/Music
|
|
*/
|
|
#ifndef OCARINA_CORE_TAGS_LIBRARY_H
|
|
#define OCARINA_CORE_TAGS_LIBRARY_H
|
|
|
|
#include <core/containers/database.h>
|
|
|
|
struct library {
|
|
unsigned int li_size; /* This library's track count. */
|
|
bool li_enabled;/* True if this library is enabled. */
|
|
gchar *li_path; /* This library's root path. */
|
|
struct db_entry li_dbe;
|
|
};
|
|
|
|
#define LIBRARY(dbe) ((struct library *)DBE_DATA(dbe))
|
|
|
|
|
|
/* Called to initialize the library database. */
|
|
void library_db_init();
|
|
|
|
/* Called to clean up the library database. */
|
|
void library_db_deinit();
|
|
|
|
/* Called to access the library database. */
|
|
const struct database *library_db_get();
|
|
|
|
/* Called to find a library tag by library path. */
|
|
struct library *library_find(const gchar *);
|
|
|
|
/* Called to get a library tag with a specific index. */
|
|
struct library *library_get(const unsigned int);
|
|
|
|
/* Called to remove a specific library tag. */
|
|
void library_remove(struct library *);
|
|
|
|
/* Called to configure if the library tag is enabled. */
|
|
void library_set_enabled(struct library *, bool);
|
|
|
|
/*
|
|
* Called to find the full path of files under the library directory.
|
|
* This function allocates a new string that MUST be freed with g_free().
|
|
*/
|
|
gchar *library_file(struct library *, const gchar *);
|
|
|
|
#ifdef CONFIG_TESTING
|
|
const struct db_ops *test_library_ops();
|
|
#endif /* CONFIG_TESTING */
|
|
#endif /* OCARINA_CORE_TAGS_LIBRARY_H */
|