Skip to content

Commit

Permalink
383 feature support upnp log level and filename (#384)
Browse files Browse the repository at this point in the history
* Add support for upnp log file and level #383

* Corrected var names to avoid overlaps

* Final cleanup

- replace whole words
- proper variable names
  • Loading branch information
GioF71 authored Mar 25, 2024
1 parent 7c2ddf4 commit 5b0fe15
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 10 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN if [ "$BUILD_MODE" = "full" ]; then \
apt-get install -y python3 python3-pip; \
fi

COPY app/install/* /app/install
COPY app/install/* /app/install/
RUN chmod u+x /app/install/*.sh
RUN /app/install/setup.sh

Expand Down Expand Up @@ -190,6 +190,9 @@ ENV MEDIA_SERVER_FRIENDLY_NAME ""
ENV LOG_ENABLE ""
ENV LOG_LEVEL ""

ENV UPNP_LOG_ENABLE ""
ENV UPNP_LOG_LEVEL ""

ENV DUMP_ADDITIONAL_RADIO_LIST ""

ENV WEBSERVER_DOCUMENT_ROOT ""
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,10 @@ HRA_ENABLE|Set to `yes` to enable HRA support, defaults to `no`
HRA_USERNAME|Your HRA account username
HRA_PASSWORD|Your HRA account password
HRA_LANG|Your HRA account language
LOG_ENABLE|Set to `yes` to enable. If enabled, the logfile is `/log/upmpdcli.log`. Otherwise, umpdcli will log to stderr.
LOG_LEVEL|Defaults to `2`
LOG_ENABLE|Set to `yes` to enable to enable logging to file. If enabled, the logfile is `/log/upmpdcli.log`. Otherwise, upmpdcli will log to stderr.
LOG_LEVEL|Sets the log level, if not set the upmpdcli default will apply
UPNP_LOG_ENABLE|Set to `yes` to enable logging to file. If enabled, the logfile is `/log/upnp.log`. Otherwise, upmpdcli will log to stderr.
UPNP_LOG_LEVEL|Sets the log level for upnp, if not set the upmpdcli default will apply
DUMP_ADDITIONAL_RADIO_LIST|Dumps the additional radio file when set to `yes`
WEBSERVER_DOCUMENT_ROOT|Directory from which the internal HTTP server will directly serve files (e.g. icons), disabled by default
STARTUP_DELAY_SEC|Delay before starting the application, defaults to `0`. This can be useful if your container is set up to start automatically, so that you can resolve race conditions with mpd and with squeezelite if all those services run on the same audio device. I experienced issues with my Asus Tinkerboard, while the Raspberry Pi has never really needed this. Your mileage may vary. Feel free to report your personal experience.
Expand Down
2 changes: 1 addition & 1 deletion app/bin/config-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ set_parameter() {
echo "enabling key [$PARAM_KEY]"
sed -i "s/#${PARAM_KEY}/${PARAM_KEY}/g" $CFG_FILE;
echo "Setting value for key [${PARAM_KEY}] to [${PARAM_VALUE}]"
sed -i "s/${PARAM_NAME}/${PARAM_VALUE}/g" $CFG_FILE;
sed -i "s/\b${PARAM_NAME}\b/${PARAM_VALUE}/g" $CFG_FILE;
fi
}
22 changes: 17 additions & 5 deletions app/bin/run-upmpdcli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,24 @@ fi

cp $SOURCE_CONFIG_FILE $CONFIG_FILE

# log support
# log file support
if [ "${LOG_ENABLE^^}" == "YES" ]; then
sed -i "s/#logfilename/logfilename/g" $CONFIG_FILE;
if [ -n "${LOG_LEVEL}" ]; then
set_parameter $CONFIG_FILE LOG_LEVEL "$LOG_LEVEL" loglevel
fi
sed -i "s/#logfilename/logfilename/g" $CONFIG_FILE
fi

# log level
if [ -n "${LOG_LEVEL}" ]; then
set_parameter $CONFIG_FILE LOG_LEVEL "$LOG_LEVEL" loglevel
fi

# upnp log file support
if [ "${UPNP_LOG_ENABLE^^}" == "YES" ]; then
sed -i "s/#upnplogfilename/upnplogfilename/g" $CONFIG_FILE;
fi

# upnp log level
if [ -n "${UPNP_LOG_LEVEL}" ]; then
set_parameter $CONFIG_FILE UPNP_LOG_LEVEL "$UPNP_LOG_LEVEL" upnploglevel
fi

set_upnp_iface=0
Expand Down
5 changes: 4 additions & 1 deletion app/conf/upmpdcli.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
cachedir = CACHE_DIRECTORY
radiolist = /tmp/radiolist.conf
upradiostitle = Upmpdcli Radio List
logfilename = LOG_DIRECTORY/upmpdcli.log
#logfilename = LOG_DIRECTORY/upmpdcli.log
#log level defaults to 2
#loglevel = LOG_LEVEL
#upnplogfilename = LOG_DIRECTORY/upnp.log
#upnp log level defaults to 1
#upnploglevel = UPNP_LOG_LEVEL
#pkgdatadir=/usr/share/upmpdcli
#pidfile = /var/run/upmpdcli.pid
#upnpiface = UPNPIFACE
Expand Down
1 change: 1 addition & 0 deletions doc/change-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Change Date|Major Changes
---|---
2024-03-24|Add support for upnp log file and level (see issue [#383](https://github.com/GioF71/upmpdcli-docker/issues/383)))
2024-03-05|Review default naming (see issue [#381](https://github.com/GioF71/upmpdcli-docker/issues/381)))
2024-03-05|Automatically set upnpip instead of upnpiface (see issue [#379](https://github.com/GioF71/upmpdcli-docker/issues/379)))
2024-02-29|Update workflow actions (see issue [#377](https://github.com/GioF71/upmpdcli-docker/issues/377)))
Expand Down

0 comments on commit 5b0fe15

Please sign in to comment.