orontee / argos

Light weight front-end for Mopidy music server
GNU General Public License v3.0
24 stars 4 forks source link

Use zeroconf to discover servers #175

Closed orontee closed 5 months ago

orontee commented 6 months ago

Context

When the application is started for the fist time, it could help to have an automatically populated list of servers obtained through zeroconf.

Will also help while developing with multiple servers.

Analysis

When entering the preferences dialog, listen to the network for a service of type _mopidy-http._tcp. Display a label in preference dialog when a service is found. Add a button to update the base URL entry.

Case of multiple services

Don't try to handle multiple services to start with.

Mopidy behind a web server

When Mopidy isn't directly exposed, say there's nginx acting as a proxy, the port exported through the Mopidy's zeroconf implementation may be wrong. One must configure http.zeroconf to an empty string to disable Mopidy's zeroconf, and configure DNSSD by hand. It's easy using systemd-resolved for example.

Install systemd-resolved, disable avahi-daemon.

Enable mDNS on the network interface (this is persistent):

sudo nmcli conn modify ${IFACE_NAME} connection.mdns yes

For DNSSD, create the file /etc/systemd/dnssd/mopidy.dnssd with content:

[Service]
Name=%H
Type=_mopidy-http._tcp
Port=80

and restart systemd-resolved.

orontee commented 5 months ago

image

orontee commented 5 months ago

:question: Not clear whether there's a bug on second run of the preference dialog: Sometimes the information bar doesn't pop-up, because the service isn't discovered anymore or service information is missing...