-
-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rest] Added Voice / TTS API #1017
Conversation
Fix #927 Signed-off-by: Laurent Garnier <[email protected]>
In addition to this enhancement, we need another REST API for audio to get the list of audio sinks. I will cover that in a separate PR. |
Signed-off-by: Laurent Garnier <[email protected]>
@@ -67,6 +71,7 @@ | |||
UriInfo uriInfo; | |||
|
|||
private VoiceManager voiceManager; | |||
private AudioManager audioManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should imho do without that dependency - the VoiceManager offers methods to call without sinkIds and it handles the calls internally. The REST API should behave the same way as the Java API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this was necessary just to make a pre-control and avoid returning status 200 when say will fail because the provided audio sink is wrong.
But I can suppress this test and so this dependency to AudoManager.
} | ||
|
||
@POST | ||
@Path("/say/{sinkid: [a-zA-Z_:0-9]*}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sinkId is not a member of an entity "say", so it should imho rather be a QueryParam instead of a PathParam here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
I think I do it like that because the interpret API just above was using this pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but for the interpreters call, it is selecting an entity by id from the list of interpreters, so it is a different situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the difference.
Here I want to select a voice amongst a list of voices, and a sink amongst a list of audio sinks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your uri is say/sinkid
and not sinks/sinkid
or voices/voiceid
. Hence "sinkid" is not an entity of the "say" entities. See the difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean now.
} | ||
|
||
@POST | ||
@Path("/say/{sinkid: [a-zA-Z_:0-9]*}/{voiceid: [a-zA-Z_:0-9]*}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: Make sinkid and voiceid to QueryParams (this will actually allow you to combine the three methods into one as two params can both be optional).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to have QueryParam in a POST command ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would think/hope so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a doubt. I will check if we have such case in all our REST APIs (POST).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing a WEB search, it looks like this is possible.
Signed-off-by: Laurent Garnier <[email protected]>
Changes done. My tests are ok. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks much cleaner, doesn't it?
…". If you do you will see this `warning: 2019-07-11 20:57:02.024 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'groundfloor.sitemap' has errors, therefore ignoring it: [31,91]: mismatched input '"20"' expecting RULE_INT` (openhab#1017) Line 31 from groundfloor.sitemap: ``` Colorpicker item=cinema_led_strip_color label="Cinema LED Strip Color[]" sendFrequency="20" ``` Signed-off-by: Soren Thorsen <[email protected]>
* REST Voice API: new API for TTS Fix openhab#927 Signed-off-by: Laurent Garnier <[email protected]> GitOrigin-RevId: a1f3880
Fix #927
Signed-off-by: Laurent Garnier [email protected]