From a6f2e6fc5e41615ee0216c5f4926e692373ebfda Mon Sep 17 00:00:00 2001 From: tobi-wan-kenobi Date: Sun, 27 Nov 2022 17:41:48 +0100 Subject: [PATCH] [modules/mpd] make mpd port configurable fixes #941 --- bumblebee_status/modules/contrib/mpd.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bumblebee_status/modules/contrib/mpd.py b/bumblebee_status/modules/contrib/mpd.py index 92568d1..35cb2f6 100644 --- a/bumblebee_status/modules/contrib/mpd.py +++ b/bumblebee_status/modules/contrib/mpd.py @@ -42,6 +42,7 @@ Parameters: if {file} = '/foo/bar.baz', then {file2} = 'bar' * mpd.host: MPD host to connect to. (mpc behaviour by default) + * mpd.port: MPD port to connect to. (mpc behaviour by default) * mpd.layout: Space-separated list of widgets to add. Possible widgets are the buttons/toggles mpd.prev, mpd.next, mpd.shuffle and mpd.repeat, and the main display with play/pause function mpd.main. contributed by `alrayyes `_ - many thanks! @@ -73,10 +74,12 @@ class Module(core.module.Module): self._repeat = False self._tags = defaultdict(lambda: "") - if not self.parameter("host"): - self._hostcmd = "" - else: - self._hostcmd = " -h " + self.parameter("host") + self._hostcmd = "" + if self.parameter("host"): + self._hostcmd = " -h {}".format(self.parameter("host")) + if self.parameter("port"): + self._hostcmd += " -p {}".format(self.parameter("port")) + # Create widgets widget_map = {}