From dc5f110844c3977963d4d384b54e5a3be2c43bc2 Mon Sep 17 00:00:00 2001 From: Carl Suster Date: Fri, 19 Apr 2019 17:27:52 +1000 Subject: [PATCH 1/3] mpdstats: use MPD_PORT env variable --- beetsplug/mpdstats.py | 2 +- docs/plugins/mpdstats.rst | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/beetsplug/mpdstats.py b/beetsplug/mpdstats.py index 876dcacdd..f232d87e9 100644 --- a/beetsplug/mpdstats.py +++ b/beetsplug/mpdstats.py @@ -326,7 +326,7 @@ class MPDStatsPlugin(plugins.BeetsPlugin): 'rating': True, 'rating_mix': 0.75, 'host': os.environ.get('MPD_HOST', u'localhost'), - 'port': 6600, + 'port': int(os.environ.get('MPD_PORT', 6600)), 'password': u'', }) mpd_config['password'].redact = True diff --git a/docs/plugins/mpdstats.rst b/docs/plugins/mpdstats.rst index 5472e7294..2e5e78c36 100644 --- a/docs/plugins/mpdstats.rst +++ b/docs/plugins/mpdstats.rst @@ -42,7 +42,8 @@ configuration file. The available options are: Default: The ``$MPD_HOST`` environment variable if set, falling back to ``localhost`` otherwise. - **port**: The MPD server port. - Default: 6600. + Default: The ``$MPD_PORT`` environment variable if set, + falling back to 6600 otherwise. - **password**: The MPD server password. Default: None. - **music_directory**: If your MPD library is at a different location from the From 21cba304bda60cd5f950bcbb2ab0175bdf389ca9 Mon Sep 17 00:00:00 2001 From: Carl Suster Date: Fri, 19 Apr 2019 17:28:02 +1000 Subject: [PATCH 2/3] mpdupdate: use MPD_PORT env variable --- beetsplug/mpdupdate.py | 2 +- docs/plugins/mpdupdate.rst | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/beetsplug/mpdupdate.py b/beetsplug/mpdupdate.py index 6ecc92131..72a98af0e 100644 --- a/beetsplug/mpdupdate.py +++ b/beetsplug/mpdupdate.py @@ -69,7 +69,7 @@ class MPDUpdatePlugin(BeetsPlugin): super(MPDUpdatePlugin, self).__init__() config['mpd'].add({ 'host': os.environ.get('MPD_HOST', u'localhost'), - 'port': 6600, + 'port': int(os.environ.get('MPD_PORT', 6600)), 'password': u'', }) config['mpd']['password'].redact = True diff --git a/docs/plugins/mpdupdate.rst b/docs/plugins/mpdupdate.rst index c846b917f..7ac647536 100644 --- a/docs/plugins/mpdupdate.rst +++ b/docs/plugins/mpdupdate.rst @@ -33,6 +33,7 @@ The available options under the ``mpd:`` section are: - **host**: The MPD server name. Default: The ``$MPD_HOST`` environment variable if set, falling back to ``localhost`` otherwise. - **port**: The MPD server port. - Default: 6600. + Default: The ``$MPD_PORT`` environment variable if set, falling back to 6600 + otherwise. - **password**: The MPD server password. Default: None. From 869d6b280fe9941192c0cfa4151c2bdf84d87ba3 Mon Sep 17 00:00:00 2001 From: Carl Suster Date: Fri, 19 Apr 2019 17:35:27 +1000 Subject: [PATCH 3/3] Changelog for #3223 --- docs/changelog.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 4ad0f057a..445847798 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -81,6 +81,9 @@ New features: to be displayed. Thanks to :user:`pprkut`. :bug:`3089` +* :doc:`/plugins/mpdstats`, :doc:`/plugins/mpdupdate`: Use the ``MPD_PORT`` + environment variable if no port is specified in the configuration file. + :bug:`3223` * :doc:`/plugins/bpd`: MPD protocol commands ``consume`` and ``single`` are now supported along with updated semantics for ``repeat`` and ``previous`` and new fields for ``status``. The bpd server now understands and ignores some