PDA

View Full Version : [Announce] LMS Announce - play announcements / notifications



Roland0
2018-05-27, 15:14
LMS Announce is a plugin providing a web API for playing announcements / notifications (audio / speech), enabling integration with anything able to call an URL with parameters.
More information on the homepage (https://www.nexus0.net/pub/sw/lmsannounce/)

Paul Webster
2018-05-28, 01:52
Well done for pulling this together.

First suggestion for addition (and I have not even tried it yet) ...
In the Announce function how about a pre-roll/post-roll configurable sound (to make a "bing bong" to get attention of audience)?
Could be a default pair of sounds and disabled ... then enable and choose other sounds via GET parameter.

Roland0
2018-05-29, 13:15
In the Announce function how about a pre-roll/post-roll configurable sound (to make a "bing bong" to get attention of audience)?
Could be a default pair of sounds and disabled ... then enable and choose other sounds via GET parameter.
Interesting idea, but too much effort unless there is a huge demand for it (very unlikely imho)
Workaround:
- for static announcements, use a playlist
- for speech, install sox and create a shell script:


#!/bin/bash
SOUND=/path/to/beep.flac
while getopts "o:t:" opt; do
case $opt in
o)
DESTFILE="$OPTARG"
;;
t)
TEXT="$OPTARG"
;;
esac
done
mimic -o "${DESTFILE}.tmp" -voice slt -t "$TEXT"
sox "${DESTFILE}.tmp" -t sox - channels 2 rate 44100 | sox "$SOUND" -t sox - "$DESTFILE"
rm "${DESTFILE}.tmp"

and use it as a TTS engine:


"mimic-beep": {
"cmd": "/path/to/script.sh",
"output": "-o ",
"options": "",
"text": "-t"
}

squim
2018-11-03, 04:46
Thank you for this plugin!

I am testing it now, and it almost works. However, there are some problems:

If the current playlist has "repeat" activated, the announce will go in loop forever.
The original playlist does not continue after the announce


I have only tested announceFile and announceTTS so far using wget, and the sound is played. But I get this error in the log:


[18-11-03 12:27:50.6108] Slim::Formats::Playlists::Base::playlistEntryIsVal id (125) Warning: file:///storage/nfs-share/music/ripped/%EF%BB%BF%23EXTM3U found in playlist:
file:///storage/nfs-share/playlists/announceTTS.m3u doesn't exist on disk - skipping!


I'm not sure if it is something wrong with an existing playlist that I have, but I could not find any reference to the music/ripped folder in any of my playlists. Also, announceTTS.m3u does not exist, but I do get tempplaylist_XXX.m3u files in that folder.

So it seems something is failing when the playlist is to be resumed. I turned loglevel to Debug, and this is what I see in the log (MAC scrambled):


[18-11-03 12:42:20.8647] Plugins::LMSannounce::Plugin::handleJSONP (189) handleJSONP cmd=announceFile pid=00:04:20:00:00:00
[18-11-03 12:42:20.8692] Plugins::LMSannounce::Plugin::announceFile (280) announceFile called: file=/storage/nfs-share/announce/Rhumba-beat-75-bpm.wav
[18-11-03 12:42:20.8812] Plugins::LMSannounce::Plugin::__ANON__ (288) announceFile: plid=4476
[18-11-03 12:42:20.9145] Slim::Formats::Playlists::Base::playlistEntryIsVal id (125) Warning: file:///storage/nfs-share/playlists/%EF%BB%BF%23EXTM3U found in playlist:
file:///storage/nfs-share/playlists/announceTTS.m3u doesn't exist on disk - skipping!
[18-11-03 12:42:20.9148] Slim::Formats::Playlists::Base::playlistEntryIsVal id (125) Warning: file:///storage/nfs-share/music/ripped/%EF%BB%BF%23EXTM3U found in playlist:
file:///storage/nfs-share/playlists/announceTTS.m3u doesn't exist on disk - skipping!
[18-11-03 12:42:20.9928] Plugins::LMSannounce::Plugin::playlistLoadedCallba ck (242) playlistLoadedCallback called for cmd playlist load_done
[18-11-03 12:42:29.4821] Plugins::LMSannounce::Plugin::playlistStoppedCallb ack (217) playlistStoppedCallback called for cmd playlist stop
[18-11-03 12:42:29.4826] Plugins::LMSannounce::Plugin::playlistStoppedCallb ack (222) playlistStoppedCallback: playerid=00:04:20:00:00:00
tmppls=tempplaylist_0004202ce3f6 time=22.1893183555603
[18-11-03 12:42:29.5078] Plugins::LMSannounce::Plugin::__ANON__ (227) playlistStoppedCallback: resume done
[18-11-03 12:42:29.5084] Plugins::LMSannounce::Plugin::__ANON__ (229) deleting /tmp/annTTS.wav


It says "resume done", but it is not. Any ideas on what goes wrong here? How can I get rid of that playlist warning?


EDIT: I tried to unsynchronize the player, and then it worked. So, the problem is probably related to my multi player setup. I see that this is not tested, and I'd like contribute to make this work.

Roland0
2018-11-04, 07:12
If the current playlist has "repeat" activated, the announce will go in loop forever.

I've released an update which should fix this.



I have only tested announceFile and announceTTS so far using wget, and the sound is played. But I get this error in the log:


[18-11-03 12:27:50.6108] Slim::Formats::Playlists::Base::playlistEntryIsVal id (125) Warning: file:///storage/nfs-share/music/ripped/%EF%BB%BF%23EXTM3U found in playlist:
file:///storage/nfs-share/playlists/announceTTS.m3u doesn't exist on disk - skipping!

