From 925934c76ea57ecd674652ace25cf0e570c3d33e Mon Sep 17 00:00:00 2001 From: hooke007 Date: Mon, 10 Oct 2022 14:28:54 +0100 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=BC=A9=E7=95=A5=E5=9B=BE=E5=BC=95?= =?UTF-8?q?=E6=93=8E=EF=BC=9A=E6=94=AF=E6=8C=81=E5=85=B3=E9=97=AD=E7=9F=AD?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E7=9A=84=E9=A2=84=E8=A7=88=E4=B8=8E=E8=A7=A3?= =?UTF-8?q?=E7=A0=81=E9=A2=91=E7=8E=87=E8=B0=83=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- portable_config/script-opts.conf | 22 ++++++++++++---------- portable_config/script-opts/thumbfast.conf | 4 ++++ portable_config/scripts/thumbfast.lua | 9 ++++++--- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/portable_config/script-opts.conf b/portable_config/script-opts.conf index a05a1e70..0bfa1432 100644 --- a/portable_config/script-opts.conf +++ b/portable_config/script-opts.conf @@ -413,20 +413,22 @@ ##⇘⇘新缩略图引擎 script-opts-append = thumbfast-socket= - # Socket 路径,留空即自动 + # Socket 路径,留空即自动 script-opts-append = thumbfast-tnpath= - # 缩略图缓存路径,留空即自动 - script-opts-append = thumbfast-max_height=300 # 缩略图的尺寸,以像素为单位,默认 300 300 + # 缩略图缓存路径,留空即自动 + script-opts-append = thumbfast-max_height=300 # 缩略图的尺寸,以像素为单位,默认 300 300 script-opts-append = thumbfast-max_width=300 - script-opts-append = thumbfast-max_thumbs=1440 # 缩略图的最高数量,默认 1440 + script-opts-append = thumbfast-max_thumbs=1440 # 缩略图的最高数量,默认 1440 - script-opts-append = thumbfast-overlay_id=42 # 勿改 + script-opts-append = thumbfast-overlay_id=42 # 勿改 - script-opts-append = thumbfast-spawn_first=no # 加载文件时就开始生成缩略图,默认 no - script-opts-append = thumbfast-network=no # 是否对流媒体启用,默认 no - script-opts-append = thumbfast-audio=no # 是否对音频文件启用,默认 no - script-opts-append = thumbfast-precise=yes # 是否使用高精度的预览,默认 yes - script-opts-append = thumbfast-hwdec=yes # 是否使用硬解加速,默认 yes + script-opts-append = thumbfast-spawn_first=no # 加载文件时就开始生成缩略图,默认 no + script-opts-append = thumbfast-network=no # 是否对流媒体启用,默认 no + script-opts-append = thumbfast-audio=no # 是否对音频文件启用,默认 no + script-opts-append = thumbfast-min_duration=0 # 是否只对时长高于该值的视频启用(秒),默认 0 即禁用 + script-opts-append = thumbfast-precise=yes # 是否使用高精度的预览,默认 yes + script-opts-append = thumbfast-hwdec=yes # 是否使用硬解加速,默认 yes + script-opts-append = thumbfast-frequency=0.2 # 解码频率(秒),默认 0.2 diff --git a/portable_config/script-opts/thumbfast.conf b/portable_config/script-opts/thumbfast.conf index afb96444..5e8fbeff 100644 --- a/portable_config/script-opts/thumbfast.conf +++ b/portable_config/script-opts/thumbfast.conf @@ -23,7 +23,11 @@ network=no # 是否对音频文件启用,默认 no audio=no +# 是否只对时长高于该值的视频启用(秒),默认 0 即禁用 +min_duration=0 # 是否使用高精度的预览,默认 yes precise=yes # 是否使用硬解加速,默认 yes hwdec=yes +# 解码频率(秒),默认 0.2 +frequency=0.2 diff --git a/portable_config/scripts/thumbfast.lua b/portable_config/scripts/thumbfast.lua index a9a1f850..b81e7e0d 100644 --- a/portable_config/scripts/thumbfast.lua +++ b/portable_config/scripts/thumbfast.lua @@ -19,8 +19,10 @@ local options = { network = false, -- Enable on network playback audio = false, -- Enable on audio playback + min_duration = 0, -- 对短视频关闭预览(秒) precise = true, -- 启用高精度的预览 hwdec = true, -- 启用硬解加速 + frequency = 0.2, -- 解码频率(秒) } @@ -296,7 +298,7 @@ local function seek() end end -local seek_period = 0.2 +local seek_period = options.frequency local seek_timer = mp.add_timeout(seek_period, seek) seek_timer:kill() local function request_seek() @@ -417,10 +419,11 @@ local function file_load() last_seek_time = nil network = mp.get_property_bool("demuxer-via-network", false) - local image = mp.get_property_native('current-tracks/video/image', true) + local image = mp.get_property_native("current-tracks/video/image", true) local albumart = image and mp.get_property_native("current-tracks/video/albumart", false) + local short_video = mp.get_property_native("duration", 0) <= options.min_duration - disabled = (network and not options.network) or (albumart and not options.audio) or (image and not albumart) + disabled = (network and not options.network) or (albumart and not options.audio) or (image and not albumart) or (short_video and options.min_duration > 0) calc_dimensions() info(effective_w, effective_h) if disabled then return end