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

[Bug Report] Generate covers when blob is missing does not work #3657

Closed
drzero42 opened this issue Apr 12, 2023 · 7 comments · Fixed by #3661
Closed

[Bug Report] Generate covers when blob is missing does not work #3657

drzero42 opened this issue Apr 12, 2023 · 7 comments · Fixed by #3661
Labels
bug report Bug reports that are not yet verified

Comments

@drzero42
Copy link

Describe the bug
After upgrading to 0.20.2 and deciding to move where my library is located in the filesystem, I have ended up in a situation where a bunch of scenes do not have a cover image showing.
I thought I could just run the generate function and have it create new screenshots for covers, however this does not work.
After digging a bit into it, this is my analysis:

  • Scenes with broken covers have a value in the scenes.cover_blob field, but the corresponding blob file is missing from the blobs directory.
  • Running the Generate function with Scene covers enabled does not generate a new screenshot (log says 0 covers), probably because cover_blob is already set.
  • Running the Generate function with Scene covers and Overwrite enabled logs that it wants to generate 1 cover, but in reality no screenshot is generated.
  • Running the Generate default thumbnail function generates a new screenshot and sets it as the cover, but that only works for a single scene, not in bulk.

To Reproduce
Steps to reproduce the behavior:

  1. Have a library with scenes and generated covers
  2. Find blob for a scene and delete it
  3. Try to generate a new cover using the Generate function

Stash Version: (from Settings -> About): v0.20.2 (docker)

@drzero42 drzero42 added the bug report Bug reports that are not yet verified label Apr 12, 2023
@DingDongSoLong4
Copy link
Collaborator

I don't use docker, but have you mapped your blobs directory to a persistent location (#3613)?

@drzero42
Copy link
Author

@DingDongSoLong4 Yes, I have done that part correctly (now) - thank you :)
This bug report is not about losing the blobs, it is about a bug found because I lost some blobs.

@MrX292
Copy link
Contributor

MrX292 commented Apr 12, 2023

I am not sure ii it will help, but Can you run a clean in dry run and see if it shows the blobs in the logs?

@drzero42
Copy link
Author

@MrX292 Good suggestion. It unfortunately shows nothing:

2023-04-12 21:34:12Info    Finished Cleaning (2.688547008s)
2023-04-12 21:34:09Info    Running in Dry Mode
2023-04-12 21:34:09Info    Starting cleaning of tracked files

@DingDongSoLong4
Copy link
Collaborator

I assume the reason why enabling overwrite doesn't actually overwrite existing covers is because you could have manually added them so it wouldn't be overwriting 'existing generated files' as they're then not generated.

That does cause the issue you describe where if the cover blob file is deleted then you can't regenerate it. Stash can't really check if each blob exists on every scan, that will likely slow it down considerably with many blobs (or at least I would assume so, would need to test to be sure) so the most obvious fix would be to just make overwrite actually overwrite everything.

Now that the Clean task has come up, adding a Clean-like task to remove both invalid blob info from the database and stale blobs from the file system as in #3601 would also solve the issue, and would be a good addition whether or not the overwrite option is changed.

@Flashy78
Copy link
Contributor

I can't test it at the moment, but my first guess is that Overwrite: j.overwrite should be added here?
https://github.com/stashapp/stash/blob/develop/internal/manager/task_generate.go#L269

@drzero42
Copy link
Author

@DingDongSoLong4 Absolutely. Running checks everytime it handles a scene would slow things down. But, like you describe, a Clean-like task to go through and verify all cover_blobs would be great - then there is a way to fix this situation, for when it happens.

Btw, just as a curiosity, here is the logging (DEBUG level) for running Generate with overwrite on a "broken" scene:

2023-04-12 21:44:53Info    Generate finished (39.518387497s)
2023-04-12 21:44:46Info    [generator] generating phash sprite for /storage/data/video/PERFORMER/SCENENAME.mp4
2023-04-12 21:44:46Debug   created video preview: /storage/data/stash/generated/screenshots/d85c810afc22d4c6.mp4
2023-04-12 21:44:36Info    [generator] generating video preview for /storage/data/video/PERFORMER/SCENENAME.mp4
2023-04-12 21:44:36Info    [generator] generating sprite vtt for /storage/data/video/PERFORMER/SCENENAME.mp4
2023-04-12 21:44:14Info    [generator] generating sprite image for /storage/data/video/PERFORMER/SCENENAME.mp4
2023-04-12 21:44:14Info    Generating 1 covers 1 sprites 1 previews 0 image previews 0 markers 0 transcodes 1 phashes 0 heatmaps & speeds
2023-04-12 21:44:14Info    Generate started with 1 parallel tasks

So it says it will generate 1 cover, but it never does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Bug reports that are not yet verified
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants