Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 9 of 9
  1. #1
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    1,150

    [Announce] Event Trigger - execute commands triggered by LMS server events

    LMS Event Trigger is a plugin for executing external commands triggered by LMS server events.

    Example scenarios
    • Send a notification that a library rescan has finished to an Android device (using Gotify)
    • Power off the server after a playlist has finished
    • Show song informaion on an attached display

    More information on the homepage
    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 | ...

  2. #2
    Hi Roland,

    A couple of questions with this please.

    1. Will this trigger on volume events ? I have tried "event":[["mixer"],["volume","+1"]]} and a few variations but not able to fire.
    2. Is it possible to isolate to events from a specific player ?

    thanks

  3. #3
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    1,150
    Quote Originally Posted by davemal View Post
    1. Will this trigger on volume events ? I have tried "event":[["mixer"],["volume","+1"]]} and a few variations but not able to fire.
    "event":[["mixer"], ["volume"]]

    2. Is it possible to isolate to events from a specific player ?
    The player status is passed as a parameter to the executed command. This includes the player id/name, so e.g. for a shell script one can do:

    Code:
    PL=$(echo $2|sed -e 's/.*player_id":"\(..:..:..:..:..:..\)".*/\1/')
    VOL=$(echo $2|sed -e 's/.*mixer volume":\([[:digit:]]*\).*/\1/')
    if [[ "$PL" == "00:11:22:33:44:55" ]]; then
    	echo "volume: $VOL"
    fi
    I'd recommend using jq for more complex json processing.
    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
    Thanks

    I will brush up on some shell scripting and have a play.

  5. #5
    Hello Roland,

    Here are the steps I took:

    I installed your plugin from the repository
    I created a conf file
    Code:
    nano /etc/lmseventtrigger.json
    #Test automatic PAUSE behaviour
    {
    "enabled": true,
    "numStatusResults":1,
    "events": [
    {"cmd":"/usr/local/bin/lmsclient.sh","event":[["client"]]},
    {"cmd":"/usr/local/bin/lmsplaylist.sh","event":[["playlist"],["newsong","pause"]]}
    ]
    }
    Nothing happen

    Then I tried as per your wiki to use the url http://10.144.1.1:9000/plugins/LMSeventTrigger/js.html without success
    404 Not Found: plugins/LMSeventTrigger/js.html
    Your help is welcomed.

    Jean
    Last edited by bidule; 2020-12-23 at 09:24.

  6. #6
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    1,150
    Quote Originally Posted by bidule View Post
    I installed your plugin from the repository
    Nothing happen
    - Does the plugin appear in the LMS Web interface > Settings > Plugins > Active plugins list ?
    - If so, switch logging to debug for the plugin (LMS Web interface > Settings > Advanced > Logging > plugin.lmseventtrigger) and check the server log.
    You should have something like:
    Code:
    [20-12-24 08:45:56.3320] Plugins::LMSeventTrigger::Plugin::initPlugin (74) LMSeventTrigger init start
    [20-12-24 08:45:56.3327] Plugins::LMSeventTrigger::Plugin::initSubscriptions (113) LMSeventTrigger: using /usr/local/etc/lmseventtrigger.json
    [20-12-24 08:45:56.3360] Plugins::LMSeventTrigger::Plugin::initSubscriptions (120) LMSeventTrigger: parsed lmseventtrigger.json
    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 | ...

  7. #7
    Thank you Rolland,

    Yes the plugin in active.
    Here is a part of the log file
    [20-12-24 09:22:41.5877] Plugins::LMSeventTrigger::Plugin::initPlugin (74) LMSeventTrigger init start
    [20-12-24 09:22:41.5895] Plugins::LMSeventTrigger::Plugin::initSubscription s (110) LMSeventTrigger: using /etc/lmseventtrigger.json
    [20-12-24 09:22:41.5909] Plugins::LMSeventTrigger::Plugin::initSubscription s (122) LMSeventTrigger: error parsing lmseventtrigger.json
    [20-12-24 09:22:41.5919] Plugins::LMSeventTrigger::Plugin::initSubscription s (128) LMSeventTrigger: no valid configuration found, disabling plugin
    [20-12-24 09:22:41.5929] Plugins::LMSeventTrigger::Plugin::initPlugin (85) LMSeventTrigger initialized (v0.0.2)
    Jean

  8. #8
    Hello Rolland,

    I had a look at where any squeezelite.log could be, I'm using DietPi.
    Here is the result:
    /var/lib/dietpi/dietpi-ramlog/storage/squeezelite.log
    /var/log/squeezelite.log
    /var/tmp/dietpi/logs/dietpi-ramlog_store/squeezelite.log
    Three empty files.

    EDIT:
    Sorry this message has no relation to this subject, it is related the other post.


    Jean
    Last edited by bidule; 2020-12-24 at 06:01.

  9. #9
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    1,150
    Quote Originally Posted by bidule View Post
    Here is a part of the log file
    Log says:
    Quote Originally Posted by LMS log
    [20-12-24 09:22:41.5909] Plugins::LMSeventTrigger::Plugin::initSubscription s (122) LMSeventTrigger: error parsing lmseventtrigger.json
    check that lmseventtrigger.json is valid json, has the correct structure and file encoding (Unix line ends, probably UTF-8)
    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 | ...

Posting Permissions

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