From 621130004450c63994231f2812db7c48c82ee96c Mon Sep 17 00:00:00 2001 From: Junker <1144095+Junker@users.noreply.github.com> Date: Mon, 11 Jul 2022 14:55:39 +0700 Subject: [PATCH] use mediainfo and mplayer for info view audio files --- init.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index f74a571..7e620a6 100644 --- a/init.lua +++ b/init.lua @@ -334,6 +334,17 @@ local function info_view_video(node) return info_view_node(node) end +local function info_view_audio(node) + if program_exists("mediainfo") then + return exec_paging("mediainfo", node) + elseif program_exists("mplayer") then + return exec_paging("mplayer", node, "-identify", "-vo null", "-ao null", "-frames 0") + end + + return info_view_node(node) +end + + local function info_view_epub(node) if program_exists("einfo") then return exec_paging("einfo", node, "-v"); @@ -511,9 +522,10 @@ local function smart_view(ctx) if node_mime:match("^image/.*") then return smart_view_image(node) - end - if node_mime:match("^video/.*") then + elseif node_mime:match("^video/.*") then return info_view_video(node) + elseif node_mime:match("^audio/.*") then + return info_view_audio(node) end for smart_view_,v in ipairs(archive_mime_types) do