Commit: 2494b49b04e3d172de20b6ff375416d01bc480fa
Parent: 05427f6f6f46378c143fbd263eb0c20037fe1752
Author: Randy Palamar
Date: Thu, 3 Aug 2023 10:06:14 -0600
mpv: add a simpler detect-image script
Diffstat:
5 files changed, 14 insertions(+), 21 deletions(-)
diff --git a/.config/mpv/mpv.conf b/.config/mpv/mpv.conf
@@ -46,26 +46,16 @@ cover-art-auto=no
ytdl-format='(bestvideo[height<=?480]+bestaudio)/best'
[image]
+profile-cond=p["user-data/is-image"]
+profile-restore=copy
image-display-duration=inf
loop-file=inf
term-status-msg=
dscale=mitchell
-[extension.gif]
+[webms]
+profile-cond="path:find('%.gif') or path:find('%.swf') or path:find('%.webm')"
loop-file=inf
-[extension.swf]
-loop-file=inf
-[extension.webm]
-loop-file=inf
-
-[extension.jpeg]
-profile=image
-[extension.jpg]
-profile=image
-[extension.png]
-profile=image
-[extension.webp]
-profile=image
[protocol.http]
force-window=immediate
diff --git a/.config/mpv/script-opts/mpv_image_viewer.conf b/.config/mpv/script-opts/mpv_image_viewer.conf
@@ -1,3 +0,0 @@
-command_on_first_image_loaded=enable-section images
-command_on_image_loaded=
-command_on_non_image_loaded=disable-section images
diff --git a/.config/mpv/scripts/detect-image.lua b/.config/mpv/scripts/detect-image.lua
@@ -0,0 +1,10 @@
+mp.register_event("file-loaded", function()
+ local fc = mp.get_property_native('estimated-frame-count')
+ local tl = mp.get_property_native('track-list')
+ local a = 0
+ for _, t in pairs(tl) do
+ a = a or t.type == "audio"
+ end
+ mp.set_property_native("user-data/is-image",
+ (fc == 0 or fc == 1) and a == 0)
+end)
diff --git a/.config/mpv/scripts/mpv-image-viewer b/.config/mpv/scripts/mpv-image-viewer
@@ -1 +0,0 @@
-Subproject commit efc82147cba4809f22e9afae6ed7a41ad9794ffd
diff --git a/.gitmodules b/.gitmodules
@@ -13,9 +13,6 @@
[submodule ".config/mpv/scripts/mpv-reload"]
path = .config/mpv/scripts/mpv-reload
url = https://github.com/4e6/mpv-reload.git
-[submodule ".config/mpv/scripts/mpv-image-viewer"]
- path = .config/mpv/scripts/mpv-image-viewer
- url = https://github.com/occivink/mpv-image-viewer.git
[submodule ".config/mpv/scripts/mpv2oboeru"]
path = .config/mpv/scripts/mpv2oboeru
url = git@git.rnpnr.xyz:mpv2oboeru.git