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

Overall "Download to IIAB" workflow #190

Open
2 of 6 tasks
deldesir opened this issue Jun 17, 2024 · 0 comments
Open
2 of 6 tasks

Overall "Download to IIAB" workflow #190

deldesir opened this issue Jun 17, 2024 · 0 comments
Assignees
Labels
Explanation logic or algorithm explained

Comments

@deldesir
Copy link
Collaborator

deldesir commented Jun 17, 2024

(Attempt to explain the logic behind success and failure of a video download)

I. Metadata Fetch Task

  1. lb tubeadd is run:

    • The lb tubeadd command is executed to fetch metadata for the media URL.
      • media.webpath is set to the original URL.
      • media.path is initially set to the original URL.
      • media.error is set to NULL.

    Notes:

    • lb tubeadd will fail due to an unsupported URL or if yt-dlp returns no data, the metadata fetch task will not proceed further, and no download task will be created for the URL.
    • lb tubeadd will silently exit when the URL is already present and nothing is recorded in media.error (i.e unavailable fragments case)
  2. Sending URL to "Download Task":

    • After successfully running lb tubeadd, the metadata fetch task checks the media table in the database:
      • If media.duration is not NULL and media.duration > 0, the URL is considered valid and is sent to the download task.
      • If media.duration is NULL or media.duration = 0, the URL is marked as unavailable, and the task will log an error and terminate.

    Notes:

    • Only URLs with valid durations are forwarded to the download task, ensuring that only downloadable videos are processed further.

II. Download Task

  1. Running lb dl:

    • The lb dl command is executed to download the media file.
      • media.webpath remains the original URL.
      • media.path should be updated to the actual file path on the disk upon successful download.
      • media.error remains NULL if no errors occur during the download process.

    Notes:

    • If lb dl fails to download the video, media.path will not be updated correctly (i.e., it might remain as an URL or contain an invalid path).
    • The task will log any errors and update the media.error field accordingly, except for videos failed due to unavailable fragments (to be fixed)
  2. Upon Successful Download:

    • If the download is successful:
      • A timestamp is appended to media.webpath to indicate the time of download.
      • The downloaded file's path is stored in media.path.

Detailed Steps for Success and Failure

Success:

  1. Metadata Fetch Task:

    • lb tubeadd runs successfully.
    • Metadata (including duration) is fetched and stored in the database.
    • URL is forwarded to the download task if media.duration is valid.
  2. Download Task:

    • lb dl runs successfully.
    • Video is downloaded, and the file path is updated in the database.
    • media.webpath is updated with a timestamp.
    • Task status is set to STAT_FINISH_SUCCESS.

Failure:

  1. Metadata Fetch Task Failure:

    • lb tubeadd fails due to an unsupported URL or no data returned.
    • Task logs an error and terminates without creating a download task.
  2. Download Task Failure:

    • lb dl fails to download the video (e.g., due to network issues, video removal, or other errors).
    • media.path remains incorrect or NULL, leading to potential NoneType errors when accessed.
    • media.error is updated with the error message.
    • Task status is set to STAT_FAIL.

TODO:

@deldesir deldesir changed the title What makes videos fail What makes videos fail? Jun 17, 2024
@deldesir deldesir self-assigned this Jun 17, 2024
@deldesir deldesir added question Further information is requested Explanation logic or algorithm explained labels Jun 17, 2024
@deldesir deldesir changed the title What makes videos fail? Overall workflow Jun 17, 2024
@deldesir deldesir removed the question Further information is requested label Jun 17, 2024
@holta holta changed the title Overall workflow Overall "Download to IIAB" workflow Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Explanation logic or algorithm explained
Projects
None yet
Development

No branches or pull requests

1 participant