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

How can I restore a deleted video to a channel? #538

Closed
kuchenmitsahne opened this issue Apr 15, 2023 · 3 comments
Closed

How can I restore a deleted video to a channel? #538

kuchenmitsahne opened this issue Apr 15, 2023 · 3 comments
Labels
question Further information is requested

Comments

@kuchenmitsahne
Copy link

I downloaded a channel, and a few videos errored during the download process. Some of them I was able to just re-download (by requeueing them in the Progress tab with "Download next") and they completed successfully, but there was one which Tartube thought was downloaded correctly. When I attempted to re-download it the download was instantly marked as finished. Even after deleting the files locally, Tartube still marked download attempts as finished.

Then, I made a mistake: I went to the channel, right-clicked the video, clicked "Delete video", and then selected "Delete files on your computer." The prompt is this:

Do you want to remove the video(s) from your filesystem, or do you just want to remove them from this channel?

○ Just remove the video(s) from this channel
○ Delete files on your computer

I misunderstood this to be an "either-or" prompt: either remove the video from the channel (leaving the files intact) OR delete the files leaving the video in the channel. However, selecting the second option also removes the video from the channel.

My questions are twofold:

1. How can I restore a deleted video to a channel? I couldn't find any undo function, and the readme didn't have anything to say about the "Delete video" function. Checking the channel found new videos as expected, but the deleted video remains absent.
2. What is the proper way to delete the local files associated with a video while retaining that video in a channel/playlist?

Also, it may be worth rewording the prompt to make it clear that deleting the files ALSO removes it from the channel.

Thank you for developing and maintaining this wonderful piece of software! This small hiccup aside (which is mostly my fault), it's been a huge timesaver for me.

@kuchenmitsahne kuchenmitsahne added the question Further information is requested label Apr 15, 2023
@axcore
Copy link
Owner

axcore commented Apr 15, 2023

  1. How can I restore a deleted video to a channel?

yt-dlp will not download a video if:

  1. The video already exists on your filesystem, or
  2. The video's ID has been added to yt-dlp's archive file

In the case of 2, yt-dlp thinks it has already downloaded the video, even though the video no longer exists on your filesystem, so it won't try again.

The solution in your case it to tell yt-dlp not to read its archive file, which you can do in Edit > System preferences... > Operations > Archive. There, unselect the option: Allow downloader to create its own archive file.

Re-enable the option once you have recovered the video.

I couldn't find any undo function

There isn't one. However, Tartube makes frequent backups up its database file, you could just restore the most recent one. It's in the video download folder, inside the .backups folder.

  1. What is the proper way to delete the local files associated with a video while retaining that video in a channel/playlist?

There isn't one. But all of the files associated with the video should have the same name, just different file extensions. Open the channel's folder (right-click it and select Show > Actual location), then delete any files matching the video's name.

Another method would be to right-click the channel and select Channel actions > Tidy up channel. In the new window, you can try to detect broken video downloads (and auto-delete them)

@kuchenmitsahne
Copy link
Author

Thank you for the prompt and detailed response! Restoring the DB file and deleting the ID of the problematic video from the yt-dpl archive did the trick; the video was restored to the channel and I was then able to download it without incident. Also, tidying up after fixed a few other minor issues, so I'll be sure to try that going forward.

Just to make sure, the "delete video" function should be treated as permanent, correct? Sort of a, "I never want to track this video" button. Is there some sort of flag set in the DB so that the deletion persists when checking a channel after deletion?

@axcore
Copy link
Owner

axcore commented Apr 16, 2023

Just to make sure, the "delete video" function should be treated as permanent, correct? Sort of a, "I never want to track this video" button. Is there some sort of flag set in the DB so that the deletion persists when checking a channel after deletion?

No. Delete a video and remove it from the archive file; then the next time yt-dlp will download the video again and Tartube will add the video to its database again. Tartube is passive, it just tracks whatever yt-dlp decides to do.

This works very well in practice, but you always have the option to tweak the files and/or the database, if you need to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants