diff --git a/samsungctl/remote.py b/samsungctl/remote.py index d3bfd24..d3b1436 100644 --- a/samsungctl/remote.py +++ b/samsungctl/remote.py @@ -4,16 +4,12 @@ from . import exceptions from .remote_legacy import RemoteLegacy from .remote_websocket import RemoteWebsocket +from .remote_encrypted import RemoteEncrypted from .config import Config from .key_mappings import KEYS from .upnp import UPNPTV from .upnp.discover import discover -try: - from .remote_encrypted import RemoteEncrypted -except ImportError: - RemoteEncrypted = None - class KeyWrapper(object): def __init__(self, remote, key): @@ -36,12 +32,6 @@ def __call__(cls, conf): elif conf.method == "websocket": remote = RemoteWebsocket elif conf.method == "encrypted": - if RemoteEncrypted is None: - raise RuntimeError( - 'Python 2 is not currently supported ' - 'for H and J model year TV\'s' - ) - remote = RemoteEncrypted else: raise exceptions.ConfigUnknownMethod() @@ -51,7 +41,7 @@ class RemoteWrapper(remote, UPNPTV): def __init__(self, config): self.__name__ = config.name - + for name, key in KEYS.items(): self.__dict__[name] = KeyWrapper(self, key) diff --git a/samsungctl/upnp/UPNP_Device/upnp_class.py b/samsungctl/upnp/UPNP_Device/upnp_class.py index bcf2d57..7e0f0c7 100644 --- a/samsungctl/upnp/UPNP_Device/upnp_class.py +++ b/samsungctl/upnp/UPNP_Device/upnp_class.py @@ -22,11 +22,12 @@ class UPNPObject(object): + ip_address = None + _devices = {} + _services = {} def __init__(self, ip, locations, dump=''): self.ip_address = ip - - cls_name = None self._devices = {} self._services = {} for location in locations: @@ -116,13 +117,6 @@ def __init__(self, ip, locations, dump=''): ) self._devices[device.__name__] = device - if cls_name is None: - cls_name = node.find('modelName') - if cls_name is not None and cls_name.text: - cls_name = cls_name.text.replace(' ', '_').replace('-', '') - - self.__name__ = cls_name - def __getattr__(self, item): if item in self.__dict__: return self.__dict__[item] diff --git a/samsungctl/upnp/__init__.py b/samsungctl/upnp/__init__.py index b15554d..e14a2c1 100644 --- a/samsungctl/upnp/__init__.py +++ b/samsungctl/upnp/__init__.py @@ -12,6 +12,12 @@ class UPNPTV(UPNPObject): + _dtv_information = None + _tv_options = None + name = None + ip_address = None + _connected = False + _locations = None def __init__(self, ip, locations): self._dtv_information = None diff --git a/samsungctl/websocket_base.py b/samsungctl/websocket_base.py index ea6a38b..1420334 100644 --- a/samsungctl/websocket_base.py +++ b/samsungctl/websocket_base.py @@ -12,7 +12,14 @@ class WebSocketBase(object): """Base class for TV's with websocket connection.""" - + config = None + sock = None + _loop_event = None + _registered_callbacks = None + _starting = False + _running = None + _thread = None + @LogIt def __init__(self, config): """