예제 #1
0
 def async_get_media(self, msgid):
     """Return the media blob for the msgid."""
     from asterisk_mbox import ServerError
     client = self.hass.data[DOMAIN].client
     try:
         return client.mp3(msgid, sync=True)
     except ServerError as err:
         raise StreamError(err)
예제 #2
0
    async def async_get_media(self, msgid):
        """Return the media blob for the msgid."""
        if msgid not in self._messages:
            raise StreamError("Message not found")

        audio_path = os.path.join(os.path.dirname(__file__), "tts.mp3")
        with open(audio_path, "rb") as file:
            return file.read()
예제 #3
0
    async def async_get_media(self, msgid):
        """Return the media blob for the msgid."""

        client = self.hass.data[ASTERISK_DOMAIN].client
        try:
            return client.mp3(msgid, sync=True)
        except ServerError as err:
            raise StreamError(err)
예제 #4
0
    async def async_get_media(self, msgid):
        """Return the media blob for the msgid."""

        client = self.hass.data[ASTERISK_DOMAIN].client
        try:
            return await self.hass.async_add_executor_job(
                partial(client.mp3, msgid, sync=True))
        except ServerError as err:
            raise StreamError(err) from err