library_manager Class Reference

#include <library_manager.h>

Inheritance diagram for library_manager:

service_base library_manager_v2 library_manager_v3

List of all members.

Public Types

typedef library_manager t_interface_entrypoint
typedef library_manager t_interface
typedef service_base t_interface_parent

Public Member Functions

virtual bool is_item_in_library (const metadb_handle_ptr &p_item)=0
 Returns whether the specified item is in the Media Library or not.
virtual bool is_item_addable (const metadb_handle_ptr &p_item)=0
 Returns whether current user settings allow the specified item to be added to the Media Library or not.
virtual bool is_path_addable (const char *p_path)=0
 Returns whether current user settings allow the specified item path to be added to the Media Library or not.
virtual bool get_relative_path (const metadb_handle_ptr &p_item, pfc::string_base &p_out)=0
virtual void enum_items (enum_callback &p_callback)=0
 Calls callback method for every item in the Media Library. Note that order of items in Media Library is undefined.
virtual void add_items (const pfc::list_base_const_t< metadb_handle_ptr > &p_data)=0
virtual void remove_items (const pfc::list_base_const_t< metadb_handle_ptr > &p_data)=0
virtual void add_items_async (const pfc::list_base_const_t< metadb_handle_ptr > &p_data)=0
virtual void on_files_deleted_sorted (const pfc::list_base_const_t< const char * > &p_data)=0
virtual void get_all_items (pfc::list_base_t< metadb_handle_ptr > &p_out)=0
 Retrieves the entire Media Library content.
virtual bool is_library_enabled ()=0
 Returns whether Media Library functionality is enabled or not (to be exact: whether there's at least one Media Library folder present in settings), for e.g. notifying the user to change settings when trying to use a Media Library viewer without having configured the Media Library first.
virtual void show_preferences ()=0
 Pops up the Media Library preferences page.
virtual void rescan ()=0
virtual void check_dead_entries (const pfc::list_base_t< metadb_handle_ptr > &p_list)=0

Static Public Attributes

static const GUID class_guid

Classes

class  enum_callback
 Interface for use with library_manager::enum_items(). More...


Detailed Description

This service implements methods allowing you to interact with the Media Library.
All methods are valid from main thread only, unless noted otherwise.
To avoid race conditions, methods that alter library contents should not be called from inside global callbacks.
Usage: Use static_api_ptr_t<library_manager> to instantiate.

Future compatibility notes:
In 0.9.6, the Media Library backend will be entirely reimplemented to perform tracking of folder content changes on its own. This API will still be provided for backwards compatibility, though most of methods will become stubs as their original purpose will be no longer valid.
To keep your component working sanely in future foobar2000 releases, do not depend on functions flagged as scheduled to be dropped - you can still call them, but keep in mind that they will become meaningless in the next major release.


Member Typedef Documentation

Reimplemented from service_base.

Reimplemented in library_manager_v2, and library_manager_v3.

Reimplemented in library_manager_v2, and library_manager_v3.


Member Function Documentation

virtual bool library_manager::is_item_in_library ( const metadb_handle_ptr p_item  )  [pure virtual]

Returns whether the specified item is in the Media Library or not.

virtual bool library_manager::is_item_addable ( const metadb_handle_ptr p_item  )  [pure virtual]

Returns whether current user settings allow the specified item to be added to the Media Library or not.

virtual bool library_manager::is_path_addable ( const char *  p_path  )  [pure virtual]

Returns whether current user settings allow the specified item path to be added to the Media Library or not.

virtual bool library_manager::get_relative_path ( const metadb_handle_ptr p_item,
pfc::string_base p_out 
) [pure virtual]

Retrieves path of the specified item relative to the Media Library folder it is in. Returns true on success, false when the item is not in the Media Library. SPECIAL WARNING: to allow multi-CPU optimizations to parse relative track paths, this API works in threads other than the main app thread. Main thread MUST be blocked while working in such scenarios, it's NOT safe to call from worker threads while the Media Library content/configuration might be getting altered.

virtual void library_manager::enum_items ( enum_callback p_callback  )  [pure virtual]

Calls callback method for every item in the Media Library. Note that order of items in Media Library is undefined.

virtual void library_manager::add_items ( const pfc::list_base_const_t< metadb_handle_ptr > &  p_data  )  [pure virtual]

Scheduled to be dropped in 0.9.6 (will do nothing).
Adds specified items to the Media Library (items actually added will be filtered according to user settings).

virtual void library_manager::remove_items ( const pfc::list_base_const_t< metadb_handle_ptr > &  p_data  )  [pure virtual]

Scheduled to be dropped in 0.9.6 (will do nothing).
Removes specified items from the Media Library (does nothing if specific item is not in the Media Library).

virtual void library_manager::add_items_async ( const pfc::list_base_const_t< metadb_handle_ptr > &  p_data  )  [pure virtual]

Scheduled to be dropped in 0.9.6 (will do nothing).
Adds specified items to the Media Library (items actually added will be filtered according to user settings). The difference between this and add_items() is that items are not added immediately; the operation is queued and executed later, so it is safe to call from e.g. global callbacks.

virtual void library_manager::on_files_deleted_sorted ( const pfc::list_base_const_t< const char * > &  p_data  )  [pure virtual]

Scheduled to be dropped in 0.9.6 (will do nothing).
For internal use only; p_data must be sorted by metadb::path_compare; use file_operation_callback static methods instead of calling this directly.

virtual void library_manager::get_all_items ( pfc::list_base_t< metadb_handle_ptr > &  p_out  )  [pure virtual]

Retrieves the entire Media Library content.

virtual bool library_manager::is_library_enabled (  )  [pure virtual]

Returns whether Media Library functionality is enabled or not (to be exact: whether there's at least one Media Library folder present in settings), for e.g. notifying the user to change settings when trying to use a Media Library viewer without having configured the Media Library first.

virtual void library_manager::show_preferences (  )  [pure virtual]

Pops up the Media Library preferences page.

virtual void library_manager::rescan (  )  [pure virtual]

Scheduled to be dropped in 0.9.6.
Rescans user-specified Media Library directories for new files and removes references to files that no longer exist from the Media Library.
Note that this function creates modal dialog and does not return until the operation has completed.

Deprecated:
Use library_manager_v2::rescan_async() when possible.

virtual void library_manager::check_dead_entries ( const pfc::list_base_t< metadb_handle_ptr > &  p_list  )  [pure virtual]

Scheduled to be dropped in 0.9.6.
Hints Media Library about possible dead items, typically used for "remove dead entries" context action in ML viewers. The implementation will verify whether the items are actually dead before ML contents are altered.
Note that this function creates modal dialog and does not return until the operation has completed.

Deprecated:
Use library_manager_v2::rescan_async() when possible.


Member Data Documentation

const GUID library_manager::class_guid [static]

Initial value:

 
{ 0xfebd85b5, 0xc12d, 0x45b5, { 0xb5, 0x5d, 0xd, 0x3f, 0x43, 0x2b, 0xc, 0x6b } }

Reimplemented in library_manager_v2, and library_manager_v3.


The documentation for this class was generated from the following files:

Generated on Thu Aug 28 21:15:52 2008 for foobar2000 SDK by  doxygen 1.5.5