ocarina/include/core/library.h

84 lines
2.0 KiB
C++

/**
* Copyright 2013 (c) Anna Schumaker.
*/
#ifndef OCARINA_CORE_LIBRARY_H
#define OCARINA_CORE_LIBRARY_H
#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 library
{
/**
* Scan over every Track tag and add each enabled Track to the
* library queue.
*/
void init();
/**
* 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.
*/
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(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(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(Library *, bool);
/**
* Use to access the library queue.
*
* @return The queue of tracks currently in the library.
*/
Queue *get_queue();
};
#endif /* OCARINA_CORE_LIBRARY_H */