I’m using playSound as part of the Squeezebox binding to play mp3 based notifications like… “The garage door is still open”.
I’m noticing that after the mp3 is played if a song was playing it resumes at the right time in the track but a COMPLETELY random track in the currently playlist on the squeezebox.
Anyone know if this is a known issue or have a fix for it?
UPDATE… This appears to happen when my playlist is on “random” shuffle. But looks to work okay wen not random.
In your rule, save the current track before playing the mp3 in a variable, then after the mp3 is played resume play using the saved track
Thanks Vincent although that seems like a bit of a workaround for a bug?
A couple of lines codes is not a great workaround.
In the mean time, you can report the bug as an issue on github.
Is this happening when you are playing a playlist containing local music files (versus a streaming source like Pandora, Spotify, etc.)?
There may be an issue with the order in which the player state is being restored after the notification completes. I’ll take a look at this. Unfortunately, I’ve found the LMS to be a bit (for lack of a better word) squirrelly when restoring the player state after the notification completes.
Yeah when playing local music and the playbac is set to random shuffle.
I was going to try sending a command to pause first, play the notification and then another command to un-pause… Maybe that will be more reliable?
That’s basically what the binding does when it detects something is currently playing.
- save player state, including currently playing item, shuffle mode, repeat mode, mute, etc.
- turn off shuffle (if on)
- turn off repeat (if on)
- stop player
- add notification to end of playlist
- play last item in playlist (i.e. notification)
- remove last item in playlist (i.e. notification)
- restore currently playing item
- restore playing time
- restore shuffle mode
- restore repeat mode
Note that the currently playing item is the index of the song in the playlist, not the song itself.
I’m thinking that turning off shuffle mode might change the association between the index and the actual song. But I need to test this.
Yeah I suspect doing the “restore shuffle” will make it end up with a playlist in a different order so the song index will be wrong.
Is there a difference if i play a song out of a playlist or i play a song out of a folder without any playlist?
Is there the same behavior with all commands (shuffle, repeat) or is there a difference if i play playlist or folder?
I haven’t looked closely at the LMS code, but I expect the behavior will be the same.
So, the way the LMS seems to work… Say you have shuffle by song enabled (haven’t tested shuffle by album yet) and you’re on track index 20 of a playlist (i.e. that’s the playlist index of the currently playing song). Disabling and reenabling shuffle mode seems to place the currently playing song at playlist index 0.
I’m going to test a change that restores the index to 0 when shuffle mode is enabled.
Edit: Well, that didn’t work. Adding an item (i.e. the notification) to the playlist and playing it invalidates the above behavior.
When playing a playlist of local music, another possibility is to try using the
playlist clear, and
playlist resume commands. I’ve never used those before, and it likely would involve a bit more rework. I’ll take a look at that when I get a little more time.
Just out of interest, why do you disable the shuffle and repeat first? Is that so the notification can be played “next”?
Right. The notification goes at the end of the playlist, then the last item in the playlist is played. When the notification is complete the player stops, after which the state is restored. If the notification is not at the end, the next song after the notification will start playing immediately, which is not desirable, nor is it easy to detect.
Of course, there may be a completely different way to do this using the LMS CLI, but I haven’t found it yet…
@mhilbush, just upgraded to 2.3.0 today and if my squeezebox is playing a list of random songs then when it resumes after a speak notification it is still not resuming the same track…
Did you think you had resolved this?
I’m pretty confident that I haven’t resolved it. I haven’t been able to find anything in the LMS API that will make this work better.
Thanks for trying! I’ll have to remember not to use shuffle where possible
Hi This is somehow offtopic, but I don’t want to rise another one unnecessarily.
@mhilbush is this possible from binding to clear the current playlist of particular squeezebox player?
The API has a playlist clear function. The binding might be able to implement this as a Thing action that could be called from a rule.
<playerid> playlist clear
The "playlist clear" command removes any song that is on the playlist. The player is stopped.
Request: "04:20:00:12:23:45 playlist clear<LF>"
Response: "04:20:00:12:23:45 playlist clear<LF>"
I’ve going back to this after some time and I don’t understand how can I implement this.
My problem is that I use squeezebox player in my hallway also as a Doorbell.
The problem is that while something is played on my hallway player (PiCoreplayer) (e.g. some internet radio) someone can trigger a doorbell.
When it happens, in theory I would expect, that the current played song will be paused, as next a doorbell sound should be added into the playlist, then played, after that removed from playlist and finally the player should continue playing song that was paused in the first place. Perhaps there is much more going one in the background, like setting the volume for notification sound.
My long lasting problem with this is that very often the doorbell sound is not being removed from the playlist (so the playlist is mixing and building up with several doorbell sounds).
This results in indesired and annoying issues. For example when nothing was played at the time when toorble was triggered but there was something already on the playlist, after playing a doorbell sound the player does not go back to STOP state and instead plays next song, and often with volume that was set up for a notification volume. So for this appliance squeezebox is not very appropriate and vastly not reliable.
However as a half solution I was thinking about to force clearing the playlist from a rule, after doorbell sound is played. Right now I only send additional STOP command in order to make sure nothing will be played after doorbell sound with max volume (as it is level of volume for notifications).
Thanks for your help and time.