upsies.jobs.poster
Find, download and re-upload poster for movie, series or season
Classes
- class upsies.jobs.poster.PosterJob(*, home_directory=None, cache_directory=None, cache_id='', ignore_cache=False, no_output_is_ok=False, hidden=False, autostart=True, guaranteed=False, precondition=None, prejobs=(), callbacks={}, **kwargs)[source]
Bases:
JobBaseGet poster and optionally resize and reupload it
This job adds the following signals to
signal:obtainingEmitted when getting a poster is attempted. Registered callbacks get no arguments.
obtainedEmitted when a poster was successfully obtained. Registered callbacks get the poster file path or URL as a positional argument.
downloadingEmitted when downloading a poster is attempted. Registered callbacks get the poster URL as a positional argument.
downloadedEmitted when a poster was successfully downloaded. Registered callbacks get the poster URL as a positional argument.
resizingEmitted when resizing a poster is attempted. Registered callbacks get the original poster file path as a positional argument.
resizedEmitted when a poster was successfully resized. Registered callbacks get the resized poster file path as a positional argument.
uploadingEmitted when uploading a poster to an image hosting service is attempted. Registered callbacks get the relevant
ImagehostBasesubclass as a positional argument.uploadedEmitted when a poster was successfully uploaded to an image hosting service. Registered callbacks get the URL of the uploaded poster as a positional argument.
- cache_id = None
- initialize(*, getter, width=None, height=None, write_to=None, imagehosts=())[source]
Set internal state
- Parameters:
getter – Coroutine function that returns a poster file or poster URL (e.g.
WebDbApiBase.poster_url()). May raiseRequestError, which is passed toerror().width – Resize poster to this many pixels wide (aspect ratio is maintained)
height – Resize poster to this many pixels high (aspect ratio is maintained)
imagehosts –
Sequence of
ImagehostBasesubclass instancesUpload poster to the first, try the next one if it fails and so on.
RequestErrorfrom uploading is passed towarn(). If all uploads fail,error()is called. Any failed image host is considered broken and will not be used for subsequent images.write_to – Write poster to this file path (may be None or empty string)
- async run()[source]
Do the work
This method is called by
start(). Its coroutine is passed toadd_task().Any keyword arguments passed to
initialize()are available viakwargs.The job
is_finishedwhen alladded tasksare done or cancelled. (See alsofinalize()andfinalization().)This method may call
add_task()if more tasks are required.