mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-12-06 06:45:00 +01:00
[utils] Add try_call
This commit is contained in:
parent
f189faf1ce
commit
c4f60dd7cd
5 changed files with 25 additions and 19 deletions
|
|
@ -14,6 +14,7 @@ from ..utils import (
|
|||
float_or_none,
|
||||
mimetype2ext,
|
||||
str_or_none,
|
||||
try_call,
|
||||
try_get,
|
||||
unescapeHTML,
|
||||
unsmuggle_url,
|
||||
|
|
@ -145,11 +146,11 @@ class MediasiteIE(InfoExtractor):
|
|||
'duration': slide['Time'] / 1000,
|
||||
})
|
||||
|
||||
next_time = try_get(None, [
|
||||
lambda _: Stream['Slides'][i + 1]['Time'],
|
||||
lambda _: duration,
|
||||
lambda _: slide['Time'],
|
||||
], expected_type=(int, float))
|
||||
next_time = try_call(
|
||||
lambda: Stream['Slides'][i + 1]['Time'],
|
||||
lambda: duration,
|
||||
lambda: slide['Time'],
|
||||
expected_type=(int, float))
|
||||
|
||||
fragments.append({
|
||||
'path': fname_template.format(slide.get('Number', i + 1)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue