diff options
author | Wolfgang Müller | 2024-09-15 16:32:28 +0200 |
---|---|---|
committer | Wolfgang Müller | 2024-09-15 16:35:17 +0200 |
commit | dfbbff73bec2b172cb91ed4c3c92032d99130dd4 (patch) | |
tree | 7bccf5faf8a807e089524c26f9805e63b0db52ae /group-desktop/patches/media-sound | |
parent | afe0e5191c73fc0cbda744de64586a15b5c4f236 (diff) | |
download | portage-roles-dfbbff73bec2b172cb91ed4c3c92032d99130dd4.tar.gz |
group-desktop: Unmask media-sound/mpd-mpris and mpv-plugin/mpv-mpris
Additionally patch media-sound/mpd-mpris to support UNIX sockets since
the last release from 2023 does not include this feature yet.
Diffstat (limited to 'group-desktop/patches/media-sound')
-rw-r--r-- | group-desktop/patches/media-sound/mpd-mpris-0.4.1/0001-Allow-setting-unix-abstract-sockets-in-MPD_HOST.-47.patch | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/group-desktop/patches/media-sound/mpd-mpris-0.4.1/0001-Allow-setting-unix-abstract-sockets-in-MPD_HOST.-47.patch b/group-desktop/patches/media-sound/mpd-mpris-0.4.1/0001-Allow-setting-unix-abstract-sockets-in-MPD_HOST.-47.patch new file mode 100644 index 0000000..80de249 --- /dev/null +++ b/group-desktop/patches/media-sound/mpd-mpris-0.4.1/0001-Allow-setting-unix-abstract-sockets-in-MPD_HOST.-47.patch @@ -0,0 +1,59 @@ +From 4a10c25567adab6a67edf6ee43f3ff0128068dd9 Mon Sep 17 00:00:00 2001 +From: Elliot Thomas <elliot@midnightspark.net> +Date: Sun, 28 Jan 2024 20:58:08 +0000 +Subject: [PATCH] Allow setting unix/abstract sockets in MPD_HOST. (#47) + +* Change the network type to "unix" if the address taken from MPD_HOST starts with a slash. + +This more closely approximates the behaviour of libmpdclient. + +* Change the network type to unix also if addr starts with an at sign, + and account for this in embedded password handling code. + +This enables support for "abstract sockets", just like libmpdclient. + +* Add a link to the MPC documentation detailing the "--host" argument. + +This details how MPC parses the MPD_HOST environment variable. +--- + cmd/mpd-mpris/main.go | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/cmd/mpd-mpris/main.go b/cmd/mpd-mpris/main.go +index 8d5897b..9b8280c 100644 +--- a/cmd/mpd-mpris/main.go ++++ b/cmd/mpd-mpris/main.go +@@ -79,13 +79,17 @@ func main() { + flag.Parse() + password := getPassword() + if len(addr) == 0 { ++ // For a description of what can be in the the MPD_HOST environment variable, see: ++ // https://www.musicpd.org/doc/mpc/html/#cmdoption-host + env_host := os.Getenv("MPD_HOST") + if len(env_host) == 0 { + addr = "localhost" + detectLocalSocket() + } else { +- if strings.Index(env_host, "@") > -1 { +- addr_pwd := strings.Split(env_host, "@") ++ // When looking for the password delimiter, ignore the first character. ++ // An '@' sign at the start of the envvar signifies an "abstract socket" without password. ++ if strings.Index(env_host[1:], "@") > -1 { ++ addr_pwd := strings.SplitN(env_host, "@", 2) + // allow providing an alternative password on the command line + if len(password) == 0 { + password = addr_pwd[0] +@@ -94,6 +98,10 @@ func main() { + } else { + addr = env_host + } ++ // Check if addr refers to a path or abstract socket name and change network accordingly. ++ if strings.HasPrefix(addr, "/") || strings.HasPrefix(addr, "@") { ++ network = "unix" ++ } + } + } + +-- +2.46.0 + |