Obtain/extract snapserver's ip from snapclient machine #733
Replies: 6 comments
-
hey hey principal idea is parsing the ip out of the arguments with which a running snapclient process is running
|
Beta Was this translation helpful? Give feedback.
-
beeing a bit more platform specific you could just expect the ip to which the snapclient connets to is configured in /etc/default/snapclient and get it out it, the same way as the systemd service does it
|
Beta Was this translation helpful? Give feedback.
-
okay, this make the "find out the server and send bluetooth data to it" step flexible, like i asked. My snapclient configuration(s) don't take the |
Beta Was this translation helpful? Give feedback.
-
oh there is another method how a snapclient finds a snapserver? how? via avahi? if so i did not know of, so yes, this would then not work, sorry :/ |
Beta Was this translation helpful? Give feedback.
-
I thinks is avahi but i'm not sure. For now i'm sticking with the logs parsing. It's kinda dirty if if you think about it, but works very well on practice. Until now i had no problems, and now i'm able to connect to any client's bluetooth. more thoughts:Maybe one day we could open a feature request, where it would add a new capabilitie to snapclient:
this would be better than my general workarround: extract server ip ---_ \ \/ send audio data to server --> server send audio stream to clients because the snapclient already know who is the server, and could cache the audio data, so then the server woul just send timestamps without data to this client. |
Beta Was this translation helpful? Give feedback.
-
If anyone is trying to do something similar, for curiosity or to save time, check my repo: spotifypiHome |
Beta Was this translation helpful? Give feedback.
-
This issue is neither a feature request nor a bug notification.
TLDR:
I want to know if there is someway to obtain the snapserver ip that the snapclient is connected, from the snapclient machine.
Motivation behind:
I'am using snapcast with spotify connect, airplay and bluetooth support.
Then i have playback control in all rooms (no problem).
So my idea was: instead of beeing tied to the snapserver machine's bluetooth, i could use the snapclient machines bluetooth too, configure alsa to output to a fifo file, and send the fifo file data back to snapserver through a tcp socket (since snapcast supports tcp), and then the snapserver would to his job of always (syncing).
I got this working already, but i had to hardcode the snapserver ip. But i don't want to make code specific for myself, i want to be a general solution.
My solution idea
So, i was thinking of extract the snapServer ip from the snapclient logs, like this:
the logs, from
$ journalctl -u snapclient
using this command:
$ journalctl -b -r -u snapclient.service | grep -m 1 -o -P "(?<=Connected to ).*"
which would extract the ip from the last occurrence Connected to <server ip>
but...
This feels like an unstable workarround, so my question is: is there any other more robust way to find out which server the snapclient is connected to?
Beta Was this translation helpful? Give feedback.
All reactions