PDA

View Full Version : Web interface command to skip to next/previous track?



itm
2018-01-18, 07:13
I'm building a list of commands to control LMS from home-assistant via the LMS web interface. I can't find a command to skip to the next or previous track - does such a command exist?

mherger
2018-01-18, 07:47
> I'm building a list of commands to control LMS from home-assistant via
> the LMS web interface. I can't find a command to skip to the next or
> previous track - does such a command exist?

http://htmlpreview.github.io/?https://raw.githubusercontent.com/Logitech/slimserver/public/7.9/HTML/EN/html/docs/cli-api.html#playlist%20index


curl -X POST -d '{"id":0,"params":["00:04:20:ab:cd:ef",["playlist","index","+1"]],"method":"slim.request"}' http://yourserver:9000/jsonrpc.js

--

Michael

itm
2018-01-18, 07:56
> I'm building a list of commands to control LMS from home-assistant via
> the LMS web interface. I can't find a command to skip to the next or
> previous track - does such a command exist?

http://htmlpreview.github.io/?https://raw.githubusercontent.com/Logitech/slimserver/public/7.9/HTML/EN/html/docs/cli-api.html#playlist%20index

curl -X POST -d
'{"id":0,"params":["00:04:20:ab:cd:ef",["playlist","index","+1"]],"method":"slim.request"}'
http://yourserver:9000/jsonrpc.js

--

Michael

Thanks. I'm guessing that "00:04:20:ab:cd:ef" is the mac address of the player?

mherger
2018-01-18, 08:05
Thanks. I'm guessing that "00:04:20:ab:cd:ef" is the mac address of the player?

Yes.

itm
2018-01-18, 08:17
Yes.

Hmmm....I'm trying to shoehorn that into the JSON service data required by Home Assistant, but it's having no effect.

This is an example of JSON data that successfully plays an album:
{ "entity_id": "media_player.lounge_tv", "command": "playlist", "parameters": ["loadtracks", "album.titlesearch=abbey road"] }

So I tried this to emulate your command:
{ "entity_id": "media_player.lounge_tv", "command": "playlist", "parameters": ["index", "+1"] }

But no luck. Any guesses as to anything else I could try?

mherger
2018-01-18, 08:42
> This is an example of JSON data that successfully plays an album:
> { "entity_id": "media_player.lounge_tv", "command": "playlist",
> "parameters": ["loadtracks", "album.titlesearch=abbey road"] }

This is nothing LMS would understand. I guess there's some middle-ware
transforming this into a valid LMS request.

> So I tried this to emulate your command:
> { "entity_id": "media_player.lounge_tv", "command": "playlist",
> "parameters": ["index", "+1"] }

And this probably isn't part of the middle-ware.

Maybe you have some more information about the system you're using?

--

Michael

itm
2018-01-18, 08:47
> This is an example of JSON data that successfully plays an album:
> { "entity_id": "media_player.lounge_tv", "command": "playlist",
> "parameters": ["loadtracks", "album.titlesearch=abbey road"] }

This is nothing LMS would understand. I guess there's some middle-ware
transforming this into a valid LMS request.

> So I tried this to emulate your command:
> { "entity_id": "media_player.lounge_tv", "command": "playlist",
> "parameters": ["index", "+1"] }

And this probably isn't part of the middle-ware.

Maybe you have some more information about the system you're using?

--

Michael

Sorry I should have said...I'm using Home Assistant and its associated Squeezebox platform component. The entity_id identifies the device to be controlled (in this case media_player.lounge_tv).
https://home-assistant.io/components/media_player.squeezebox/

mherger
2018-01-18, 09:09
> Sorry I should have said...I'm using Home Assistant and its associated
> Squeezebox platform component. The entity_id identifies the device to be
> controlled (in this case media_player.lounge_tv).
> https://home-assistant.io/components/media_player.squeezebox/

I think you should get in touch with its author. Looking at that code
I'm seeing there's reference to next/previous already:

https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/media_player/squeezebox.py#L431


--

Michael