tobi-wan-kenobi / bumblebee-status

bumblebee-status is a modular, theme-able status line generator for the i3 window manager.
https://bumblebee-status.readthedocs.io/en/main/
MIT License
1.2k stars 229 forks source link

MPD Module has no facility to specify port #941

Closed l1dge closed 1 year ago

l1dge commented 1 year ago

Bug Report

Description

Affected module: mpd Version used: AUR 2.1.6-1

If your mpd server is running on a non-default port there is no way to specify the port in the module settings.

How to reproduce

If you run the mpd module in your bumblebee config it will not appear in the status bar if your mpd server runs on a non-default port.

A simple fix I did was to change the code in the mpd.py file as follows:

Added the second line to the docstring:

    * mpd.host: MPD host to connect to. (mpc behaviour by default)
    * mpd.port: MPD port to connect to. (mpc behaviour by default)

Replaced this code:

if not self.parameter("host"):
            self._hostcmd = ""
        else:
            self._hostcmd = " -h " + self.parameter("host")

with this:

if not self.parameter("host"):
            self._hostcmd = ""
        elif self.parameter("host"):
            if not self.parameter("port"):
                self._hostcmd = " -h " + self.parameter("host")
            else:
                self._hostcmd = " -h " + self.parameter("host") + " -p " + self.parameter("port")

Everything functions as expected after the change.

tobi-wan-kenobi commented 1 year ago

Thanks for the report @l1dge , and for the fix suggestion!

Hope this commit fixes it (I am not using mpd, so I have a hard time checking it). I slightly cleaned up the code while at it, if I introduced any issues, please do let me know.

Thank you kindly!

l1dge commented 1 year ago

@tobi-wan-kenobi Works great, thanks for the quick turnaround.