86 lines
2.1 KiB
C++
86 lines
2.1 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);
|
|
|
|
/**
|
|
* Add a new directory to the library.
|
|
*
|
|
* @param dir The directory that should be scanned.
|
|
* @return The newly created Library tag or NULL if a
|
|
* tag could not be created.
|
|
*/
|
|
struct library *add(const std::string &);
|
|
|
|
/**
|
|
* 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 *);
|
|
|
|
#endif /* OCARINA_CORE_LIBRARY_H */
|