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:
JobBaseAsk the user to select playlists from Blu-ray or DVD disc(s)
This job adds the following signals to
signal:discs_availableEmitted when all subdirectories containing “BDMV” directories are found. Registered callbacks get a sequence of directory paths that each contain a “BDMV” directory.
discs_selectedEmitted when the user has selected Blu-ray path(s). Registered callbacks get a sequence of directory paths that each contain a “BDMV” directory.
playlists_availableEmitted when the list of playlists is available. Registered callbacks get a dictionary with they keys
disc_path, the parent path of the “BDMV” directory, andplaylists, a sequence of playlist dictionaries. Each playlist dictionary has the keysfilepathsize,duration,disc_pathanditems.itemsis a sequence of.m2tsfile paths. Playlists and playlist items are sorted bysizein reverse order.playlists_selectedEmitted when the user has selected playlist(s). Registered callbacks get a sequence of playlist
itemsas described inplaylists_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 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.
- terminate(reason=None)[source]
Cancel all
added tasksDo nothing if job
is_finishedoris_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_selectedsignal.
- 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
Playlistinstances
Calling this method emits the
playlists_selectedsignal.
- property selected_playlists
Sequence of
Playlistinstances that were selected by the userThis sequence will be empty at the beginning and grow as the user makes selections for each selected disc.