From 9e4a4403853f29fde33288ca2ebd0a33e9b5f034 Mon Sep 17 00:00:00 2001 From: Ben Winston Date: Tue, 21 Jul 2020 21:34:33 -0400 Subject: pulled the IP address out to a config file --- roku-cli.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'roku-cli.py') 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) -- cgit v1.2.3