From b2dad49a2ca0a725238cc98ab7a456b8f6c31889 Mon Sep 17 00:00:00 2001 From: TheColorman Date: Mon, 19 Jun 2023 16:43:52 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Moved=20system=20variables=20to?= =?UTF-8?q?=20the=20top?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- videoclip.lua | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/videoclip.lua b/videoclip.lua index cb5fcab..f468e89 100644 --- a/videoclip.lua +++ b/videoclip.lua @@ -23,6 +23,31 @@ local mpopt = require('mp.options') local utils = require('mp.utils') local OSD = require('osd_styler') +------------------------------------------------------------ +-- System-dependent variables + +local os_type +local uname = mp.command_native({ + name = "subprocess", + playback_only = false, + capture_stdout = true, + capture_stderr = true, + args = "uname", +}).stdout + +if string.find(uname, "MSYS_NT") then + os_type = 'windows' +elseif string.find(uname, "Darwin") then + os_type = 'macos' +else + os_type = 'linux' +end + +local open_utility = + os_type == 'windows' and 'explorer.exe' or + os_type == 'macos' and 'open' or + os_type == 'linux' and 'xdg-open' + -- Options can be changed here or in a separate config file. -- Config path: ~/.config/mpv/script-opts/videoclip.conf local config = { @@ -204,24 +229,6 @@ local function notify(message, level, duration) mp.osd_message(message, duration) end ------------------------------------------------------------- --- System-dependent variables - -local os_type -local uname = subprocess({"uname"}).stdout -if string.find(uname, "MSYS_NT") then - os_type = 'windows' -elseif string.find(uname, "Darwin") then - os_type = 'macos' -else - os_type = 'linux' -end - -local open_utility = - os_type == 'windows' and 'explorer.exe' or - os_type == 'macos' and 'open' or - os_type == 'linux' and 'xdg-open' - ------------------------------------------------------------ -- Provides interface for creating audio/video clips