diff --git a/LGTV/__init__.py b/LGTV/__init__.py index fe21b26..c5db6fd 100644 --- a/LGTV/__init__.py +++ b/LGTV/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from __future__ import print_function from inspect import getfullargspec @@ -8,10 +7,15 @@ from time import sleep import logging import argparse -from .scan import LGTVScan -from .remote import LGTVRemote -from .auth import LGTVAuth -from .cursor import LGTVCursor + +PACKAGE_PATH = os.path.abspath(os.path.dirname(__file__)) +if PACKAGE_PATH not in sys.path: + sys.path.append(PACKAGE_PATH) + +from scan import LGTVScan +from remote import LGTVRemote +from auth import LGTVAuth +from cursor import LGTVCursor config_paths = [ @@ -21,6 +25,7 @@ "/opt/venvs/lgtv/config/config.json" ] + def get_commands(): text = 'commands\n' commands = LGTVRemote.getCommands() @@ -192,3 +197,5 @@ def main(): if __name__ == '__main__': main() + + diff --git a/LGTV/__main__.py b/LGTV/__main__.py new file mode 100644 index 0000000..a075393 --- /dev/null +++ b/LGTV/__main__.py @@ -0,0 +1,4 @@ +from __init__ import main +if __name__ == "__main__": + main() + diff --git a/LGTV/auth.py b/LGTV/auth.py index 91aacf2..5eb4618 100644 --- a/LGTV/auth.py +++ b/LGTV/auth.py @@ -5,7 +5,7 @@ import re import json -from .payload import hello_data +from payload import hello_data class LGTVAuth(WebSocketClient): diff --git a/LGTV/cursor.py b/LGTV/cursor.py index 42c460a..e060b92 100644 --- a/LGTV/cursor.py +++ b/LGTV/cursor.py @@ -3,7 +3,7 @@ import inspect from time import sleep -from .remote import LGTVRemote +from remote import LGTVRemote from ws4py.client.threadedclient import WebSocketClient diff --git a/LGTV/remote.py b/LGTV/remote.py index 1a3572b..5a5f787 100644 --- a/LGTV/remote.py +++ b/LGTV/remote.py @@ -9,7 +9,7 @@ import os import logging -from .payload import hello_data +from payload import hello_data class LGTVRemote(WebSocketClient): diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..0aba0cd --- /dev/null +++ b/build.bat @@ -0,0 +1,5 @@ +rem builds console and gui executables stored in the ./dist directory +rem run "python -m pip install pyinstaller" to get pyinstaller + +pyinstaller --clean --onefile --noconfirm --paths=.\LGTV --noconsole --name lgtv_gui lgtv.py +pyinstaller --clean --onefile --noconfirm --paths=.\LGTV lgtv.py diff --git a/lgtv.py b/lgtv.py new file mode 100644 index 0000000..bfcdd3d --- /dev/null +++ b/lgtv.py @@ -0,0 +1,4 @@ +from LGTV import main +if __name__ == "__main__": + main() +