Skip to content
Merged
7 changes: 3 additions & 4 deletions cps/tasks/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def run(self, worker_thread):
complete_progress_cycle = 0

last_progress_time = datetime.now()
fragment_stuck_timeout = 120 # seconds
timeout = 120 # seconds

self.message = f"Downloading {self.media_url_link}..."
if self.live_status == "was_live":
Expand All @@ -80,9 +80,8 @@ def run(self, worker_thread):
last_progress_time = datetime.now()
else:
elapsed_time = (datetime.now() - last_progress_time).total_seconds()
if elapsed_time >= fragment_stuck_timeout:
self.message += f"<br>Some fragments are taking longer than expected to download. Please wait..."

if elapsed_time >= timeout:
self.message = f"{self.media_url_link} is stuck due to unavailable fragments. See <a href='https://github.com/yt-dlp/yt-dlp/issues/2137' target='_blank'>yt-dlp/yt-dlp#2137</a> for context."

@avni avni Aug 16, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.message = f"{self.media_url_link} is stuck due to unavailable fragments. See <a href='https://github.com/yt-dlp/yt-dlp/issues/2137' target='_blank'>yt-dlp/yt-dlp#2137</a> for context."
self.message = f"{self.media_url_link} is taking longer than expected. It could be a stuck download due to unavailable fragments (https://github.com/yt-dlp/yt-dlp/issues/2137) and/or an error in xklb’s media check. Please wait as we try again. See <a href=https://github.com/iiab/calibre-web/pull/223' target=_blank’>https://github.com/iiab/calibre-web/pull/223 for more info.</a>"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is better.

sleep(0.1)

p.wait()
Expand Down