foobar2000 SDK  2015-08-03
playlist_loader.h
Go to the documentation of this file.
1 #if FOOBAR2000_TARGET_VERSION >= 76
2 class NOVTABLE playlist_loader_callback : public service_base {
5  FB2K_MAKE_SERVICE_INTERFACE(playlist_loader_callback, service_base)
6 public:
8  enum t_entry_type {
10  entry_user_requested,
12  entry_directory_enumerated,
14  entry_from_playlist,
15  };
17  virtual void on_progress(const char * p_path) = 0;
18 
24  virtual void on_entry(const metadb_handle_ptr & p_item,t_entry_type p_type,const t_filestats & p_stats,bool p_fresh) = 0;
30  virtual bool want_info(const metadb_handle_ptr & p_item,t_entry_type p_type,const t_filestats & p_stats,bool p_fresh) = 0;
37  virtual void on_entry_info(const metadb_handle_ptr & p_item,t_entry_type p_type,const t_filestats & p_stats,const file_info & p_info,bool p_fresh) = 0;
38 
40  virtual void handle_create(metadb_handle_ptr & p_out,const playable_location & p_location) = 0;
41 
44  virtual bool is_path_wanted(const char * path, t_entry_type type) = 0;
45 
46  virtual bool want_browse_info(const metadb_handle_ptr & p_item,t_entry_type p_type,t_filetimestamp ts) = 0;
47  virtual void on_browse_info(const metadb_handle_ptr & p_item,t_entry_type p_type,const file_info & info, t_filetimestamp ts) = 0;
48 };
49 
53  FB2K_MAKE_SERVICE_INTERFACE(playlist_loader_callback_v2, playlist_loader_callback)
54 public:
55  virtual void on_entry_info_v2(const metadb_handle_ptr & p_item,t_entry_type p_type,metadb_info_container::ptr info,bool p_fresh) = 0;
56  virtual void on_browse_info_v2(const metadb_handle_ptr & p_item,t_entry_type p_type,metadb_info_container::ptr info) = 0;
57 private:
58 };
59 
60 
66 class NOVTABLE playlist_loader : public service_base {
67 public:
72  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;
78  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;
80  virtual const char * get_extension() = 0;
82  virtual bool can_write() = 0;
85  virtual bool is_our_content_type(const char* p_content_type) = 0;
87  virtual bool is_associatable() = 0;
88 
93  static void g_load_playlist(const char * p_path,playlist_loader_callback::ptr p_callback, abort_callback & p_abort);
94 
99  static void g_load_playlist_filehint(file::ptr fileHint,const char * p_path,playlist_loader_callback::ptr p_callback, abort_callback & p_abort);
100 
105  static bool g_try_load_playlist(file::ptr fileHint,const char * p_path,playlist_loader_callback::ptr p_callback, abort_callback & p_abort);
106 
111  static void g_save_playlist(const char * p_path,metadb_handle_list_cref p_data,abort_callback & p_abort);
112 
119  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);
120 
124  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);
125 
126  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(playlist_loader);
127 };
128 
129 template<typename t_myclass>
131 
132 #endif
void info(const char *p_message)
Definition: console.cpp:4
Main interface class for information about some playable object.
Definition: file_info.h:73
Base class for all service classes. Provides interfaces for reference counter and querying for differ...
Definition: service.h:333
Service handling playlist file operations. There are multiple implementations handling different play...
void write(const service_ptr_t< file > &p_file, abort_callback &p_abort, const char *p_string, bool is_utf8)
t_uint64 t_filetimestamp
Type used for file timestamp related variables. 64-bit value representing the number of 100-nanosecon...
Definition: filesystem.h:12
Callback interface receiving item locations from playlist loader. Typically, you call one of standar...