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