Skip to content

Commit

Permalink
Merge pull request #223 from deldesir/deldesir-patch-9
Browse files Browse the repository at this point in the history
Adjust error message for stuck/slow videos [if elapsed_time >= timeout, e.g. due to unavailable fragments &/or xklb media_check]
  • Loading branch information
holta authored Aug 17, 2024
2 parents 7813878 + e52fd6e commit df50c01
Showing 1 changed file with 3 additions and 4 deletions.
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."
sleep(0.1)

p.wait()
Expand Down

0 comments on commit df50c01

Please sign in to comment.