Skip to content

mpvpaper: picker regenerates thumbnails already present on disk #63

Description

@haimingz

Summary

The Video Wallpaper picker regenerates thumbnails that already exist on disk every time the picker is opened or reloaded.

Environment

  • Noctalia: v5.0.0-beta.9-dirty
  • Video Wallpaper: noctalia/mpvpaper 1.1.1
  • Cache directory: ~/.cache/noctalia/mpvpaper

Reproduction

  1. Configure a video directory containing one or more non-GIF videos.
  2. Open the Video Wallpaper picker and wait until thumbnails are generated.
  3. Close and reopen (or reload) the picker.

Actual behavior

The picker starts a new mpv --frames=1 --vo=image extraction for every video and overwrites its existing JPG cache entry.

On my system, the cache already contained 348 JPGs, yet opening the picker started 9 active extraction processes and created new .jpg.d temporary directories.

Expected behavior

If cachePath(video.path) exists, use it immediately and do not queue an mpv extraction.

Cause

In mpvpaper/panel.luau, queueThumb() only checks the panel-local thumbPaths and thumbPending tables:

if thumbPaths[video.path] ~= nil or thumbPending[video.path] then
  return
end
table.insert(thumbQueue, video.path)
pumpThumbQueue()

Those tables start empty when the panel is loaded, so an existing on-disk cache is never restored.

A minimal fix is to check the disk cache before enqueueing:

local cached = cachePath(video.path)
if noctalia.fileExists(cached) then
  thumbPaths[video.path] = cached
  return
end

This retains the current cache-key behavior; it intentionally does not invalidate a source video replaced at the same path.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions