celluloid-player / celluloid

A simple GTK+ frontend for mpv
https://celluloid-player.github.io
GNU General Public License v3.0
1.13k stars 88 forks source link

mpv `on_load` hook doesn't seem to be triggered? #770

Closed teohhanhui closed 2 years ago

teohhanhui commented 2 years ago

Overview Description: mpv on_load hook doesn't seem to be triggered

Steps to Reproduce:

  1. Add fuzzydir.lua to $XDG_CONFIG_HOME/celluloid/scripts
  2. Set sub-file-paths=** in the config file, e.g. $XDG_CONFIG_HOME/celluloid/mpv.conf
  3. Run Celluloid specifying a file to load

Actual Results: sub-file-paths value is still **

Expected Results: sub-file-paths value should be expanded into subdirectories of working directory by fuzzydir.lua script

Version: 0.23

Additional Information:

The same script works in mpv.

I've tried just doing:

local mp = require "mp"
local msg = require "mp.msg"

msg.trace("A: script init")

mp.add_hook("on_load", 50, function()
    msg.trace("B: on_load")
end)

mp.add_hook("on_preloaded", 50, function()
    msg.trace("C: on_preloaded")
end)

with

celluloid --mpv-msg-level='all=trace' /path/to/video.mkv > /tmp/celluloid.log 2>&1

but only messages A and C are printed. Message B is not printed.

gnome-mpv commented 2 years ago

Confirmed. Looks like the script was loaded a bit too late. It works fine if you open the file after launching Celluloid.