本文整理汇总了Python中mpd.MPDClient.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python MPDClient.__init__方法的具体用法?Python MPDClient.__init__怎么用?Python MPDClient.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpd.MPDClient
的用法示例。
在下文中一共展示了MPDClient.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from mpd import MPDClient [as 别名]
# 或者: from mpd.MPDClient import __init__ [as 别名]
def __init__(self, host, port, password, datadir=None):
MPDClient.__init__(self)
if not self.connection(host, port, password):
self.disconnect()
raise NameError("Mauvais hôte ou mot de passe MPD")
if not datadir:
self.datadir = None
else:
self.datadir = datadir
示例2: __init__
# 需要导入模块: from mpd import MPDClient [as 别名]
# 或者: from mpd.MPDClient import __init__ [as 别名]
def __init__(self, use_unicode=False):
self.__host = self.config.get("mpd","host")
self.__port = self.config.get("mpd","port")
self.__timeout = 10
#MPDClient.__init__(self, *a, **k)
MPDClient.__init__(self,use_unicode = use_unicode)
self.use_unicode = use_unicode
self._lock = Lock()
示例3: __init__
# 需要导入模块: from mpd import MPDClient [as 别名]
# 或者: from mpd.MPDClient import __init__ [as 别名]
def __init__(self):
self._cache = {}
MPDClientBase.__init__(self)
if hasattr(MPDClientBase, '_writecommand'):
self._commands.update({'rescan': self._getitem
,'single': self._getnone
,'consume': self._getnone
,'idle': self._getlist
,'noidle': None
})
示例4: __init__
# 需要导入模块: from mpd import MPDClient [as 别名]
# 或者: from mpd.MPDClient import __init__ [as 别名]
def __init__(self, host, port, password):
MPDClient.__init__(self)
try:
self.connect(host=host, port=port)
except __import__("socket").gaierror:
print("Couldn't connect to {0}:{1}".format(host, port))
exit(1)
except __import__("socket").error:
print("Couldn't connect using port {0}, but there seems to be a server at that IP.".format(port))
exit(1)
if password:
try:
self.password(password)
except CommandError:
exit(1)
print("Connected to {0}:{1}".format(host, port))