wyvern.abstract¶
Abstract Classes Module.
Contains the abstract classes used by the project.
- class wyvern.abstract.Artisan¶
Artisan Base Class.
This class creates a singular job based off of a request (eg downloading a specific video from a site)
- class wyvern.abstract.DataStore(plugin_id: str, config_str: str)¶
Data Store Class.
- Parameters:
plugin_id – The ID of the Factory or Artisan providing jobs.
config_str – The configuration string (meaning defined by inheriting constructor.)
This class is mainly for type hinting with the following defined.
__getitem__()Get the stored value.__setitem__()Set the stored value
These functions should call to the store directly (without caching). This avoids the case where there are multiple nodes downloading causing a race condition.
- class wyvern.abstract.Factory¶
Factory Base Class.
This class creates a number of jobs (eg downloading all owned products on a site)
- abstract load_jobs(manager: Manager) None¶
Load the jobs.
This is the main function of the downloader. It loads in jobs from the source and adds them to the queue with
add_job(). These jobs can be jobs to load in more jobs, but this practice should be avoided if at all possible. Adding jobs should be designed in such a way that a job can be starting to be downloaded while later jobs are being added (eg loading in later pages of results).
- class wyvern.abstract.Job¶
Job Base Class.
This class represents a job’s data.
- abstract do_download(manager: Manager) None¶
Run the download.
This function will execute the download of the job, updating
statusandprogressas appropriate.
- name: str¶
The Name of the job (should be displayed in the UI)
- progress: float = 0.0¶
The progress through the download. Valid values are between 0 and 1
- abstract should_skip(manager: Manager) bool¶
Work out if the job should be skipped.
This should check if the file already exists in the destination folder.
- status: str | Exception¶
Status during the Download (eg Downloading, Extracting etc), or if the job failed, the exception it raised.
- sub_jobs: Queue[Job] | None¶
Sub Jobs Created as part of the job processing.
Jobs may be added to the queue before the current job has completed. Care should be taken to avoid race conditions on secrets or filesand depth-first themed non-terminations.
- updated: Event = <threading.Event at 0x7fe0c4ecccd0: unset>¶
Event to be called when the externally visible members are updated.
- url: str | None¶
URL of the job.
- class wyvern.abstract.Manager¶
Manager Class.
The
configurationandsecretsvariables are specific to theFactoryorArtisanwhich created the job.- abstract add_job(job: Job | None) None¶
Add a job object to the queue.
This will add to the queue of jobs to be executed directly after this.