dotfiles

personal dotfiles
git clone anongit@rnpnr.xyz:dotfiles.git
Log | Files | Refs | Feed | Submodules

detect-image.lua (440B)


      1 mp.register_event("file-loaded", function()
      2 	local fc = mp.get_property_native('estimated-frame-count')
      3 	local tl = mp.get_property_native('track-list')
      4 	local a = 0
      5 	for _, t in pairs(tl) do
      6 		a = a or t.type == "audio"
      7 	end
      8 	local isimg = (fc == 0 or fc == 1) and a == 0
      9 	mp.set_property_native("user-data/is-image", isimg)
     10 	if isimg then
     11 		mp.commandv("enable-section", "image")
     12 	else
     13 		mp.commandv("disable-section", "image")
     14 	end
     15 end)