Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Jun 2017
    Posts
    275

    A crude form of automation for LMS

    Ever since I started using LMS, nearly seven years ago, I have wished for some form of automation. What I mean is that I want a way to add commands to the playlist, so that certain tasks can be performed. For instance:

    Pause or stop playback for a specified time, then resume playing with the next track in the playlist. (sometimes useful when a sync group has drifted out of sync)

    Stop playback, clear the playlist, then load and begin playing a different playlist.

    Maybe this capability exists in plugins that I am not aware of. But since I'm not aware of those options, I decided to try coming up with something on my own.

    I am not a developer, so I do not have code to share, just a concept. So I'm not posting this in Third-party Software. And even though what I'm doing works only in Linux, I think the concept can be applied in other environments, so I think this fits best in the LMS forum.

    I have added a folder named Commands to the top level of my music library. In that folder there are several audio files containing 30 seconds of silence. The Title tags of those files all begin with "[Command]", followed by a description of the task to be done. For instance, the first example I mentioned above becomes "[Command] pause group all then play next".

    Next, some way of monitoring what's currently playing is needed. This can probably be achieved with the PlayLog or LMS Event Trigger plugins. I already have a shell script running that gets Now Playing updates through the Command Line Interface, so that is what I use. With a few lines added to that script, it now checks the title of every new track, and if it begins with "[Command]" it calls another script with the rest of the title as a parameter.

    My hope is that in time the second script will evolve into something more sophisticated, but right now it's just a chain of IF statements. If one of them matches the parameter used when calling a script, it sends a command or a sequence of commands through the CLI. Using the same example:

    Code:
            sleep 2
            echo "01%3A23%3A45%3A67%3A89%3Aab pause 1" > sqz_fifo_in
            sleep 15
            echo "01%3A23%3A45%3A67%3A89%3Aab pause 0" > sqz_fifo_in
            sleep 1
            echo "01%3A23%3A45%3A67%3A89%3Aab playlist index +1" > sqz_fifo_in
    That pauses the group player, waits fifteen seconds, then unpauses and jumps to the next track.

    It's not elegant, but it works. I'm sure it would work much better as a plugin, but it's not likely that I will ever make that happen. So if anyone would like to take this crude concept and develop it into something powerful, be my guest. But even if that never happens, I hope someone will find the concept useful and modify it to fit their needs.

    Next problem: running commands based on time, rather than sequence in a playlist. I have tried doing something like that with alarms in the past, without much success. But maybe it would help to set up a dummy player, only for the purpose of running commands. I am not ready to go there yet, but if someone else is ready, do go ahead!

    If nothing else, I hope real developers will get a good laugh out of my fumbling attempts to make this work.
    LMS 8 nightly; 3 Squeezelite players connected by powerline ethernet; 5 wireless players connected via Airplay Bridge; 1 SqueezeAmp player
    no high-end or esoteric audio gear
    1 Squeezebox Radio (upgraded UE Smart Radio) now mostly retired

  2. #2
    Senior Member
    Join Date
    Jun 2017
    Posts
    275
    Incidentally, as I said, there may well be better and/or easier ways to do this that I have overlooked. If so, I hope someone will take pity on me and give me at least a hint at a clue.

    It wouldn't be the first time I've put effort into doing something that's already been done more effectively. Trying to do it on my own is sort of my funny way of asking for help.

    That said, it's also true that finding complicated solutions to insignificant issues is one of my specialties.
    LMS 8 nightly; 3 Squeezelite players connected by powerline ethernet; 5 wireless players connected via Airplay Bridge; 1 SqueezeAmp player
    no high-end or esoteric audio gear
    1 Squeezebox Radio (upgraded UE Smart Radio) now mostly retired

  3. #3
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    1,071
    Quote Originally Posted by RobbH View Post
    it's just a chain of IF statements.
    alternatively:
    case .. in

    Next problem: running commands based on time, rather than sequence in a playlist. I have tried doing something like that with alarms in the past, without much success.
    cron (or systemd timers, depending on the Linux distribution) would be a simple solution

    btw, you haven't said how you want to trigger this. If it's from a mobile device, something like this (or even this) may be an option.
    Last edited by Roland0; 2020-09-23 at 20:01.
    Various SW: Web Interface | TUI | Playlist Editor / Generator | Music Classification | Similar Music | Announce | EventTrigger | Chiptunes | LMSlib2go | ...
    Various HowTos: build a self-contained LMS | Bluetooth/ALSA | Control LMS with any device | ...

  4. #4
    Senior Member
    Join Date
    Jun 2017
    Posts
    275
    Quote Originally Posted by Roland0 View Post
    alternatively:
    case .. in


    cron (or systemd timers, depending on the Linux distribution) would be a simple solution

    btw, you haven't said how you want to trigger this. If it's from a mobile device, something like this (or even this) may be an option.
    Thanks for taking this seriously enough to respond! I am accustomed to my projects being too obscure and too weird to get any responses. I think people usually read about them and think, "Why would you want to do that? And why would you go to that much trouble?" But this being the generous community it is, they're too polite to say that.

    I was not aware of either of those Android apps, so I appreciate that information. I use Mercury-SSH, which is similar to the SSH button.
    LMS 8 nightly; 3 Squeezelite players connected by powerline ethernet; 5 wireless players connected via Airplay Bridge; 1 SqueezeAmp player
    no high-end or esoteric audio gear
    1 Squeezebox Radio (upgraded UE Smart Radio) now mostly retired

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •