diff options
Diffstat (limited to 'server/include/api_module_downloader.h')
-rw-r--r-- | server/include/api_module_downloader.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/server/include/api_module_downloader.h b/server/include/api_module_downloader.h index dbe0d14..dc31811 100644 --- a/server/include/api_module_downloader.h +++ b/server/include/api_module_downloader.h @@ -76,16 +76,18 @@ struct download_content_entry_s { //here is basic content entry description, thi struct download_s { - int id; - std::string name; //id generated via download_add or via session restore and it's unique for current session and current dowloader + int id; //id generated via download_add or via session restore and it's unique for current session and current dowloader + std::string name; int64_t size, downloaded, download_speed; //download size and size of downloaded data, also download speed all vars in bytes std::map<int, std::string> info_map; //any additional info provided by downloader module can be stored here std::list<download_content_entry_s> content; //download content can be set for download, structure described above + std::map<std::string, std::string> metadata; }; class module_downloader : public module_base { public: + //basic actions virtual int add_download(std::map<int, std::string> params) = 0; //add download, this function must return unique for current session and current downloader download id virtual bool stop_download(int download_id) = 0; //stop download by id received via add_download, return true on success, false otherwise virtual bool start_download(int download_id) = 0; //start download by id received via add_download, return true on success, false otherwise @@ -93,6 +95,14 @@ public: virtual bool execute_action_on_download(int download_id, int action_id) = 0; //execute module defined action on download, by id received via add_download virtual std::list<download_s> get_downloads(std::map<int, std::string> params = std::map<int, std::string>()) = 0; //this function must return list of downloads, additional options may be passed via params map virtual download_s get_download(int download_id, std::map<int, std::string> params = std::map<int, std::string>()) = 0; //same as above, except this one is for single download, not a complete list + //metadata manipulation (api for client specified metadata, unused by server itself, for example labels should be implemented using this api) + virtual bool metadata_set(int download_id, std::map<std::string, std::string> metadata) = 0; //replace download metadata with provided one + virtual bool metadata_update(int download_id, std::map<std::string, std::string> metadata) = 0; //updated matching metadata entries, create non existent + virtual bool metadata_drop(int download_id, std::string var = std::string()) = 0; //remove all metadata if no variable specified, otherwise delete specified variable + virtual std::map<std::string, std::string> metadata_get(int download_id) = 0; //get download metadata + virtual std::string metadata_get(int download_id, std::string var) = 0; //get value of specified metadata variable + + protected: downloader_module_info info; }; |