Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust message to warn about problematic videos [e.g. "live" videos, that might not really be live anymore, but still fail to download] #194

Merged
merged 5 commits into from
Jun 19, 2024

Conversation

deldesir
Copy link
Collaborator

@deldesir deldesir commented Jun 18, 2024

Tested together with #193

image

Unavailable videos returns a different message:

image

Tested on Ubuntu 24.04

@deldesir deldesir self-assigned this Jun 18, 2024
@deldesir deldesir marked this pull request as draft June 18, 2024 18:23
@deldesir deldesir marked this pull request as ready for review June 18, 2024 18:41
@deldesir deldesir requested a review from holta June 18, 2024 18:41
@deldesir deldesir added bug Something isn't working enhancement New feature or request labels Jun 18, 2024
@holta
Copy link
Member

holta commented Jun 18, 2024

@codewiz review with PR #193 if you can?!

Co-authored-by: A Holt <[email protected]>
@holta
Copy link
Member

holta commented Jun 18, 2024

@deldesir consider adding an else clause below Line 170?

(Including a generic error message explaining — as best we can guess anyway — what might have caused this?!)

conn.execute("DELETE FROM media WHERE path = ?", (self.media_url,))
if self.unavailable:
self.message = f"{self.media_url_link} failed: Video not available."
elif error_message := conn.execute("SELECT error FROM media WHERE ? LIKE '%' || extractor_id || '%'", (self.media_url,)).fetchone()[0]:
Copy link

Choose a reason for hiding this comment

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

I don't quite understand why we're taking the first error where the extractor_id matches the media_url.

Couldn't we take all records (or the first record) where webpath = media_url and error is not empty?

errors = conn.execute(
    "SELECT error FROM media WHERE webpath = ? AND error != ''", (self.media_url,))
    .fetchone()

And we could also get the id column in one query:

(id, error) = conn.execute(
    "SELECT id, error FROM media WHERE webpath = ? AND error != ''", (self.media_url,))
    .fetchone()

Copy link
Collaborator Author

@deldesir deldesir Jun 19, 2024

Choose a reason for hiding this comment

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

Good point. However, due to SQLite UNIQUE constraint, we don't expect 2 relevant records. And this record should be deleted right after to allow the user to force redownload. If ever another record with the same extractor ID is present, it will never match because its webpath would have a timestamp appended to it or its error column would not be NULL.

@holta
Copy link
Member

holta commented Jun 19, 2024

@deldesir consider adding an else clause below Line 170?

(Including a generic error message explaining — as best we can guess anyway — what might have caused this?!)

Defensive Programming:

  • Why is there no else clause?
  • What's the most meaningful error message we can communicate within an else clause?

@deldesir
Copy link
Collaborator Author

@deldesir consider adding an else clause below Line 170?
(Including a generic error message explaining — as best we can guess anyway — what might have caused this?!)

Defensive Programming:

  • Why is there no else clause?
  • What's the most meaningful error message we can communicate within an else clause?

Done in 017afed

@holta holta merged commit d49ee2a into iiab:master Jun 19, 2024
@holta holta changed the title Adjust message to warn about problematic videos Adjust message to warn about problematic videos [e.g. "live" videos, that might night really be live anymore, but are not currently downloading] Jun 21, 2024
@holta holta changed the title Adjust message to warn about problematic videos [e.g. "live" videos, that might night really be live anymore, but are not currently downloading] Adjust message to warn about problematic videos [e.g. "live" videos, that might not really be live anymore, but are not currently downloading] Jun 21, 2024
@deldesir deldesir deleted the deldesir-patch-47 branch July 1, 2024 21:40
@holta holta changed the title Adjust message to warn about problematic videos [e.g. "live" videos, that might not really be live anymore, but are not currently downloading] Adjust message to warn about problematic videos [e.g. "live" videos, that might not really be live anymore, but still fail to download] Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants