Skip to content
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

Search and queue/play media #5

Open
jonkristian opened this issue Feb 28, 2023 · 9 comments
Open

Search and queue/play media #5

jonkristian opened this issue Feb 28, 2023 · 9 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jonkristian
Copy link
Owner

Would be nice to be able to search media and queue or play directly.

  • Search for music in current collection GET: /media/search/{mcId}/searchText
  • Search for music via Home Assistant Assist would be a goal.

CasaTunes already supports search in their api, we might be limited by Home Assistant here but I've seen some implementation code for this on the Mopidy component.

@jonkristian jonkristian added enhancement New feature or request help wanted Extra attention is needed labels Feb 28, 2023
@alphasixtyfive
Copy link

Interesting! One thing to remember is that not all content can be added to the queue and you should check AllowAddToQueue = (1 << 12) flag.

@jonkristian jonkristian self-assigned this Aug 3, 2023
@jonkristian
Copy link
Owner Author

Now that Home Assistant 2023.8 has come out with wildcard support for sentence triggers I was inspired to start working on this issue and eventually get this working with assist too.

Working code in master, but needs testing.

@alphasixtyfive
Copy link

I think it would be nice to also expose doorbell, chime and TTS as services.

@jonkristian
Copy link
Owner Author

@alphasixtyfive I'm currently looking into TTS service.

Have you ever tried the SSML part of TTS? For me, it seems to error out. If you got it working it would be helpful to see how your request is built.

{
  "ResponseStatus": {
    "ErrorCode": "system/tts/input/Here are <say-as interpret-as=\"characters\">SSML</say-as> samples./zones/0 was not found",
    "Message": "system/tts/input/Here are <say-as interpret-as=\"characters\">SSML</say-as> samples./zones/0 was not found",
    "StackTrace": "[Fallback: 8/9/2023 7:17:26 PM]:\n[REQUEST: {Path:\"system/tts/input/Here are <say-as interpret-as=\"\"characters\"\">SSML</say-as> samples./zones/0\"}]\nServiceStack.Common.Web.HttpError: system/tts/input/Here are <say-as interpret-as=\"characters\">SSML</say-as> samples./zones/0 was not found\r\n   at CasaTunes.REST.ServiceInterface.CasaService.Any(Fallback request)\r\n   at lambda_method(Closure , Object , Object )\r\n   at ServiceStack.ServiceHost.ServiceRunner`1.Execute(IRequestContext requestContext, Object instance, TRequest request)",
    "Errors": []
  }
}

Just tested with a couple of examples from google ssml docs.

@alphasixtyfive
Copy link

I have not tried this I'm afraid.

@jonkristian
Copy link
Owner Author

Ok. New code in master. Improvements to the search and services for tts and doorbell. I could not get SSML to work, but other than that it seems to work pretty well. I think the SSML might be either an upstream bug or I am doing it waay wrong 🗡️

@alphasixtyfive
Copy link

I think you might want to rename doorbell to chime as what the code does not is call chime endpoint. Doorbell simply plays defined chime in seleted zones but this is a slightly different thing.

@jonkristian
Copy link
Owner Author

As I understand it, both endpoints starts with /system/doorbell, but one is for the whole house and one is for specific zone(s). I was actually thinking about the following: When zone(s) are chosen we can use /system/doorbell/zones/zone_id/chimes/chime but if no specific zone; we call /system/doorbell. But what do you think, would a separate service for doorbell be better? For me, it doesnt really matter, but it would keep the number of services low, just that the logic is inside a service, if possible of course.

@alphasixtyfive
Copy link

I fully agree with the logic. I was also thinking of perhaps having preWait and postWait as default options configurable for the component?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants