-
Notifications
You must be signed in to change notification settings - Fork 6
/
kodiremote
executable file
·27 lines (26 loc) · 1.1 KB
/
kodiremote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python2
import argparse
import logging
import curses
from koditools.remote import Remote
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('--host', dest='host', action='store')
parser.add_argument('-p', '--port', dest='port', type=int, default=None)
parser.add_argument('-e', '--event-port', dest='eport', type=int,
default=None)
parser.add_argument('-k', dest='key', action='store', help='Key to send')
parser.add_argument('-c', '--client', dest='client', action='store_true',
default=False)
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
default=False)
args = parser.parse_args()
logging.root.name = 'kodiremote'
if args.verbose:
logging.basicConfig(level=logging.DEBUG)
if args.client:
r = Remote(args.host, args.port, args.eport, init=False)
curses.wrapper(r.run)
elif args.key:
r = Remote(args.host, args.port, args.eport)
r.command(args.key)