iiab / calibre-web

:books: Web app for browsing, reading and downloading eBooks stored in a Calibre database
GNU General Public License v3.0
3 stars 4 forks source link

Formerly live https://youtu.be/4BL65HElOPg fails to download [same "no such column: error" issue as #186 ?] [unavailable fragments?] #215

Open holta opened 2 months ago

holta commented 2 months ago

Thanks @nzola for reporting the inability to download this formerly live video:

PARLONS HISTOIRE : L’ARMÉE CONGOLAISE ET LES DEUX GUERRES MONDIALES https://youtu.be/4BL65HElOPg

https://dpaste.com/4D4SEN6F6 Ubuntu 24.04 here:

IMG-20240706-WA0002

https://dpaste.com/5CJPTTJRM Raspberry Pi 4 here:

IMG-20240706-WA0003

ASIDE: Does the repetition in this "Tasks" view UX need to be clarified, or tightened up a bit?

IMG-20240706-WA0000

Related:

holta commented 2 months ago

@deldesir

Is it possible the video's long length/duration (1:56:49) might be part of the problem?

holta commented 2 months ago

https://dpaste.com/4D4SEN6F6 Ubuntu 24.04 here:

Lines 1110 and 1111 pasted in below — this issue appears to be the same as:

[2024-07-05 23:59:45,842] ERROR {cps.tasks.download:132} An error occurred during the subprocess execution: 'NoneType' object is not subscriptable
[2024-07-05 23:59:45,843] ERROR {cps.services.worker:202} no such column: error
Traceback (most recent call last):
  File "/usr/local/calibre-web-py3/cps/tasks/download.py", line 93, in run
    requested_file = conn.execute("SELECT path FROM media WHERE webpath = ? AND path NOT LIKE 'http%'", (self.media_url,)).fetchone()[0]
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/calibre-web-py3/cps/services/worker.py", line 199, in start
    self.run(*args)
  File "/usr/local/calibre-web-py3/cps/tasks/download.py", line 133, in run
    self.message = f"{self.media_url_link} failed to download: {self.read_error_from_database()}"
                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/calibre-web-py3/cps/tasks/download.py", line 149, in read_error_from_database
    error = conn.execute("SELECT error FROM media WHERE webpath = ?", (self.media_url,)).fetchone()[0]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such column: error
holta commented 2 months ago

@deldesir do you understand this bug @nzola reported about a week ago?

deldesir commented 2 months ago

Yes, that means the video got stuck due to unavailable fragments.

holta commented 2 months ago

means the video got stuck due to unavailable fragments

Dozens of "Some fragments are taking longer than expected to download" messages need to be explained better in "Tasks" view for everyday users:

  1. What does this really mean?
  2. Being told dozens of times to "please wait" is not believable — is this truly the best that can be done?
  3. Conversely, worst case if there's absolutely nothing that can be done in this case and such cases, the root cause yt-dlp issue(s) need to be mentioned!
  4. Finally, what can be done about #186 ?
deldesir commented 2 months ago

means the video got stuck due to unavailable fragments

Dozens of "Some fragments are taking longer than expected to download" messages need to be explained better in "Tasks" view for everyday users:

  1. What does this really mean?

This is an unrecoverable error happened mysteriously with some videos. During the download some fragments just gone missing and the download is stuck. Nothing to see with Calibre-Web, xklb and yt-dlp. The expected fragments just don't leave YouTube servers.

  1. Being told dozens of times to "please wait" is not believable — is this truly the best that can be done?

Fixed in #223

  1. Conversely, worst case if there's absolutely nothing that can be done in this case and such cases, the root cause yt-dlp issue(s) need to be mentioned!

There is nothing we can do actually. This is an external issue yt-dlp cannot do anything about

  1. Finally, what can be done about (1) download.py: "sqlite3.OperationalError: no such column: error" after "TypeError: 'NoneType' object is not subscriptable" (2) editbooks.py: SAWarning: Object of type not in session, add operation along 'Authors.books' won't proceed #186 ?

I have done my best to get rid of the warning editbooks.py: SAWarning: Object of type <Books> not in session, add operation along 'Authors.books' won't proceed. There is still work to do to ship a successful PR.

holta commented 2 months ago

There is nothing we can do actually. This is an external issue yt-dlp cannot do anything about

  1. Ok. So please now provide a link in "Tasks" view to a yt-dlp (or similar!) ticket explaining the context. Thanks.

  2. Explain here why the error message is being repeated, so everyone can understand the root cause, and what it means.

    Whereas suppressing error messages is almost always neither useful nor healthy.

    (Ref: https://github.com/iiab/calibre-web/pull/223#issuecomment-2231708420)

  3. Where is the work below? Thanks!

I have done my best to get rid of the warning editbooks.py: SAWarning: Object of type <Books> not in session, add operation along 'Authors.books' won't proceed. There is still work to do to ship a successful PR.

deldesir commented 1 month ago

I have new understanding of the issue. The video was not stuck at yt-dlp level. That means it actually reached 100% progress. Another video that I tested (which was previously stuck) recovered successfully. I am looking into xklb's media check for hints. I have a suspicion memory might be an issue because the video that was recovered did not use over 4G which is set as the maximum in the media check code here at L48

https://github.com/chapmanjacobd/library/blob/96273e689c5f113003e9b7c169198c72946adb44/xklb/mediafiles/media_check.py#L43-L59

holta commented 1 month ago

Great progress! 💯

Explaining to everyone a bit better what's happening is indeed the goal, as intuitively/clearly as we can — on PR #223 and/or similar, so these can be merged quickly — as soon as any of these appear to be reasonable and safe (no matter how small!) steps forward! 🏗️

holta commented 1 month ago

@nzola & @deldesir

Can you please help retest &/or recap? Now that these PR's are merged...

...thanks!! To help everyone deepen our understanding of next steps, e.g.:

deldesir commented 2 weeks ago

@nzola, this issue should have been fixed by #191.

holta commented 2 weeks ago

@nzola can you restest & confirm? (On July 24th I wrote...)

@nzola & @deldesir

Can you please help retest &/or recap? Now that these PR's are merged...

holta commented 2 weeks ago

@nzola & @deldesir

I just tested "Download to IIAB" with https://youtu.be/4BL65HElOPg using the latest yt-dlp and the latest xklb, and it works:

  1. Great that it was solved more than 5 weeks ago!
  2. How do we work more closely together, to keep tickets like this from being ignored for 5+ weeks in future?