Below are latest WIP release notes for upcoming moOde 9.3.7
Whats new:
An optional "System Ready" script that runs just after moOde startup completes. It defaults to add/play a pleasant chime track.
Requests for this seem to come up every year and I think the item has been on my TODO list for like 8 years :-0. I still don't see the usefulness of it but since no dev has volunteered to create the feature and I had some spare cycles last week I put something together.
Code:
################################################################################
#
# 2025-MM-DD moOde 9.3.7 (Bookworm)
#
################################################################################
New
- NEW: Optional BASH script that runs after moOde startup completes
- NEW: REST API's get_receiver_status, set_receiver_onoff
Updates
- UPD: Add MPD stats to moode startup log
- UPD: Improve logging for Update and Regenerate library
- UPD: KEXP 90.3 FM Seattle to 160K AAC-LC stream
System Config
ready-script.sh
Code:
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright 2014 The moOde audio player project / Tim Curtis
#
# This script is run by worker.php after startup has completed
# NOTE: The script is run as a background task to avoid blocking worker.php
# $1 = MPD URI for ReadyChime.flac track
# $2 = Track title
# $3 = Wait before start (secs)
#
#
# To use this script for something other than the Default action
# add your own code below followed by an exit statement
#
#exit 0
#
# Default action is to play the "System Ready" chime
#
READY_CHIME_URI="$1"
READY_CHIME_TITLE="$2"
WAIT_SECS="$3"
MOODE_LOG="/var/log/moode.log"
moode_log () {
echo "$1"
TIME=$(date +'%Y%m%d %H%M%S')
echo "$TIME ready-script: $1" >> $MOODE_LOG
}
# Begin
moode_log "Started"
# Wait before continuing
moode_log "Wait $WAIT_SECS seconds..."
sleep $WAIT_SECS
# Search the Queue first
ITEM=1
FOUND=0
QUEUE=$(mpc playlist)
while IFS= read -r LINE; do
if [ "$LINE" == "$READY_CHIME_TITLE" ]; then
FOUND=1
break
else
((ITEM++))
fi
done <<< "$QUEUE"
# Remove if found
if [ $FOUND == 1 ]; then
mpc -q del $ITEM
fi
# Add to end of Queue then play
mpc add "$READY_CHIME_URI"
ITEM=$(mpc status %length%)
mpc -q play $ITEM
moode_log "Play $READY_CHIME_URI"
# We are done
moode_log "Finished"