]> jfr.im git - yt-dlp.git/commitdiff
Handle float in `--wait-for-video`
authorpukkandan <redacted>
Thu, 17 Mar 2022 21:55:20 +0000 (03:25 +0530)
committerpukkandan <redacted>
Thu, 17 Mar 2022 21:55:47 +0000 (03:25 +0530)
Closes #3082

yt_dlp/YoutubeDL.py

index d6b284529e854b10a3cbb3c378c056675e6a9d9a..38ff628b0319166c9f51aa0a43ac11008a366708 100644 (file)
@@ -1428,7 +1428,7 @@ def progress(msg):
         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, max_wait) if (max_wait and min_wait) else (max_wait or min_wait)
+            diff = round(random.uniform(min_wait, max_wait) if (max_wait and min_wait) else (max_wait or min_wait), 0)
             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')