Skip to content

Commit

Permalink
removed null output, automatic play
Browse files Browse the repository at this point in the history
  • Loading branch information
GioF71 committed Apr 8, 2022
1 parent dbbbbff commit 6e99f26
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ This command will output one line if the current user does belong to the "docker
The Dockerfile and the included scripts have been tested on the following distros:

- Manjaro Linux with Gnome (amd64)
- Raspberry Pi 3/4 buster (arm32)

As I test the Dockerfile on more platforms, I will update this list.
I am maintaining images for arm, but I have not tried to deploy the image on a Raspberry Pi or on a Asus Tinkerboard yet.
These are the platforms I tested, but I believe the image would work also on arm64.

## Get the image

Expand Down Expand Up @@ -73,13 +74,13 @@ Port|Description

```text
docker run \
--name mpd-deejay \
--rm -it \
-p 8010:8000 \
-e MPD_RADIO_STREAMER_URL=http://myradio.com \
-e MPD_RADIO_STREAMER_NAME=MyRadio \
-e MPD_RADIO_STREAMER_HTTPD_ALWAYS_ON=n \
giof71/mpd-radio-streamer
--name mpd-deejay \
--rm -it \
-p 8000:8000 \
-e MPD_RADIO_STREAMER_URL=http://myradio.com \
-e MPD_RADIO_STREAMER_NAME=MyRadio \
-e MPD_RADIO_STREAMER_HTTPD_ALWAYS_ON=n \
giof71/mpd-radio-streamer
```

### Sample docker-compose
Expand All @@ -93,14 +94,17 @@ services:
image: giof71/mpd-radio-streamer
container_name: mpd-streamer-radio-deejay
ports:
- 8010:8000
- 8000:8000
environment:
- MPD_RADIO_STREAMER_URL=http://myradio.com
- MPD_RADIO_STREAMER_NAME=MyRadio
- MPD_RADIO_STREAMER_HTTPD_ALWAYS_ON=yes
- MPD_RADIO_STREAMER_HTTPD_TAGS=yes
```

You can then listen at the url `http://your-pc-ip-address-or-hostname:8000`.
If you have a domain name you own, you can also consider creating a HTTPS termination, so maybe you can obtain an easy to remember URL, like `https://myradio.yourdomain.com` without an explicit port number.

## Build

You can build (or rebuild) the image by opening a terminal from the root of the repository and issuing the following command:
Expand Down
8 changes: 1 addition & 7 deletions app/assets/mpd-template.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,13 @@ input {
plugin "curl"
}

audio_output {
type "null"
name "Null Output"
mixer_type "none"
}

audio_output {
type "httpd"
name "httpd"
port "8000"
always_on "MPD_RADIO_STREAMER_HTTPD_ALWAYS_ON"
tags "MPD_RADIO_STREAMER_HTTPD_TAGS"
#format "MPD_RADIO_STREAMER_HTTPD_FORMAT"
#format "MPD_RADIO_STREAMER_HTTPD_FORMAT"
}

filesystem_charset "UTF-8"
17 changes: 10 additions & 7 deletions app/bin/run-mpd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ else
fi
fi
echo "MPD_RADIO_STREAMER_HTTPD_ALWAYS_ON = [$httpd_always_on]"

httpd_tags=$MPD_RADIO_STREAMER_HTTPD_TAGS
if [ -z "${httpd_tags}" ]; then
httpd_tags="yes"
Expand All @@ -29,6 +30,7 @@ else
fi
fi
echo "MPD_RADIO_STREAMER_HTTPD_TAGS = [$httpd_tags]"

radio_name=$MPD_RADIO_STREAMER_NAME
if [ -z "${radio_name}" ]; then
radio_name="Radio"
Expand All @@ -42,11 +44,10 @@ sed -i 's/MPD_RADIO_STREAMER_HTTPD_ALWAYS_ON/'"$httpd_always_on"'/g' $MPD_CONFIG
sed -i 's/MPD_RADIO_STREAMER_HTTPD_TAGS/'"$httpd_tags"'/g' $MPD_CONFIG_FILE

if ! [ -z "${httpd_format}" ]; then
sed -i 's/#format/'"format"'/g' $MPD_CONFIG_FILE
sed -i 's/#format/'"format "'/g' $MPD_CONFIG_FILE
sed -i 's/MPD_RADIO_STREAMER_HTTPD_FORMAT/'"$httpd_format"'/g' $MPD_CONFIG_FILE
fi


cat $MPD_CONFIG_FILE

echo "About to sleep for $STARTUP_DELAY_SEC second(s)"
Expand Down Expand Up @@ -75,11 +76,13 @@ echo "Setting repeat mode ..."
echo "Waiting ..."
sleep 1

echo "Playing ..."
/usr/bin/mpc play

echo "Press [CTRL+C] to stop..."
counter=0
while true
do
echo "Press [CTRL+C] to stop..."
sleep 864000
counter=counter+1
if ! mpc status | awk 'NR==2' | grep playing > /dev/null; then
mpc play
fi
sleep 5
done

0 comments on commit 6e99f26

Please sign in to comment.