aditya-K2 / gomp

MPD client inspired by ncmpcpp with builtin cover-art view and LastFM integration.
GNU General Public License v3.0
86 stars 2 forks source link

Adding fallback values in case no mpd config file is found #64

Open PolarFill opened 3 months ago

PolarFill commented 3 months ago

Hi! I recently tried to package gomp for NixPkgs. However, i discovered a very specific "bug" (or intended behavior) that makes the process difficult.

In it's current state, gomp crashes if no mpd config is found anywhere, throwing a No File Found at path : /etc/mpd.conf. The problem is, in NixOS, if you configure mpd in a declarative manner with the default settings attrset, it will write the configuration to the nix store, which makes it so that it can't be found by gomp, and the config path can't be patched from the nix derivation in a reproducible manner either. Besides that, this behavior causes custom mpd.conf paths in any other distro to not work.

What would fix the issue is if the application defined a fallback default value to avoid these types of crashes. So, for example, if the mpd config file wasn't found, the default mpd port (6600) would be set and could be overridden from gomp's config file.

Gomp seems like a great music player, and it's one of the few that provides native last.fm support, so I would be very happy to package it for nixpkgs! Thanks for continuously developing this application. If you need any additional info about the problem, feel free to ask.

aditya-K2 commented 2 months ago

Currently, gomp uses the mpd.conf file for setting the defaults. Mainly MUSIC_DIRECTORY and MPD_PORT. It is assumed that the user has created a mpd.conf at either XDG_CONFIG/mpd/mpd.conf or /etc/mpd.conf (Per-user configuration and System wide configuration respectively). This decision was made mainly as to cause low user configuration over-head. But you are right, this doesn't take into consideration custom configurations that can be provided to mpd (And, as it looks like some other configuration paths that mpd looks for). I think it's better to have the user provide the bare minimum configuration options in the config file like ncmpcpp does.

mpd_host - Should point to the host on which mpd resides, can be "localhost", "127.0.0.1" or "::1" if on the same machine. To connect with a password, write "password@host" mpd_port - The default of mpd should be "6600" mpd_music_dir - The same directory value as specified in "music_directory" in mpd.conf
From ArchWiki

Will this solve your use case?