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 taking longer than expected. It could be a stuck download due to unavailable fragments (<a href='https://github.com/yt-dlp/yt-dlp/issues/2137' target='_blank'>yt-dlp/yt-dlp#2137</a>) 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'>#223</a> for more info."

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.

@deldesir @avni is the revision below more accurate? (Or if I'm wrong, LMK!)

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

@avni avni Aug 17, 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.

"keep trying" is more accurate, yes! TY! I don't know if 'media_check' is more accurate than 'media check'. @deldesir is more familiar with xklb.

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.

@deldesir please revise at any time (e.g. with a new PR) if improvement's helpful 💯

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.

Merging of this PR is now cleaned up with this separate commit:

(Apologies I messed up, and didn't get that revision from ~30min ago properly into this PR!)

sleep(0.1)

p.wait()
Expand Down