Thumbnail can be lost if multiple requests for the same media
Thumbnail files can be erased if the app sent multiple requests for the same thumbnail.
Steps to reproduce :
- run vlc-android on "Group by name" view
- add two new files with the same prefix to an indexed folder (bf2042_gameplay.mkv / bf2042_trailer.mkv)
- reload, when the item appeared in the UI, press it (it was just the first video, so playback started) => here i think only one file has been parsed, and the app requested the thumbnail
- quickly press back to video browser, second file has been parsed, UI show a group => here, the UI requests the thumbnail for both files, because first one might not be done yet (or UI is not yet aware of it)
In short, add new videos, and enter/exit the video group which contains them. the UI will send thumbnail request when displaying the group item and also when displaying the video item.
Logs show this (simplified) :
- generateThumbnail Generating smb://.../bf2042_gameplay.mkv thumbnail in .../medialib/thumbnails/212.jpg
- generateThumbnail Generating smb://.../bf2042_trailer.mkv thumbnail in .../medialib/thumbnails/213.jpg
- generateThumbnail Generating smb://.../bf2042_trailer.mkv thumbnail in .../medialib/thumbnails/213.jpg
In the DB :
- bf2042_gameplay links to 212.jpg (id_thumbnail 212)
- bf2042_trailer links to 213.jpg (id_thumbnail 214)
Everything appears to be good, except 213.jpg does not exists, only 212.jpg. My guess is that the 3rd generateThumbnail will see that there is already a thumbnail, so remove it (id_thumbnail 213, and also 213.jpg), and replace it by the new one (id_thumbnail 214, still using 213.jpg).
Edited by Sébastien Toque