aboutsummaryrefslogtreecommitdiff
path: root/tools/EventClients/Clients
diff options
context:
space:
mode:
authorLukas Rusak <lorusak@gmail.com>2021-10-05 23:15:43 -0700
committerLukas Rusak <lorusak@gmail.com>2021-10-13 20:13:17 -0700
commitbeb47d41eac9385b2ab900a8a34d09ce96405e85 (patch)
treedd7067d2bf63e5b563e70387a31850ac50a47346 /tools/EventClients/Clients
parent41c945c44b62d2112c0bb2d4334f8da5ecb2b4df (diff)
kodi-send.py: add the ability to send mouse position
Diffstat (limited to 'tools/EventClients/Clients')
-rwxr-xr-xtools/EventClients/Clients/KodiSend/kodi-send.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/EventClients/Clients/KodiSend/kodi-send.py b/tools/EventClients/Clients/KodiSend/kodi-send.py
index c1b7960b89..2760b11f2e 100755
--- a/tools/EventClients/Clients/KodiSend/kodi-send.py
+++ b/tools/EventClients/Clients/KodiSend/kodi-send.py
@@ -29,6 +29,7 @@ except:
sys.path.append(os.path.join(os.path.realpath(os.path.dirname(__file__)), '../../lib/python'))
from xbmcclient import *
+TYPE_MOUSE = 'mouse'
TYPE_NOTIFICATION = 'notification'
TYPE_LOG = 'log'
TYPE_ACTION = 'action'
@@ -55,6 +56,7 @@ def usage():
print("\t--port=PORT\t\t\tChoose what PORT to connect to (default=9777)")
print("\t--keymap=KEYMAP\t\t\tChoose which KEYMAP to use for key presses (default=KB)")
print('\t--button=BUTTON\t\t\tSends a key press event to Kodi, this option can be added multiple times to create a macro')
+ print('\t--mouse=X,Y\t\t\tSends the mouse position to Kodi')
print("\t--log=MESSAGE\t\t\tSends a log message to Kodi")
print("\t--loglevel=LEVEL\t\tSets the log level when using --log= (default=LOGDEBUG)")
print("\t--notification=MESSAGE\t\tSends a notification to Kodi")
@@ -64,7 +66,7 @@ def usage():
def main():
try:
- opts, args = getopt.getopt(sys.argv[1:], "?pa:d:v", ["help", "host=", "port=", "keymap=", "button=", "log=", "loglevel=", "notification=", "action=", "delay="])
+ opts, args = getopt.getopt(sys.argv[1:], "?pa:d:v", ["help", "host=", "port=", "keymap=", "button=", "mouse=", "log=", "loglevel=", "notification=", "action=", "delay="])
except getopt.GetoptError as err:
# print help information and exit:
print(str(err)) # will print something like "option -a not recognized"
@@ -88,6 +90,8 @@ def main():
keymap = a
elif o == "--button":
actions.append({'type': TYPE_BUTTON, 'content': a})
+ elif o == "--mouse":
+ actions.append({'type': TYPE_MOUSE, 'content': a})
elif o == "--log":
actions.append({'type': TYPE_LOG, 'content': a})
elif o == "--loglevel":
@@ -114,6 +118,10 @@ def main():
packet = PacketACTION(actionmessage=action['content'], actiontype=ACTION_BUTTON)
elif action['type'] == TYPE_BUTTON:
packet = PacketBUTTON(code=0, repeat=0, down=1, queue=1, map_name=keymap, button_name=action['content'], amount=0)
+ elif action['type'] == TYPE_MOUSE:
+ x = int(action['content'].split(',')[0])
+ y = int(action['content'].split(',')[1])
+ packet = PacketMOUSE(x=x, y=y)
elif action['type'] == TYPE_DELAY:
time.sleep(action['content'] / 1000.0)
continue