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

Strengthen video ID match [PROBLEM: videos with square brackets in their title do not download] #285

Merged
merged 1 commit into from
Nov 17, 2024

Conversation

deldesir
Copy link
Collaborator

@deldesir deldesir commented Nov 17, 2024

As explained in #284 (comment), IIAB Calibre-Web looks for video IDs inside square brackets ([...]) in the filenames. A video might have two sets of square brackets. This PR ensures video IDs are always correctly identified in the last set of square brackets.

This is also adjusted in SQLAlchemy-related code refactoring.

Modify the code to correctly identify the last set of square brackets as containing the video ID
@deldesir deldesir requested a review from holta November 17, 2024 01:54
@deldesir deldesir self-assigned this Nov 17, 2024
@deldesir deldesir added the bug Something isn't working label Nov 17, 2024
@deldesir deldesir marked this pull request as draft November 17, 2024 01:55
@deldesir
Copy link
Collaborator Author

deldesir commented Nov 17, 2024

Tested on Ubuntu 24.04 with a clean xklb-metadata.db.
Unfortunately, a new database is required as the video ID is already present in the current database, and the webpath field is not timestamped to enable redownloading.

image

Examples:

  1. Regardless applying this PR or not, this example video The ethical dilemma of privacy - Michael Vazquez and Sarah Stroud will download.

    • URL: https://www.youtube.com/watch?v=tmwIhOCXLrQ
    • Resolved Title/File name: The ethical dilemma of privacy Michael Vazquez and Sarah Stroud_69.25k_[tmwIhOCXLrQ]
    • File Path: /root/Youtube/TED-Ed/The ethical dilemma of privacy Michael Vazquez and Sarah Stroud_69.25k_[tmwIhOCXLrQ].webm
  2. This PR needs to be applied to resolve previously failing cases like Led Zeppelin - Stairway To Heaven (Live at Earls Court 1975) [Official Video]

    • URL: https://www.youtube.com/watch?v=Ly6ZhQVnVow
    • Resolved Title/FIle name: Led Zeppelin Stairway To Heaven Live at Earls Court 1975 [Official Video]47.91M[Ly6ZhQVnVow]
    • File Path: /root/Youtube/Led Zeppelin/Led Zeppelin Stairway To Heaven Live at Earls Court 1975 [Official Video]_47.91M_[Ly6ZhQVnVow].webm

To properly test this PR with a previously failing video like Led Zeppelin - Stairway To Heaven (Live at Earls Court 1975) [Official Video]

  1. In your terminal:

    • Apply the change introduced in this PR to your IIAB Calibre-Web:
      sudo -i
      cd /usr/local/calibre-web-py3/
      git pull https://github.com/deldesir/calibre-web deldesir-patch-33 --no-rebase --no-edit
      
    • Delete the existing database entry:
      lb search-db /library/calibre-web/xklb-metadata.db media https://www.youtube.com/watch?v=Ly6ZhQVnVow --delete-rows
      
    • Restart your IIAB Calibre-Web:
      systemctl restart calibre-web
      
  2. Download the video:


Note:

If you are using the SQLAlchemy-based refactoring outlined in this test plan after 11/16/2024, you are already covered. However, update the relevant branch if your IIAB was built on or before this date:

  1. In your terminal:

    • Apply the change introduced in this PR to your IIAB Calibre-Web:
      sudo -i
      cd /usr/local/calibre-web-py3/
      git pull https://github.com/deldesir/calibre-web deldesir-patch-22 --no-rebase --no-edit
      
    • Delete the existing database entry:
      lb search-db /library/calibre-web/xklb-metadata.db media https://www.youtube.com/watch?v=Ly6ZhQVnVow --delete-rows
      
    • Restart your IIAB Calibre-Web:
      systemctl restart calibre-web
      
  2. Download the video:

@holta
Copy link
Member

holta commented Nov 17, 2024

A video might have two sets of square brackets. This PR ensures video IDs are always correctly identified in the last set of square brackets.

Post an example, right on top of this ticket. So that your thinking is crystal clear to others. Please. Thank you!

@holta holta mentioned this pull request Nov 17, 2024
1 task
@holta
Copy link
Member

holta commented Nov 17, 2024

CLARIF: This PR should be merged ASAP as soon as a vivid + clean example is posted (near the top of the ticket if possible!)

Thereby allowing @avni to retest the following very promptly, and without hassle:

@deldesir
Copy link
Collaborator Author

A video might have two sets of square brackets. This PR ensures video IDs are always correctly identified in the last set of square brackets.

Post an example, right on top of this ticket. So that your thinking is crystal clear to others. Please. Thank you!

Done

@holta
Copy link
Member

holta commented Nov 17, 2024

Is this PR about videos whose title contains square brackets?

(Are you saying that EXAMPLE 1. already downloaded correctly without the need for this PR?)

(Whereas EXAMPLE 2. needs this PR to download correctly?)

@holta holta changed the title Strengthen video ID match Strengthen video ID match [PROBLEM: videos with square brackets in their title do not download] Nov 17, 2024
@holta holta merged commit b88990f into iiab:master Nov 17, 2024
@deldesir
Copy link
Collaborator Author

Yes,

Is this PR about videos whose title contains square brackets?

(Are you saying that EXAMPLE 1. already downloaded correctly without the need for this PR?)

(Whereas EXAMPLE 2. needs this PR to download correctly?)

Of course. I edited the explanation for better clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants