ocarina/include/core/library.h

81 lines
2.0 KiB
C++

/**
* Copyright 2013 (c) Anna Schumaker.
*/
#ifndef OCARINA_CORE_LIBRARY_H
#define OCARINA_CORE_LIBRARY_H
extern "C" {
#include <core/queue.h>
}
#include <string>
/**
* The Library is in charge of scanning and updating Library tags along
* with every other tag in the tag database. This code will also manage
* a special Queue used by the UI to display all enabled Tracks.
*
* The library queue is dynamic, so saving involves only storing the current
* flags and sort order.
*
* ... << flags << _sort_order.size()
* ... << _sort_order[N].field << _sort_order[N].ascending << ...
*/
namespace collection
{
void save(struct queue *, enum queue_flags);
/**
* Remove a Library tag from the database along with every
* Track associated with this library.
*
* @param library The library path that should be removed.
*/
void remove(struct library *);
/**
* First, scan over every Track in the database and remove
* tracks that no longer exist in the filesystem.
*
* Next, scan over every file in the Library's root directory
* and create new Track tags for every file found.
*
* @param library The library path that should be updated.
*/
void update(struct library *);
/**
* Call library :: update() on all Library tags.
*/
void update_all();
/**
* Use to enable or disable a library path. When a Library path
* is disabled, its tracks will be removed from the Library queue.
*
* @param library The library to be enabled or disabled.
* @param enabled Set to true if the library should be enabled,
* and false to disable it.
*/
void set_enabled(struct library *, bool);
/**
* Use to access the library queue.
*
* @return The queue of tracks currently in the library.
*/
queue *get_queue();
};
/* Called to initialize the collection manager. */
void collection_init(struct queue_ops *);
/* Called to add a new library directory to the collection manager. */
struct library *collection_add(const gchar *);
#endif /* OCARINA_CORE_LIBRARY_H */