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

Update database #16

Closed
darkspacer opened this issue May 23, 2023 · 2 comments
Closed

Update database #16

darkspacer opened this issue May 23, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@darkspacer
Copy link

Hi, can I update my database without downloading all a subtitles of YouTube channel again?

@NotJoeMartinez NotJoeMartinez added the enhancement New feature or request label May 27, 2023
@NotJoeMartinez
Copy link
Owner

Currently no, but I plan to fix this after the full-text search refactor #24. In the mean time an option could be to change the tempfile declaration on line 83 to a persistent directory and yt-dlp will recognize that the file exists and skip the download.

something like:

def download_channel(channel_id, channel_name, language, number_of_jobs, s):
    print("Downloading channel")
    #with tempfile.TemporaryDirectory() as tmp_dir:
    dir_name = 'saved_vtts'
    os.mkdir(dir_name)

    cwd = os.getcwd()
    tmp_dir = os.path.join(cwd, dir_name)
    print('Saving vtt files to', tmp_dir)

    channel_url = f"https://www.youtube.com/channel/{channel_id}/videos"
    list_of_videos_urls = get_videos_list(channel_url)

    download_vtts(number_of_jobs, list_of_videos_urls, language, tmp_dir)
    add_channel_info(channel_id, channel_name, channel_url)

    print("Adding VTT data to db")
    vtt_to_db(channel_id, tmp_dir, s)

Alternatively you can speed up the download process by specifying --number-of-jobs for multi threading

@NotJoeMartinez NotJoeMartinez mentioned this issue Jun 1, 2023
@NotJoeMartinez
Copy link
Owner

@darkspacer added this feature with "Update db #43"

Usage: yt-fts update [OPTIONS]

  Updates a specified YouTube channel.

  You must provide the ID of the channel as an argument. Keep in mind some
  might not have subtitles enabled. This command will still attempt to
  download subtitles as subtitles are sometimes added later.

Options:
  --channel TEXT            The name or id of the channel to update.
                            [required]
  --language TEXT           Language of the subtitles to download
  --number-of-jobs INTEGER  Optional number of jobs to parallelize the run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

2 participants