@lolodomo,
I agree on not forcing users into Lua for the simple stuff.
My comments are intended to ensure that the convenience functions that we do provide don’t get “overloaded” with long lists of complex parameters and/or conflicting ones, since that will be just as confusing as having to jump into Lua.
If you look at the core convenience functions we’re providing today, it’s basically PlayURI and Say. There are others, but these are the core of the ones that’ll be used commonly. These need to remain dead-simple.
Given their combined functions, I believe PlayURI is starting to be overloaded in a couple of areas:
a) Play functions are starting to deal with Queue management AND;
b) Potential of Play dealing with both permanent, and transient, content play
I think that something like the following could cover most of the bases:
[ul][li]MiOS.Play()[/li]
[li]Sonos1.PlayURI(uri, volume)[/li]
[li]Sonos1.Say(text, language, volume, groupDevices)[/li]
[li]Sonos1.Alert(uri, volume, groupDevices)[/li]
[li]Sonos1.Enqueue(uri, mode)[/li]
[li]Sonos1.SaveContext()[/li]
[li]Sonos1.RestoreContext()[/li][/ul]
This removes any form of queue management from the Play method. It remains simple, and has a pre-defined behavior that [hopefully] most people want.
If folks want to enqueue at a non-standard location, they’d call your Enqueue() convenience first, then the simple MiOS Play() method. Basically, they’d composite a few of these together to get the desired effect, with each “command” being extremely simple, with very few parameters.
If other conveniences are added down the line, then they’d fit this model also - new functions/actions, stuff that likely wouldn’t break existing scenes, but could be composited to achieve an effect.
In the case of transient/one-time play, we would add something like Alert(). We separate out all the functionality for “one-time-play” of something, and make it’s parameters match those of Say(). If we need to add stuff to this, like the context Save/Restore, then it can be readily done without impacting the existing Play() method (which wouldn’t deal with transient content-play)… For the most part, the Alert() function would internally use all the same queue and save/restore mechanisms as Say(), it would just source it’s content from elsewhere. It’s likely that we’d also need a “time” parameter, since we may not be able to work out how long to do it for.
Folks wanting multiple Sonos units to play in unison, for long-term play, would [effectively] do something like the following snippet.
I’ve represented it textually, but I’m intending it to mean the Advanced Scene UI.
x.AVTransport.SetAVTransportURI("x-rincon:RINCON_000E5...Y..01400")
y.Sonos1.Play("SQ:Morning playlist")
It won’t be one step, but each component will have recognizable parameters, and parameter values.
For this one, we’d definitely want to expose the relevant information via the UI, so that users can find it easily (eg. the examples tab we’ve talked of before) without having to jump to doc, since the MiOS Advanced Scene pane is primitive and unforgiving.
As a side-note, for Volume, it probably works for a single Sonos unit, but once you have several of them it’s not really as viable.
This is a general issue for any of the group play items (Say, Alert) since the devices might actually need different levels. This happens, for example, when one is a Play Connect, attached to an Amp, and another is a Play 5 - they’ll be different volume levels anyhow.
Happy to leave it in, but it’s never really going to work well for multi-Sonos setups.