unidown.plugin.a_plugin¶
Functions
Get all available plugins for unidown. |
Classes
|
Abstract class of a plugin. |
- class APlugin(settings, options=None)[source]¶
Bases:
ABC
Abstract class of a plugin. Provides all needed variables and methods.
- Parameters
- Raises
PluginError – Can not create default plugin paths.
- _SAVESTATE_CLS¶
Savestate class to use.
- Parameters
plugin_info (
PluginInfo
) –last_update (
datetime
) –link_items (
LinkItemDict
) –version (
Version
) –
alias of
SaveState
- abstract _create_download_data()[source]¶
Get the download links in a specific format.
Note
Has to be implemented inside Plugins.
- Raises
NotImplementedError – Abstract method.
- Return type
- abstract _create_last_update_time()[source]¶
Get the newest update time from the referencing data.
Note
Has to be implemented inside Plugin.
- Raises
NotImplementedError – Abstract method.
- Return type
- _load_default_options()[source]¶
Load default options if they were not passed at creation.
- Return type
- check_download(link_item_dict, folder, log=False)[source]¶
Check if the download of the given dict was successful. No proving if the content of the file is correct too.
- Parameters
link_item_dict (
LinkItemDict
) – Items to check.folder (
Path
) – Folder where the downloads are saved.log (
bool
) – Log lost items.
- Return type
- Returns
Succeed.
- download(link_items, folder, desc, unit)[source]¶
Download the given LinkItem dict from the plugins host, to the given path. Proceeded with multiple connections.
_simul_downloads
. Aftercheck_download()
is recommended.This function don’t use an internal link_item_dict, delay or folder directly set in options or instance vars, because it can be used aside of the normal download routine inside the plugin itself for own things. As of this it still needs access to the logger, so a staticmethod is not possible.
Warning
The parameters may change in future versions. (e.g. change order and accept another host)
- Parameters
link_items (
LinkItemDict
) – Data which gets downloaded.folder (
Path
) – Target download folder.desc (
str
) – Description of the progressbar.unit (
str
) – Unit of the download, shown in the progressbar.
- Return type
- download_as_file(url, target_file, delay=0)[source]¶
Download the given url to the given target folder.
- load_savestate()[source]¶
Load the save of the plugin.
- Raises
PluginError – Broken savestate json.
PluginError – Different savestate versions.
PluginError – Different plugin versions.
PluginError – Different plugin names.
PluginError – Could not parse the json.
- Return type
- save_savestate()[source]¶
Save meta data about the downloaded things and the plugin to a file.
- Return type
- update_download_data()[source]¶
Update the download links. Calls
_create_download_data()
.- Return type
- update_last_update()[source]¶
Call this to update the latest update time. Calls
_create_last_update_time()
.- Return type
- update_savestate(new_items)[source]¶
Update savestate.
- Parameters
new_items (
LinkItemDict
) – New items.- Return type
- _INFO: PluginInfo = <unidown.plugin.plugin_info.PluginInfo object>¶
Meta information about the plugin.
- _abc_impl = <_abc._abc_data object>¶
- _download_data: LinkItemDict¶
Referencing data.
- _downloader: HTTPSConnectionPool¶
Downloader which will download the data.
- _options: dict[str, Any]¶
Options which the plugin uses internally, should be used for the given options at initialization.
- property download_data: LinkItemDict¶
Plain getter.
- Return type
- property info: PluginInfo¶
Plain getter.
- Return type