upsies.jobs.playlists

Wrapper for bdinfo command

Classes

class upsies.jobs.playlists.PlaylistsJob(*, 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

Ask the user to select playlists from Blu-ray or DVD disc(s)

This job adds the following signals to signal:

discs_available

Emitted when all subdirectories containing “BDMV” directories are found. Registered callbacks get a sequence of directory paths that each contain a “BDMV” directory.

discs_selected

Emitted when the user has selected Blu-ray path(s). Registered callbacks get a sequence of directory paths that each contain a “BDMV” directory.

playlists_available

Emitted when the list of playlists is available. Registered callbacks get a dictionary with they keys disc_path, the parent path of the “BDMV” directory, and playlists, a sequence of playlist dictionaries. Each playlist dictionary has the keys filepath size, duration, disc_path and items. items is a sequence of .m2ts file paths. Playlists and playlist items are sorted by size in reverse order.

playlists_selected

Emitted when the user has selected playlist(s). Registered callbacks get a sequence of playlist items as described in playlists_available.

property cache_id

Final segment of content_path and “select_multiple” argument

property select_multiple

Whether the user may select multiple playlists

initialize(*, content_path, select_multiple=False)[source]

Set internal state

Parameters:
  • content_path

    Path to directory that contains “BDMV” or “VIDEO_TS” directory

    May also contain multiple subdirectories that contain “BDMV” or “VIDEO_TS” directories (multidisc)

  • select_multiple (bool) – Whether the user may select multiple playlists

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)

discs_selected(discpaths)[source]

Called by the UI when the user selects disc(s)

Parameters:

discpaths (str) – Sequence of directory paths that contain a “BDMV” or “VIDEO_TS” directory

Calling this method emits the discs_selected signal.

playlists_selected(discpath, playlists)[source]

Called by the UI when the user selects playlist(s)

Parameters:
  • discpath (str) – Directory path that contains the playlists

  • playlists – Sequence of Playlist instances

Calling this method emits the playlists_selected signal.

property selected_playlists

Sequence of Playlist instances that were selected by the user

This sequence will be empty at the beginning and grow as the user makes selections for each selected disc.