Hello,
here is my script for the last alsa device detection and used for systemd:
My question is
I have encountered an issue where moodeutl -r does not update the related UI settings(sessions).
After running moodeutl -r, the settings in the Web UI remain outdated, and the only way to refresh them is to reboot the system.
Any insights or suggestions would be greatly appreciated.
Thanks in advance!
here is my script for the last alsa device detection and used for systemd:
Quote:#!/bin/bash
LAST_DEVICE_FILE="/var/local/last-alsa-device"
echo "Starting ALSA device detector..."
while true; do
sleep 5
if [ ! -f "$LAST_DEVICE_FILE" ]; then
echo "No last ALSA device record found. Skipping..."
continue
fi
LAST_FILE_ROW1=$(head -n 1 "$LAST_DEVICE_FILE")
LAST_FILE_ROW2=$(head -n 2 "$LAST_DEVICE_FILE" | tail -n 1)
LAST_FILE_ROW3=$(head -n 3 "$LAST_DEVICE_FILE" | tail -n 1)
LAST_FILE_ROW4=$(head -n 4 "$LAST_DEVICE_FILE" | tail -n 1)
LAST_CARD=$(echo "$LAST_FILE_ROW1" | awk '{gsub(":", "", $2); print $2}')
LAST_DEVICE=$(echo "$LAST_FILE_ROW1" | cut -d' ' -f3-)
LAST_OUTPUT_MODE="$LAST_FILE_ROW2"
LAST_VOLUME_MAX="$LAST_FILE_ROW3"
LAST_MIXER_TYPE="$LAST_FILE_ROW4"
CURRENT_CARD=$(aplay -l | grep "$LAST_DEVICE" | awk -F'[: ]+' '{print $2}')
if [[ -z "$CURRENT_CARD" ]]; then
echo "Last ALSA device ($LAST_DEVICE) not found in aplay -l. Skipping..."
continue
fi
CURRENT_DEVICE="$LAST_DEVICE"
echo "Last ALSA: card $LAST_CARD ($LAST_DEVICE)"
echo "Current ALSA: card $CURRENT_CARD ($CURRENT_DEVICE)"
CFG_MPD_CARD=$(moodeutl -q "SELECT value FROM cfg_mpd WHERE param='device';" | awk -F'|' '{print $1}')
sleep 1
if [ "$CFG_MPD_CARD" != "$LAST_CARD" ]; then
echo "Updating Moode to use last known ALSA device ($LAST_CARD : $LAST_DEVICE) | $LAST_OUTPUT_MODE | $LAST_VOLUME_MAX | $LAST_MIXER_TYPE ..."
sleep 1
moodeutl -q "UPDATE cfg_mpd SET value='$LAST_CARD' WHERE param='device'; \
UPDATE cfg_system SET value='$LAST_DEVICE' WHERE param='adevname'; \
UPDATE cfg_system SET value='$LAST_CARD' WHERE param='cardnum'; \
UPDATE cfg_system SET value='$LAST_OUTPUT_MODE' WHERE param='alsa_output_mode'; \
UPDATE cfg_system SET value='$LAST_VOLUME_MAX' WHERE param='alsavolume_max'; \
UPDATE cfg_mpd SET value='$LAST_MIXER_TYPE' WHERE param='mixer_type';"
break
fi
done
# Attempt to refresh Moode
moodeutl -r
My question is
I have encountered an issue where moodeutl -r does not update the related UI settings(sessions).
After running moodeutl -r, the settings in the Web UI remain outdated, and the only way to refresh them is to reboot the system.
Any insights or suggestions would be greatly appreciated.
Thanks in advance!