diff --git a/player/lua/osc.lua b/player/lua/osc.lua index 4a622f91c95c9..c69db5662af56 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -2,6 +2,9 @@ local assdraw = require 'mp.assdraw' local msg = require 'mp.msg' local opt = require 'mp.options' +local default_audio_command = "script-binding select/select-aid; script-message-to osc osc-hide" +local default_sub_command = "script-binding select/select-sid; script-message-to osc osc-hide" + -- -- Parameters -- @@ -94,13 +97,13 @@ local user_opts = { chapter_next_mbtn_mid_command = "show-text ${chapter-list} 3000", chapter_next_mbtn_right_command = "script-binding select/select-chapter; script-message-to osc osc-hide", - audio_track_mbtn_left_command = "script-binding select/select-aid; script-message-to osc osc-hide", + audio_track_mbtn_left_command = default_audio_command, audio_track_mbtn_mid_command = "show-text ${track-list/audio} 3000", audio_track_mbtn_right_command = "show-text ${track-list/audio} 3000", audio_track_wheel_down_command = "cycle audio", audio_track_wheel_up_command = "cycle audio down", - sub_track_mbtn_left_command = "script-binding select/select-sid; script-message-to osc osc-hide", + sub_track_mbtn_left_command = default_sub_command, sub_track_mbtn_mid_command = "show-text ${track-list/sub} 3000", sub_track_mbtn_right_command = "show-text ${track-list/sub} 3000", sub_track_wheel_down_command = "cycle sub", @@ -1866,7 +1869,13 @@ local function osc_init() return ("\238\132\134" .. osc_styles.smallButtonsLlabel .. " " .. (mp.get_property_native("aid") or "-") .. "/" .. audio_track_count) end - ne.eventresponder["mbtn_left_up"] = command_callback(user_opts.audio_track_mbtn_left_command) + if audio_track_count == 1 and + user_opts.audio_track_mbtn_left_command == default_audio_command then + ne.eventresponder["mbtn_left_up"] = command_callback("cycle audio") + else + ne.eventresponder["mbtn_left_up"] = command_callback( + user_opts.audio_track_mbtn_left_command) + end ne.eventresponder["shift+mbtn_left_up"] = command_callback( user_opts.audio_track_mbtn_mid_command) ne.eventresponder["mbtn_right_up"] = command_callback(user_opts.audio_track_mbtn_right_command) @@ -1886,7 +1895,11 @@ local function osc_init() return ("\238\132\135" .. osc_styles.smallButtonsLlabel .. " " .. (mp.get_property_native("sid") or "-") .. "/" .. sub_track_count) end - ne.eventresponder["mbtn_left_up"] = command_callback(user_opts.sub_track_mbtn_left_command) + if sub_track_count == 1 and user_opts.sub_track_mbtn_left_command == default_sub_command then + ne.eventresponder["mbtn_left_up"] = command_callback("cycle sub") + else + ne.eventresponder["mbtn_left_up"] = command_callback(user_opts.sub_track_mbtn_left_command) + end ne.eventresponder["shift+mbtn_left_up"] = command_callback(user_opts.sub_track_mbtn_mid_command) ne.eventresponder["mbtn_right_up"] = command_callback(user_opts.sub_track_mbtn_right_command)