marzzzello / mpv_thumbnail_script

A Lua script to show preview thumbnails in mpv's OSC seekbar, sans external dependencies (fork)
GNU General Public License v3.0
270 stars 20 forks source link

Thumbnails for wrong file may be used if files from different URLs are played #44

Closed olifre closed 11 months ago

olifre commented 1 year ago

Description of the bug Using for example ani-cli with mpv, URLs with patterns such as:

https://video.somewhere/video/somehash/1080p/mp4/file.mp4

will be played, differing by "hash" for different episodes. Playing two such URLs means the thumbnails from the first file are used for the second.

To Reproduce

  1. Play to different URLs with same "filename part".
  2. Observe thumbnails being reused for the second file.

Expected behavior Thumnails to be recreated for the second file.

Debug log

Environment

Additional context As expected, a subdirectory:

/tmp/mpv_thumbs_cache/file-0

is created and reused for all episodes.

Checking MPVs properties reveals:

$ echo '{ "command": ["get_property", "filename/no-ext"] }' | socat - ~/.mpv/ipc  
{"data":"file","request_id":0,"error":"success"}
$ echo '{ "command": ["get_property", "filename"] }' | socat - ~/.mpv/ipc  
{"data":"file.mp4","request_id":0,"error":"success"}
$ echo '{ "command": ["get_property", "path"] }' | socat - ~/.mpv/ipc  
{"data":"https://video.somewhere/video/somehash/1080p/mp4/file.mp4","request_id":0,"error":"success"}

So one way to fix this would be to use the property path in all cases where self.state.is_remote is true.