(mpv) Add config option to allow/block direct chat input

This commit is contained in:
Etoh 2017-08-05 16:56:07 +01:00
parent cc8723babd
commit 8415c93b04
3 changed files with 15 additions and 8 deletions

View File

@ -100,7 +100,7 @@ function chat_update()
end
end
if use_alpha_rows_for_chat == false then
if use_alpha_rows_for_chat == false and opts['chatDirectInput'] == true then
local alphawarning_ass = assdraw.ass_new()
alphawarning_ass = "{\\a6}You can temporarily use old mpv bindings with a-z keys.\n{\\a6}Press [TAB] to return to Syncplay chat mode." -- TODO: Move message to messages.py
ass:append(alphawarning_ass)
@ -250,7 +250,8 @@ opts = {
['chatMaxLines'] = 7,
['chatTopMargin'] = 25,
['chatLeftMargin'] = 20,
['chatBottomMargin'] = 30
['chatBottomMargin'] = 30,
['chatDirectInput'] = true
}
function detect_platform()
@ -297,7 +298,7 @@ local repl_active = false
local insert_mode = false
local line = ''
local cursor = 1
local key_hints_enabled = true
local key_hints_enabled = false
function input_ass()
if not repl_active then
@ -731,8 +732,6 @@ add_alpharowbinding('#','#')
add_alpharowbinding('~','~')
add_alpharowbinding('\'','\'')
add_alpharowbinding('@','@')
add_repl_alpharow_bindings(alpharowbindings)
mp.add_forced_key_binding('tab', handle_tab)
add_repl_bindings(bindings)
@ -764,4 +763,10 @@ function set_syncplayintf_options(input)
chat_format = get_output_style()
local vertical_output_area = CANVAS_HEIGHT-(opts['chatTopMargin']+opts['chatBottomMargin'])
max_scrolling_rows = math.floor(vertical_output_area/opts['chatOutputFontSize'])
if opts['chatDirectInput'] == true then
add_repl_alpharow_bindings(alpharowbindings)
mp.add_forced_key_binding('tab', handle_tab)
key_hints_enabled = true
else
end
end

View File

@ -176,7 +176,7 @@ MPV_ARGS = ['--force-window', '--idle', '--hr-seek=always', '--keep-open']
MPV_SLAVE_ARGS = ['--msg-level=all=error,cplayer=info,term-msg=info', '--input-terminal=no', '--input-file=/dev/stdin']
MPV_SLAVE_ARGS_NEW = ['--term-playing-msg=<SyncplayUpdateFile>\nANS_filename=${filename}\nANS_length=${=length:${=duration:0}}\nANS_path=${path}\n</SyncplayUpdateFile>', '--terminal=yes']
MPV_NEW_VERSION = False
MPV_SYNCPLAYINTF_OPTIONS_TO_SEND = ["chatInputFontFamily", "chatInputFontSize", "chatInputFontWeight", "chatInputFontUnderline", "chatInputFontColor", "chatInputPosition"]
MPV_SYNCPLAYINTF_OPTIONS_TO_SEND = ["chatInputFontFamily", "chatInputFontSize", "chatInputFontWeight", "chatInputFontUnderline", "chatInputFontColor", "chatInputPosition","chatDirectInput"]
MPV_SYNCPLAYINTF_CONSTANTS_TO_SEND = ["MaxChatMessageLength={}".format(MAX_CHAT_MESSAGE_LENGTH)]
VLC_SLAVE_ARGS = ['--extraintf=luaintf', '--lua-intf=syncplay', '--no-quiet', '--no-input-fast-seek',
'--play-and-pause', '--start-time=0']

View File

@ -70,7 +70,8 @@ class ConfigurationGetter(object):
"chatInputFontWeight" : constants.DEFAULT_CHAT_INPUT_FONT_WEIGHT,
"chatInputFontUnderline": False,
"chatInputFontColor": constants.DEFAULT_CHAT_INPUT_FONT_COLOR,
"chatInputPosition": constants.INPUT_POSITION_TOP
"chatInputPosition": constants.INPUT_POSITION_TOP,
"chatDirectInput": True,
}
self._defaultConfig = self._config.copy()
@ -115,6 +116,7 @@ class ConfigurationGetter(object):
"onlySwitchToTrustedDomains",
"chatInputEnabled",
"chatInputFontUnderline",
"chatDirectInput"
]
self._tristate = [
"checkForUpdatesAutomatically",
@ -160,7 +162,7 @@ class ConfigurationGetter(object):
"chatInputEnabled","chatInputFontUnderline",
"chatInputFontFamily", "chatInputFontSize",
"chatInputFontWeight", "chatInputFontColor",
"chatInputPosition"],
"chatInputPosition","chatDirectInput"],
"general": ["language", "checkForUpdatesAutomatically",
"lastCheckedForUpdates"]
}