[Pkg-mpd-commits] [python-mpd] 66/91: make port optional when connecting via unix socket
Simon McVittie
smcv at debian.org
Sat Feb 24 14:55:38 UTC 2018
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository python-mpd.
commit e1b9bc7868cba273e60751edab0114bbd0c220ab
Author: Jörg Thalheim <joerg at thalheim.io>
Date: Sun Apr 23 09:12:18 2017 +0200
make port optional when connecting via unix socket
fixes #84
---
doc/changes.rst | 1 +
mpd/base.py | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/doc/changes.rst b/doc/changes.rst
index 4280c31..fd9db20 100644
--- a/doc/changes.rst
+++ b/doc/changes.rst
@@ -10,6 +10,7 @@ Changes in v0.6.0 (unreleased)
consider using twisted instead, in future asyncio support will be added
* Introduce MPDClientBase class which provides common MPD communication related
helpers. Used as base for synchronous and asynchronous clients
+* port argument is optional when connecting via unix sockets
Changes in v0.5.5
diff --git a/mpd/base.py b/mpd/base.py
index 3f47548..50299fa 100644
--- a/mpd/base.py
+++ b/mpd/base.py
@@ -596,7 +596,7 @@ class MPDClient(MPDClientBase):
if self._sock is not None:
self._sock.settimeout(timeout)
- def connect(self, host, port, timeout=None):
+ def connect(self, host, port=None, timeout=None):
logger.info(
"Calling MPD connect(%r, %r, timeout=%r)", host, port, timeout)
if self._sock is not None:
@@ -610,6 +610,8 @@ class MPDClient(MPDClientBase):
if host.startswith("/"):
self._sock = self._connect_unix(host)
else:
+ if port is None:
+ raise ValueError("port argument must be specified when connecting via tcp")
self._sock = self._connect_tcp(host, port)
if IS_PYTHON2:
self._rfile = self._sock.makefile("r")
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mpd/python-mpd.git
More information about the Pkg-mpd-commits
mailing list