[modules/mpd] make mpd port configurable

fixes #941
This commit is contained in:
tobi-wan-kenobi 2022-11-27 17:41:48 +01:00
parent 87a2890b48
commit a6f2e6fc5e

View file

@ -42,6 +42,7 @@ Parameters:
if {file} = '/foo/bar.baz', then {file2} = 'bar' if {file} = '/foo/bar.baz', then {file2} = 'bar'
* mpd.host: MPD host to connect to. (mpc behaviour by default) * 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. * 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 <https://github.com/alrayyes>`_ - many thanks! contributed by `alrayyes <https://github.com/alrayyes>`_ - many thanks!
@ -73,10 +74,12 @@ class Module(core.module.Module):
self._repeat = False self._repeat = False
self._tags = defaultdict(lambda: "") self._tags = defaultdict(lambda: "")
if not self.parameter("host"): self._hostcmd = ""
self._hostcmd = "" if self.parameter("host"):
else: self._hostcmd = " -h {}".format(self.parameter("host"))
self._hostcmd = " -h " + self.parameter("host") if self.parameter("port"):
self._hostcmd += " -p {}".format(self.parameter("port"))
# Create widgets # Create widgets
widget_map = {} widget_map = {}