URI: 
       Add new radio service using mpd. - annna - Annna the nice friendly bot.
  HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR README
       ---
   DIR commit 6933d425fc2e922a0e3b9c8b3244106d1f03ecab
   DIR parent b84cff428a6f7fe86c9f5681e41222f3a8b41d2a
  HTML Author: Annna Robert-Houdin <annna@bitreich.org>
       Date:   Tue, 30 Jul 2024 23:25:57 +0200
       
       Add new radio service using mpd.
       
       Diffstat:
         M annna-channel-service               |       4 ++++
         M annna-message-radio                 |      19 ++++++++-----------
         M annna-stop-services                 |       1 +
         A modules/radio/radio-channel-servic… |      29 +++++++++++++++++++++++++++++
       
       4 files changed, 42 insertions(+), 11 deletions(-)
       ---
   DIR diff --git a/annna-channel-service b/annna-channel-service
       @@ -22,6 +22,10 @@ case "${channel}" in
                        "${ircuser}" "${idlebase}" "${ircbase}" "${server}" "${channel}" &
                exit $?
                ;;
       +\#bitreich-radio)
       +        radiobase="${modbase}/radio"
       +        $radiobase/radio-channel-service.sh \
       +                "${ircuser}" "${radiobase}" "${ircbase}" "${server}" "${channel}" &
        esac
        
        ls "${serverbase}/${channel}/out" \
   DIR diff --git a/annna-message-radio b/annna-message-radio
       @@ -13,20 +13,17 @@ text="$4"
        [ "$user" = "${ircuser}" ] && exit
        
        case "${text}" in
       -"${ircuser}, next please.")
       -        /br/bin/bitreich-radio-playlist-next
       -        annna-say -s "${server}" -c "${channel}" "You are very kind ${user}. To your command."
       +"${ircuser}, next song please.")
       +        /usr/bin/mpc -q next
                exit # no common messages
                ;;
       -"${ircuser}, please mark this.")
       -        songtitle="$(/br/bin/bitreich-radio-playlist-mark)"
       -        annna-say -s "${server}" -c "${channel}" "${user}, I have marked \"${songtitle}\" for you."
       -        exit
       +"${ircuser}, please shuffle.")
       +        /usr/bin/mpc -q shuffle
       +        exit # no common messages
                ;;
       -"${ircuser}, please help.")
       -        annna-say -s "${server}" -c "${user}" "»next please.« gets the playlist further, ${user}."
       -        annna-say -s "${server}" -c "${user}" "»please help.« gives you this help listing, ${user}."
       -        # Fall back to annna-message-common help message.
       +"${ircuser}, please toggle random.")
       +        /usr/bin/mpc -q random
       +        exit # no common messages
                ;;
        esac
        
   DIR diff --git a/annna-stop-services b/annna-stop-services
       @@ -3,4 +3,5 @@
        pkill -f "entr tail -n 1 /home/annna/irc.*"
        pkill -f "annna-channel-service"
        pkill -f "idlerpg-channel-service.py"
       +pkill -f "radio-channel-service.sh"
        
   DIR diff --git a/modules/radio/radio-channel-service.sh b/modules/radio/radio-channel-service.sh
       @@ -0,0 +1,29 @@
       +#!/bin/sh
       +
       +export PATH="/home/annna/bin:$PATH"
       +
       +ircuser="$1"
       +radiobase="$2"
       +ircbase="$3"
       +server="$4"
       +channel="$5"
       +
       +# Wait for mpd to be alive.
       +while /bin/true;
       +do
       +        while ! mpc -q;
       +        do
       +                sleep 5
       +        done
       +
       +        while mpc -q;
       +        do
       +                currentsong="$(mpc current --wait)"
       +                if [ -n "${currentsong}" ];
       +                then
       +                        annna-say -s "${server}" -c "${channel}" "Now playing: ${currentsong}"
       +                fi
       +        done
       +        sleep 5
       +done
       +