aboutsummaryrefslogtreecommitdiff
path: root/roku-cli.py
diff options
context:
space:
mode:
authorBen Winston2020-07-21 21:34:33 -0400
committerBen Winston2020-07-21 21:34:33 -0400
commit9e4a4403853f29fde33288ca2ebd0a33e9b5f034 (patch)
tree5e28a2226c5542bec6f408507a072bef8017be50 /roku-cli.py
parent1cb03f854f7598525a8228320bcc548a6a185d9a (diff)
pulled the IP address out to a config file
Diffstat (limited to 'roku-cli.py')
-rwxr-xr-xroku-cli.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/roku-cli.py b/roku-cli.py
index 1eb59de..ea9ccdd 100755
--- a/roku-cli.py
+++ b/roku-cli.py
@@ -3,6 +3,15 @@
import requests
import time
import curses
+from configparser import ConfigParser
+from pathlib import Path
+
+class RokuConfig:
+
+ def __init__(self, config_file):
+ config = ConfigParser()
+ config.read(Path(config_file).expanduser())
+ self.ip = config['general']['roku_ip']
class RemoteKey:
@@ -122,7 +131,7 @@ def main(stdscr, ip):
stdscr.clear()
# create the remote
- remote = RokuRemote(ip)
+ remote = RokuRemote(config.ip)
status(stdscr)
@@ -138,5 +147,6 @@ def init_curses():
if __name__ == '__main__':
- ip = '192.168.1.1' # this is the ip of your roku
- curses.wrapper(main, ip)
+ config_file = '~/.config/roku/roku.config'
+ config = RokuConfig(config_file)
+ curses.wrapper(main, config)