From 45251b59d8b7ab9f42146ee55dd00d01fe386459 Mon Sep 17 00:00:00 2001 From: Giovanni Fulco Date: Sun, 21 Jul 2024 20:01:25 +0200 Subject: [PATCH] Support for disabling OpenHome Radio Service #429 (#430) --- Dockerfile | 1 + README.md | 1 + app/bin/run-upmpdcli.sh | 52 ++++++++++++++++++++++++----------------- doc/change-history.md | 1 + 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index e1eb8a4..57a77ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -208,6 +208,7 @@ ENV LOG_LEVEL="" ENV UPNP_LOG_ENABLE="" ENV UPNP_LOG_LEVEL="" +ENV ENABLE_OPENHOME_RADIO_SERVICE="" ENV DUMP_ADDITIONAL_RADIO_LIST="" ENV WEBSERVER_DOCUMENT_ROOT="" diff --git a/README.md b/README.md index 57e0af7..f917f67 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,7 @@ UPRCL_AUTOSTART|Autostart UPRCL, defaults to `1` UPRCL_USER|Username for `uprcl` UPRCL_HOSTPORT|Hostname and port for uprcl. Currently required when enabling UPRCL. Format: ``. Example value: `192.168.1.8:9090`. UPRCL_TITLE|Title for the media server, defaults to `Local Music` +ENABLE_OPENHOME_RADIO_SERVICE|OpenHome Radio Service, enabled by default, set to `no` to disable ENABLE_UPRCL|Enable local music support (uprcl). Set to `yes` to enable (Deprecated, use UPRCL_ENABLE) RADIOS_ENABLE|Enable Radios plugin. Set to `yes` to enable RADIOS_AUTOSTART|Start Radios on startup, defaults to `1` diff --git a/app/bin/run-upmpdcli.sh b/app/bin/run-upmpdcli.sh index 167a810..0de9cdb 100644 --- a/app/bin/run-upmpdcli.sh +++ b/app/bin/run-upmpdcli.sh @@ -5,6 +5,8 @@ # 2 Invalid RENDERER_MODE value # 3 Invalid argument +USER_CONF_PATH=/user/config + current_user_id=$(id -u) echo "Current user id is [$current_user_id]" @@ -169,9 +171,35 @@ fi cp $SOURCE_CONFIG_FILE $CONFIG_FILE -# set fixed value -echo "radiolist = /tmp/radiolist.conf" >> $CONFIG_FILE -echo "upradiostitle = Upmpdcli Radio List" >> $CONFIG_FILE +RADIO_LIST=/tmp/radiolist.conf + +MAIN_RADIO_LIST_FILENAME=/usr/share/upmpdcli/radio_scripts/radiolist.conf +ADDITIONAL_RADIO_LIST=additional-radio-list.txt + +ADDITIONAL_RADIO_LIST_FILENAME="$USER_CONF_PATH/$ADDITIONAL_RADIO_LIST" +cp $MAIN_RADIO_LIST_FILENAME $RADIO_LIST +if [ -f "$ADDITIONAL_RADIO_LIST_FILENAME" ]; then + echo "Adding additional radio list file" + if [ "${DUMP_ADDITIONAL_RADIO_LIST^^}" == "YES" ]; then + cat $ADDITIONAL_RADIO_LIST_FILENAME + fi + cat $ADDITIONAL_RADIO_LIST_FILENAME >> $RADIO_LIST +else + echo "No additional radio list file." +fi + +enable_openhome_radio_service=0 +if [[ -z "${ENABLE_OPENHOME_RADIO_SERVICE}" ]] || [[ "${ENABLE_OPENHOME_RADIO_SERVICE^^}" == "YES" || "${ENABLE_OPENHOME_RADIO_SERVICE^^}" == "Y" ]]; then + enable_openhome_radio_service=1 +elif [[ "${ENABLE_OPENHOME_RADIO_SERVICE^^}" != "NO" && "${ENABLE_OPENHOME_RADIO_SERVICE^^}" != "N" ]]; then + echo "Invalid ENABLE_OPENHOME_RADIO_SERVICE=[${ENABLE_OPENHOME_RADIO_SERVICE}]" + exit 1 +fi + +if [ $enable_openhome_radio_service -eq 1 ]; then + echo "radiolist = ${RADIO_LIST}" >> $CONFIG_FILE + echo "upradiostitle = Upmpdcli Radio List" >> $CONFIG_FILE +fi set_upnp_iface=0 if [[ "$ENABLE_AUTO_UPNPIFACE" == "1" || "${ENABLE_AUTO_UPNPIFACE^^}" == "YES" || "${ENABLE_AUTO_UPNPIFACE^^}" == "Y" ]]; then @@ -680,24 +708,6 @@ if [ "${UPRCL_ENABLE^^}" == "YES" ]; then fi fi -MAIN_RADIO_LIST_FILENAME=/usr/share/upmpdcli/radio_scripts/radiolist.conf -USER_CONF_PATH=/user/config -ADDITIONAL_RADIO_LIST=additional-radio-list.txt - -RADIO_LIST=/tmp/radiolist.conf - -ADDITIONAL_RADIO_LIST_FILENAME="$USER_CONF_PATH/$ADDITIONAL_RADIO_LIST" -cp $MAIN_RADIO_LIST_FILENAME $RADIO_LIST -if [ -f "$ADDITIONAL_RADIO_LIST_FILENAME" ]; then - echo "Adding additional radio list file" - if [ "${DUMP_ADDITIONAL_RADIO_LIST^^}" == "YES" ]; then - cat $ADDITIONAL_RADIO_LIST_FILENAME - fi - cat $ADDITIONAL_RADIO_LIST_FILENAME >> $RADIO_LIST -else - echo "No additional radio list file." -fi - cache_directory=/cache if [ ! -w "$cache_directory" ]; then echo "Cache directory [${cache_directory}] is not writable" diff --git a/doc/change-history.md b/doc/change-history.md index 62ec438..950e86a 100644 --- a/doc/change-history.md +++ b/doc/change-history.md @@ -2,6 +2,7 @@ Change Date|Major Changes ---|--- +2024-07-21|Add support for disabling OpenHome Radio Service (see issue [#429](https://github.com/GioF71/upmpdcli-docker/issues/429)) 2024-07-19|Add `SKIP_CHOWN_CACHE` to skip chown on possibly crowded /cache 2024-07-12|Add script for generating tidal oauth2 credentials (see issue [#425](https://github.com/GioF71/upmpdcli-docker/issues/425)) 2024-06-13|Automatically set ohproductroom to friendlyname if not explicitly set