snapcast icon indicating copy to clipboard operation
snapcast copied to clipboard

Feature Request - allow to change name via args (Hostname override)

Open Links2004 opened this issue 4 years ago • 9 comments

It looks like that he name of the Clients is currently simple the Hostname of the device. for the use cases where multible clients run on the same device a command args to override the use of the Hostname to a user defined name will be a big help.

Links2004 avatar Dec 14 '19 10:12 Links2004

The hostname is just a default for the client name. Specifying a different client default name would be a feature to think about, but in the end it will be only a default. The actual name is configured on the server, mapped from the client's unique ID. In case of multiple clients, you must add an instance id -i or --instance to have a unique ID per client.

badaix avatar Dec 14 '19 10:12 badaix

the problem with changing the name later via API / APP is that if the server and client are stopped and started again the information of the name change is lost. when both where down in the same time frame. is there a way to store the name change in the config file of the server, and load the config again on startup?

currently I have the following opts on the client:

SNAPCLIENT_OPTS1="--host x.x.x.x -s 1 --hostID stereo1 -i 1"
SNAPCLIENT_OPTS2="--host x.x.x.x -s 2 --hostID stereo2 -i 2"
SNAPCLIENT_OPTS3="--host x.x.x.x -s 3 --hostID stereo3 -i 3"

Note: the 3 opts lines are used by 3 different snapclient.service files.

Links2004 avatar Dec 14 '19 11:12 Links2004

PR open #516

Links2004 avatar Dec 16 '19 11:12 Links2004

thanks for the PR, I will review it. But I'm wondering why your changes are lost after server restart. Is this only true for client names or does the server loose all changes after restart?

badaix avatar Dec 17 '19 19:12 badaix

good question, I am not sure what all normally is saved but It looses basically every setting this includes groups volume and mute. where is the data stored when started via systemd?

may its a file system write access problem, the server is running in a LXC container on my proxmox server and has currently has two streams, a mopidy Instance that is running in the same LXC container and a gstreamer udpsrc where I stream my PC audio too.

Links2004 avatar Dec 18 '19 07:12 Links2004

Are updates made via the JSON-RPC API supposed to stick? I lose streams, groups, basically everything I set from a different service that sets everything up based on an outside config dynamically.

eoware avatar Jan 24 '20 21:01 eoware

I'm also interested on that. Mostly because I'm using Docker containers for both Server and Client, so whenever my docker host restarts, the client container is assigned with a new Id. Is it possible to override the Client Id with a fixed value so that my configurations are "persisted" through restarts?

Edit: Actually I found a way in my case. What happens is that whenever I restart the host, my docker container is assigned with a new MAC Address, which is used to identify the client. I had to specify a fixed MAC Address on my docker-compose and now the groups and clients are persisted even thought host/clients are restarted.

RoggerFabri avatar Jan 20 '21 16:01 RoggerFabri

You can override the host id with --hostID:

snapclient --help
Allowed options:
  --help                          produce help message
  -v, --version                   show version number
  -h, --host arg                  server hostname or ip address
  -p, --port arg (=1704)          server port
  -i, --instance arg (=1)         instance id when running multiple instances on the same host
  --hostID arg                    unique host id, default is MAC address
...

badaix avatar Jan 20 '21 17:01 badaix

You can override the host id with --hostID:

snapclient --help
Allowed options:
  --help                          produce help message
  -v, --version                   show version number
  -h, --host arg                  server hostname or ip address
  -p, --port arg (=1704)          server port
  -i, --instance arg (=1)         instance id when running multiple instances on the same host
  --hostID arg                    unique host id, default is MAC address
...

Thanks, much better this way :)

RoggerFabri avatar Jan 20 '21 17:01 RoggerFabri