upsies.jobs.screenshots
Create screenshots from video file(s)
Classes
- class upsies.jobs.screenshots.ScreenshotsJob(*, 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:
JobBaseCreate screenshots from video file(s) or
PlaylistinstancesTo get
Playlists, this job relies on aPlaylistsJobinstance to be available via a jobsiblingsnamed “playlists”.This job adds the following signals to
signal:screenshots_totalEmitted before screenshots are created. Registered callbacks get the total number of screenshots as a positional argument.
- cache_id = None
- initialize(*, content_path, precreated=(), exclude_files=(), timestamps=(), count=0, from_all_videos=False, optimize='default', tonemap=False)[source]
Set internal state
- Parameters:
content_path (str) – Path to file or directory or sequence of paths
precreated –
Sequence of paths of already existing screenshots
These do not count towards the wanted number of screenshots. count screenshots are created in addition to any precreated screenshots.
exclude_files –
Sequence of glob patterns (
str) andre.Patternobjects (return value fromre.compile()) that are matched against the relative path beneath each sourceGlob patterns are matched case-insensitively.
Note
Non-video files and stuff like Sample.mkv are always excluded by
fs.find_main_videos().timestamps (sequence of "[[H+:]M+:]S+" strings or seconds) – Screenshot positions in the video
count –
Number of screenshots to make or
callable()that returns how many screenshots to makeIf this is a callable (synchronous or asynchronous), it is called when this job is
start()ed, andcountis0until then.from_all_videos (bool) –
Whether to take count screenshots from each video file or only from the first video
See
fs.find_main_videos()for more information.optimize –
level argument for
optimize()If this is
"default", missing optimization dependencies are silently ignored.tonemap (bool) – Whether to apply tonemap algorithm for HDR screenshots
If timestamps and count are not given, screenshot positions are picked at even intervals. If count is larger than the number of timestamps, more timestamps are added.
- terminate(reason=None)[source]
Stop screenshot creation and optimization subprocesses before terminating the job
- property exit_code
0 if all screenshots were made, 1 otherwise, None if unfinished
- property exclude_files
Sequence of glob and
regexpatterns to excludeSee
initialize()for more information.Setting this property when this job
is_startedraisesRuntimeError.
- property from_all_videos
Whether to make screenshots from all video files or only the first
Setting this property when this job
is_startedraisesRuntimeError.
- property count
How many screenshots to make per video file
Setting this property when this job
is_startedraisesRuntimeError.
- property timestamps
Specific list of timestamps to make
Setting this property when this job
is_startedraisesRuntimeError.
- property screenshots_total
Total number of screenshots to make
Note
This is
-1until the subprocess that creates the screenshots is executed and determined the number of screenshots.
- property screenshots_created
Total number of screenshots made so far
- property screenshots_by_file
Map video file paths to sequences of generated screenshot file paths so far
- add_output(screenshot_filepath, video_filepath, source)[source]
Populate
outputandscreenshots_by_fileand bumpscreenshots_created- Parameters:
screenshots_filepath – Path to screenshot file
video_filepath – Path to video file screenshot_filepath is from
source – Path to release directory,
Playlistinstance or the same as video_filepath