Improve mpv doublequote sanitisation
This commit is contained in:
parent
2da8e84bba
commit
551ad965aa
@ -357,6 +357,7 @@ function handle_enter()
|
||||
if line == '' then
|
||||
return
|
||||
end
|
||||
line = string.gsub(line,"\"", "\\\"")
|
||||
mp.command('print-text "<chat>'..line..'</chat>"')
|
||||
clear()
|
||||
end
|
||||
|
||||
@ -96,6 +96,7 @@ class MplayerPlayer(BasePlayer):
|
||||
username = self._sanitizeText(username)
|
||||
message = self._sanitizeText(message)
|
||||
messageString = u"<{}> {}".format(username, message)
|
||||
messageString = self._sanitizeText(messageString)
|
||||
self._listener.sendLine(u'script-message-to syncplayintf chat "{}"'.format(messageString))
|
||||
|
||||
def setSpeed(self, value):
|
||||
@ -140,9 +141,13 @@ class MplayerPlayer(BasePlayer):
|
||||
def _sanitizeText(self, text):
|
||||
text = text.replace("\r", "")
|
||||
text = text.replace("\n", "")
|
||||
text = text.replace("\\\"", "<SYNCPLAY_QUOTE>")
|
||||
text = text.replace("\"", "<SYNCPLAY_QUOTE>")
|
||||
text = text.replace("\\", u"\\\\\\uFEFF")
|
||||
text = text.replace("{", "\\\\{")
|
||||
text = text.replace("}", "\\\\}")
|
||||
text = text.replace("}", "\\\\}")
|
||||
text = text.replace("<SYNCPLAY_QUOTE>","\\\"")
|
||||
return text
|
||||
|
||||
def _quoteArg(self, arg):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user