philchillbill wrote: 
> I need the user's local IP address and port to enable playing music on
> an Echo device as speaker rather than a Squeezebox. When the user
> account-links, I only get their external address (e.g. ngrok).

As Craig mentioned there's no easy, one shot solution to this built in
to LMS. That's why he implemented his own. I could probably add that
little information to the serverstatus query. But then you'd still have
to tell your users to install the latest and greatest (still to be
built) version of LMS.

Until then I see two options/workarounds: the server's IP address is
part of the server information which is eg. printed in 

http://localhost:9000/settings/server/status.html

You could grab this page and try to parse it. Ugly business.

A little less ugly: the same information is provided in the system
information menu, available through the "systeminfo" query. The
following would give you the top level menu:


Code:
--------------------
    [
  "systeminfo",
  "items",
  0, 999,
  "menu:1"
  ]
--------------------


The first item in the result loop would be the server information
sub-menu. 


Code:
--------------------
    {
  "result": {
  "item_loop": [
  {
  "addAction": "go",
  "actions": {
  "go": {
  "params": {
  "item_id": "5f431c9f.0",
  "menu": "systeminfo"
  },
  "cmd": [
  "systeminfo",
  "items"
  ]
  }
  },
  "text": "Logitech Media Server"
  },
  ...
  
--------------------


Take that item_id to get the list of items:


Code:
--------------------
    [
  "systeminfo",
  "items",
  0, 999,
  "menu:1",
  "item_id:5f431c9f.0"
  ]
--------------------


That in turn would get you a list of information pieces about your
server. "Unfortunately" those items are localized. The one you're
looking for is usually starting with the literal uppercase "IP". Only
Polish and Russian would be slightly different. 


Code:
--------------------
    {
  ...
  "result": {
  "item_loop": [
  {
  "text": "Logitech Media Server Version: 7.9.2 - git-cf0829403 @ 2019-10-26 
11:54:03 +0200",
  "type": "text",
  "style": "itemNoAction",
  "action": "none"
  },
  {
  "action": "none",
  "style": "itemNoAction",
  "type": "text",
  "text": "IP: 192.168.0.74"
  },
  ....
--------------------


But filtering the item loop on "text" using the regex
"IP.*:\s*(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})" should get you the
address :D.



Michael

http://www.herger.net/slim-plugins - Spotty, MusicArtistInfo
------------------------------------------------------------------------
mherger's Profile: http://forums.slimdevices.com/member.php?userid=50
View this thread: http://forums.slimdevices.com/showthread.php?t=111016

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to