foobar2000 SDK
2015-08-03
|
#include <playlist_loader.h>
Public Member Functions | |
virtual bool | can_write ()=0 |
FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT (playlist_loader) | |
virtual const char * | get_extension ()=0 |
virtual bool | is_associatable ()=0 |
virtual bool | is_our_content_type (const char *p_content_type)=0 |
virtual void | open (const char *p_path, const service_ptr_t< file > &p_file, playlist_loader_callback::ptr p_callback, abort_callback &p_abort)=0 |
virtual void | write (const char *p_path, const service_ptr_t< file > &p_file, metadb_handle_list_cref p_data, abort_callback &p_abort)=0 |
Public Member Functions inherited from service_base | |
template<typename outPtr_t > | |
bool | cast (outPtr_t &outPtr) |
virtual int | service_add_ref ()=0 throw () |
virtual bool | service_query (service_ptr_t< service_base > &p_out, const GUID &p_guid) |
template<class T > | |
bool | service_query_t (service_ptr_t< T > &p_out) |
virtual int | service_release ()=0 throw () |
Static Public Member Functions | |
static void | g_load_playlist (const char *p_path, playlist_loader_callback::ptr p_callback, abort_callback &p_abort) |
static void | g_load_playlist_filehint (file::ptr fileHint, const char *p_path, playlist_loader_callback::ptr p_callback, abort_callback &p_abort) |
static void | g_process_path (const char *p_path, playlist_loader_callback::ptr p_callback, abort_callback &p_abort, playlist_loader_callback::t_entry_type p_type=playlist_loader_callback::entry_user_requested) |
static bool | g_process_path_ex (const char *p_path, playlist_loader_callback::ptr p_callback, abort_callback &p_abort, playlist_loader_callback::t_entry_type p_type=playlist_loader_callback::entry_user_requested) |
static void | g_save_playlist (const char *p_path, metadb_handle_list_cref p_data, abort_callback &p_abort) |
static bool | g_try_load_playlist (file::ptr fileHint, const char *p_path, playlist_loader_callback::ptr p_callback, abort_callback &p_abort) |
Additional Inherited Members | |
Public Types inherited from service_base | |
typedef service_base | t_interface |
Protected Member Functions inherited from service_base | |
service_base () | |
~service_base () | |
Service handling playlist file operations. There are multiple implementations handling different playlist formats; you can add new implementations to allow new custom playlist file formats to be read or written.
Also provides static helper functions for turning a filesystem path into a list of playable item locations.
Note that you should typically call playlist_incoming_item_filter methods instead of calling playlist_loader methods directly to get a list of playable items from a specified path; this way you get a core-implemented threading and abortable dialog displaying progress.
To register your own implementation, use playlist_loader_factory_t template.
To call existing implementations, use static helper methods of playlist_loader class.
Definition at line 66 of file playlist_loader.h.
|
pure virtual |
Returns whether this playlist_loader implementation supports writing. If can_write() returns false, all write() calls will fail.
playlist_loader::FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT | ( | playlist_loader | ) |
|
static |
Attempts to load a playlist file from specified filesystem path. Throws exception_io or derivatives on failure, exception_aborted on abort. If specified file is not a recognized playlist file, exception_io_unsupported_format is thrown.
Equivalent to g_load_playlist_filehint(NULL,p_path,p_callback).
p_path | Filesystem path to load playlist from, a UTF-8 encoded null-terminated string. |
p_callback | Callback object receiving enumerated playable item locations as well as signaling user aborting the operation. |
Definition at line 84 of file playlist_loader.cpp.
|
static |
Attempts to load a playlist file from specified filesystem path. Throws exception_io or derivatives on failure, exception_aborted on abort. If specified file is not a recognized playlist file, exception_io_unsupported_format is thrown.
p_path | Filesystem path to load playlist from, a UTF-8 encoded null-terminated string. |
p_callback | Callback object receiving enumerated playable item locations as well as signaling user aborting the operation. |
fileHint | File object to read from, can be NULL if not available. |
Definition at line 80 of file playlist_loader.cpp.
|
static |
Processes specified path to generate list of playable items. Includes recursive directory/archive enumeration.
Does not touch playlist files encountered - use g_process_path_ex() if specified path is possibly a playlist file; playlist files found inside directories or archives are ignored regardless.
Warning: caller must handle exceptions which will occur in case of I/O failure.
p_path | Filesystem path to process; a UTF-8 encoded null-terminated string. |
p_callback | Callback object receiving enumerated playable item locations as well as signaling user aborting the operation. |
p_type | Origin of p_path string. Reserved for internal use in recursive calls, should be left at default value; it controls various internal behaviors. |
Definition at line 270 of file playlist_loader.cpp.
|
static |
Calls attempts to process specified path as a playlist; if that fails (i.e. not a playlist), calls g_process_path with same parameters. See g_process_path for parameter descriptions.
Warning: caller must handle exceptions which will occur in case of I/O failure or playlist parsing failure.
Definition at line 308 of file playlist_loader.cpp.
|
static |
Saves specified list of locations into a playlist file. Throws exception_io or derivatives on failure, exception_aborted on abort.
p_path | Filesystem path to save playlist to, a UTF-8 encoded null-terminated string. |
p_data | List of items to save to playlist file. |
p_abort | abort_callback object signaling user aborting the operation. Note that aborting a save playlist operation will most likely leave user with corrupted/incomplete file. |
Definition at line 279 of file playlist_loader.cpp.
|
static |
Attempts to load a playlist file from specified filesystem path. Throws exception_io or derivatives on failure, exception_aborted on abort. If specified file is not a recognized playlist file, returns false; returns true upon successful playlist load.
p_path | Filesystem path to load playlist from, a UTF-8 encoded null-terminated string. |
p_callback | Callback object receiving enumerated playable item locations as well as signaling user aborting the operation. |
fileHint | File object to read from, can be NULL if not available. |
Definition at line 23 of file playlist_loader.cpp.
|
pure virtual |
Returns extension of file format handled by this playlist_loader implementation (a UTF-8 encoded null-terminated string).
|
pure virtual |
Returns whether playlist format extension supported by this implementation should be listed on file types associations page.
|
pure virtual |
Returns whether specified content type is one of playlist types supported by this playlist_loader implementation or not.
p_content_type | Content type to query, a UTF-8 encoded null-terminated string. |
|
pure virtual |
Parses specified playlist file into list of playable locations. Throws exception_io or derivatives on failure, exception_aborted on abort. If specified file is not a recognized playlist file, exception_io_unsupported_format is thrown.
p_path | Path of playlist file to parse. Used for relative path handling purposes (p_file parameter is used for actual file access). |
p_file | File interface to use for reading. Read/write pointer must be set to beginning by caller before calling. |
p_callback | Callback object receiving enumerated playable item locations. |
|
pure virtual |
Writes a playlist file containing specific item list to specified file. Will fail (pfc::exception_not_implemented) if specified playlist_loader is read-only (can_write() returns false).
p_path | Path of playlist file to write. Used for relative path handling purposes (p_file parameter is used for actual file access). |
p_file | File interface to use for writing. Caller should ensure that the file is empty (0 bytes long) before calling. |
p_data | List of items to save to playlist file. |
p_abort | abort_callback object signaling user aborting the operation. Note that aborting a save playlist operation will most likely leave user with corrupted/incomplete file. |