diff options
| author | Ben Winston | 2020-07-21 21:34:33 -0400 |
|---|---|---|
| committer | Ben Winston | 2020-07-21 21:34:33 -0400 |
| commit | 9e4a4403853f29fde33288ca2ebd0a33e9b5f034 (patch) | |
| tree | 5e28a2226c5542bec6f408507a072bef8017be50 | |
| parent | 1cb03f854f7598525a8228320bcc548a6a185d9a (diff) | |
pulled the IP address out to a config file
| -rwxr-xr-x | roku-cli.py | 16 |
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) |
