aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/YoutubeDL.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-12-06 23:30:33 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-12-06 23:30:33 +0530
commit38d79fd16c741ae9e460bc5adbbdb9972347b6be (patch)
tree17ae89baf80a7bc475e47682f6415035b8b0a165 /yt_dlp/YoutubeDL.py
parentacc0d6a411aba58f008e547eb81b4e9e3398d284 (diff)
downloadhypervideo-pre-38d79fd16c741ae9e460bc5adbbdb9972347b6be.tar.lz
hypervideo-pre-38d79fd16c741ae9e460bc5adbbdb9972347b6be.tar.xz
hypervideo-pre-38d79fd16c741ae9e460bc5adbbdb9972347b6be.zip
Use `parse_duration` for `--wait-for-video`
and some minor fix
Diffstat (limited to 'yt_dlp/YoutubeDL.py')
-rw-r--r--yt_dlp/YoutubeDL.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index 227098656..57b36b050 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -1371,11 +1371,11 @@ class YoutubeDL(object):
min_wait, max_wait = self.params.get('wait_for_video')
diff = try_get(ie_result, lambda x: x['release_timestamp'] - time.time())
if diff is None and ie_result.get('live_status') == 'is_upcoming':
- diff = random.randrange(min_wait or 0, max_wait) if max_wait else min_wait
+ diff = random.randrange(min_wait, max_wait) if (max_wait and min_wait) else (max_wait or min_wait)
self.report_warning('Release time of video is not known')
elif (diff or 0) <= 0:
self.report_warning('Video should already be available according to extracted info')
- diff = min(max(diff, min_wait or 0), max_wait or float('inf'))
+ diff = min(max(diff or 0, min_wait or 0), max_wait or float('inf'))
self.to_screen(f'[wait] Waiting for {format_dur(diff)} - Press Ctrl+C to try now')
wait_till = time.time() + diff