]> kaliko git repositories - python-musicpd.git/commitdiff
Initialize host,port and pwd attribute in init
authorKaliko Jack <kaliko@azylum.org>
Mon, 10 Apr 2023 17:33:23 +0000 (19:33 +0200)
committerKaliko Jack <kaliko@azylum.org>
Mon, 10 Apr 2023 17:33:23 +0000 (19:33 +0200)
musicpd.py

index 7d0918c9e0f33277835452aab1509b4b9967dc00..35be751a0587960fd2c92ab470b3ee8ed4158119 100644 (file)
@@ -302,16 +302,20 @@ class MPDClient:
             "readmessages":       self._fetch_messages,
             "sendmessage":        self._fetch_nothing,
         }
+        #: host used with the current connection (:py:obj:`str`)
+        self.host = None
+        #: password detected in :envvar:`MPD_HOST` environment variable (:py:obj:`str`)
+        self.pwd = None
+        #: port used with the current connection (:py:obj:`int`, :py:obj:`str`)
+        self.port = None
         self._get_envvars()
 
     def _get_envvars(self):
         """
-        Retrieve MPD env. var. to overrides "localhost:6600"
-            Use MPD_HOST/MPD_PORT if set
-            else use MPD_HOST=${XDG_RUNTIME_DIR:-/run/}/mpd/socket if file exists
+        Retrieve MPD env. var. to overrides default "localhost:6600"
         """
+        # Set some defaults
         self.host = 'localhost'
-        self.pwd = None
         self.port = os.getenv('MPD_PORT', '6600')
         _host = os.getenv('MPD_HOST', '')
         if _host: