upsies.jobs.mediainfo

Wrapper for mediainfo command

Classes

class upsies.jobs.mediainfo.MediainfoJob(*, 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: JobBase

Get output from mediainfo command

This job adds the following signals to signal:

generating_report

Emitted before mediainfo report generation begins. Registered callbacks get the video file path mediainfo was called with.

generated_report

Emitted after mediainfo report generation has finished. Registered callbacks get the video file path mediainfo was called with and the report text.

cache_id = None
property content_path

Instantiation argument of the same name

initialize(*, content_path, from_all_videos=False, exclude_files=(), format='{MEDIAINFO}')[source]

Set internal state

Parameters:
  • content_path – Path to video file or directory that contains a video file

  • from_all_videos (bool) – Whether to get mediainfo output from each video file or only from the first video

  • exclude_files

    Sequence of glob patterns (str) and re.Pattern objects (return value from re.compile()) that are matched against each relative path beneath content_path

    Glob patterns are matched case-insensitively.

    Note

    Non-video files and stuff like Sample.mkv are always excluded (see fs.find_main_videos()).

  • format

    String that contains the placeholder "{MEDIAINFO}", which is replaced by the actual mediainfo

    Any other placeholders are ignored.

async run()[source]

Do the work

This method is called by start(). Its coroutine is passed to add_task().

Any keyword arguments passed to initialize() are available via kwargs.

The job is_finished when all added tasks are done or cancelled. (See also finalize() and finalization().)

This method may call add_task() if more tasks are required.

terminate(reason=None)[source]

Cancel all added tasks

Do nothing if job is_finished or is_terminated.

Parameters:

reason – Why this job is terminated (only used for debugging)

property reports_by_file

Map video file paths to mediainfo outputs gathered so far

Note

For VIDEO_TS releases, one mediainfo is made for an .IFO file and a second mediainfo is made for a .VOB file.