Merge pull request #442 from oddstr13/beware-of-the-binary

Pass hexlify bytes in helper.utils.event
This commit is contained in:
mcarlton00 2020-12-10 19:29:43 -05:00 committed by GitHub
commit 60920342cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,7 +13,7 @@ from uuid import uuid4
from distutils.version import LooseVersion
from dateutil import tz, parser
from six import text_type, string_types, iteritems
from six import text_type, string_types, iteritems, ensure_text, ensure_binary
from six.moves.urllib.parse import quote_plus
from kodi_six import xbmc, xbmcaddon, xbmcgui, xbmcvfs
@ -137,13 +137,14 @@ def event(method, data=None, sender=None, hexlify=False):
sender = sender or "plugin.video.jellyfin"
if hexlify:
data = '\\"[\\"{0}\\"]\\"'.format(binascii.hexlify(json.dumps(data)))
else:
data = ensure_text(binascii.hexlify(ensure_binary(json.dumps(data))))
data = '"[%s]"' % json.dumps(data).replace('"', '\\"')
xbmc.executebuiltin('NotifyAll(%s, %s, %s)' % (sender, method, data))
LOG.debug("---[ event: %s/%s ] %s", sender, method, data)
xbmc.executebuiltin('NotifyAll(%s, %s, %s)' % (sender, method, data))
def dialog(dialog_type, *args, **kwargs):