I'm not sure if it is something wrong with an existing playlist that I have, but I could not find any reference to the music/ripped folder in any of my playlists. Also, announceTTS.m3u does not exist, but I do get tempplaylist_XXX.m3u files in that folder.

I get the the same message, you can ignore it.
(Technical background: LMS writes 3 wierd characters ( (hex %EF%BB%BF)) at the start of a playlist file, which I already had to work around when reading it from other applications. The plugin, however, only uses the LMS API, so this is the first time I've seen LMS having problems reading it's own playlists. Not sure how to handle this, maybe I'll file an issue with Logitech))



So it seems something is failing when the playlist is to be resumed. I turned loglevel to Debug, and this is what I see in the log (MAC scrambled):


[18-11-03 12:42:20.8647] Plugins::LMSannounce::Plugin::handleJSONP (189) handleJSONP cmd=announceFile pid=00:04:20:00:00:00
[18-11-03 12:42:20.8692] Plugins::LMSannounce::Plugin::announceFile (280) announceFile called: file=/storage/nfs-share/announce/Rhumba-beat-75-bpm.wav
[18-11-03 12:42:20.8812] Plugins::LMSannounce::Plugin::__ANON__ (288) announceFile: plid=4476
[18-11-03 12:42:20.9145] Slim::Formats::Playlists::Base::playlistEntryIsVal id (125) Warning: file:///storage/nfs-share/playlists/%EF%BB%BF%23EXTM3U found in playlist:
file:///storage/nfs-share/playlists/announceTTS.m3u doesn't exist on disk - skipping!
[18-11-03 12:42:20.9148] Slim::Formats::Playlists::Base::playlistEntryIsVal id (125) Warning: file:///storage/nfs-share/music/ripped/%EF%BB%BF%23EXTM3U found in playlist:
file:///storage/nfs-share/playlists/announceTTS.m3u doesn't exist on disk - skipping!
[18-11-03 12:42:20.9928] Plugins::LMSannounce::Plugin::playlistLoadedCallba ck (242) playlistLoadedCallback called for cmd playlist load_done
[18-11-03 12:42:29.4821] Plugins::LMSannounce::Plugin::playlistStoppedCallb ack (217) playlistStoppedCallback called for cmd playlist stop
[18-11-03 12:42:29.4826] Plugins::LMSannounce::Plugin::playlistStoppedCallb ack (222) playlistStoppedCallback: playerid=00:04:20:00:00:00
tmppls=tempplaylist_0004202ce3f6 time=22.1893183555603
[18-11-03 12:42:29.5078] Plugins::LMSannounce::Plugin::__ANON__ (227) playlistStoppedCallback: resume done
[18-11-03 12:42:29.5084] Plugins::LMSannounce::Plugin::__ANON__ (229) deleting /tmp/annTTS.wav


It says "resume done", but it is not. Any ideas on what goes wrong here? How can I get rid of that playlist warning?
EDIT: I tried to unsynchronize the player, and then it worked. So, the problem is probably related to my multi player setup.
I've changed the target of the resume api call in the new version, check if this makes a difference in a synchronized setup.

Cadster
2018-11-20, 05:57
Thanks for creating a great plugin!
Works perfectly with Home Assistant.

Thanks!

petar
2018-12-18, 05:06
Great work on the plugin!

Just one issue I've come across. I have 3 SqueezeBox players, and I'm unable to play announcements on all of them. Regardless of which playerid I specify in the announceFile API call, the announcement is always played on the same SqueezeBox player. I've enabled debug logging and I can definitely see that the different MAC addresses are being received by the plugin, but for some reason, LMS always plays the file on the same player regardless of the MAC address requested.

Has anyone else been able to get this working across multiple players, using announceFile?

Thanks!
Pete

Roland0
2018-12-19, 13:45
Regardless of which playerid I specify in the announceFile API call, the announcement is always played on the same SqueezeBox player. I've enabled debug logging and I can definitely see that the different MAC addresses are being received by the plugin, but for some reason, LMS always plays the file on the same player regardless of the MAC address requested.


Specifying a player isn't currently implemented, unfortunately. I thought about supporting this (that's why the player id can be passed as a parameter), but never got around to actually adding the functionality to the plugin.

mrw
2018-12-19, 18:37
I get the the same message, you can ignore it.
(Technical background: LMS writes 3 wierd characters ( (hex %EF%BB%BF)) at the start of a playlist file, which I already had to work around when reading it from other applications. The plugin, however, only uses the LMS API, so this is the first time I've seen LMS having problems reading it's own playlists. Not sure how to handle this, maybe I'll file an issue with Logitech))

It's a BOM (https://en.wikipedia.org/wiki/Byte_order_mark), which for some reason LMS always puts at the start of a playlist file. (See https://github.com/Logitech/slimserver/blob/public/7.9/Slim/Formats/Playlists/Base.pm#L75).

And it seems that playlistEntryIsValid will issue a warning when it sees it ! (https://github.com/Logitech/slimserver/blob/public/7.9/Slim/Formats/Playlists/Base.pm#L108).

Roland0
2018-12-29, 01:31
It's a BOM (https://en.wikipedia.org/wiki/Byte_order_mark), which for some reason LMS always puts at the start of a playlist file. (See https://github.com/Logitech/slimserver/blob/public/7.9/Slim/Formats/Playlists/Base.pm#L75).

And it seems that playlistEntryIsValid will issue a warning when it sees it ! (https://github.com/Logitech/slimserver/blob/public/7.9/Slim/Formats/Playlists/Base.pm#L108).

Good catch - I've read about BOMs, but didn't make the connection. I'm, however, still not sure why this issue only occurs in this specific case, and not e.g. when LMS reads a playlist from disk.
I'll open an issue with Logitech about it.