--- /dev/null
+#!/bin/sh
+
+. /usr/bin/hvutils.sh
+
+fill=" "
+
+l1="HVMPD"
+l2=""
+l3=""
+l4=""
+
+# Previous line variables:
+l1p=""
+l2p=""
+l3p=""
+l4p=""
+
+led_on() {
+ cat /sys/class/leds/status/max_brightness > /sys/class/leds/status/brightness
+}
+
+led_off() {
+ echo 0 > /sys/class/leds/status/brightness
+}
+
+lcd_init
+
+while true; do
+ # Future bouton play/pause:
+ # mpc toggle -> pause/play/pause...
+
+ # mpc -f "<%name%> <%title%> <%album%>" current
+ current="$(mpc current)"
+ log_dbg "current = ${current}"
+
+ if [ "${current}" = "" ]; then
+ led_off
+ song=""
+ artist=""
+ else
+ led_on
+
+ # | awk '{$1=$1};1' --> trim spaces before and after
+
+ station="${current}"
+
+ if echo "${current}" | grep -q -e "http" ; then
+ station="${current}"
+ elif echo "${current}" | grep -q -e ":" ; then
+ station="$(echo ${current} | awk -F: '{print $1}' | awk '{$1=$1};1')"
+ fi
+
+ song="$(echo ${current} | awk -F: '{print $2}' | awk '{$1=$1};1')"
+
+ if [ "${station}" != "${station_prev}" -o \
+ "${song}" != "${song_prev}" ]; then
+
+ log_dbg "station = ${station}"
+
+ l1="${station}"
+
+ if [ "${song}" != "${station}" ]; then
+ log_dbg "song = ${song}"
+
+ if echo "${song}" | grep -q -e "---" ; then
+ artist="$(echo ${song} | sed "s@\(^.*\)---.*@\1@")"
+ song="$(echo ${song} | sed "s@^.*---\(.*\)@\1@")"
+ elif echo "${song}" | grep -q -e " - " ; then
+ artist="$(echo ${song} | sed "s@\(^.*\) - .*@\1@")"
+ song="$(echo ${song} | sed "s@^.* - \(.*\)@\1@")"
+ else
+ artist=""
+ fi
+
+ log_dbg "artist = ${artist}"
+ fi
+ fi
+ fi
+
+ station_prev="${station}"
+ song_prev="${song}"
+ artist_prev="${artist}"
+
+ l1="${station}"
+
+ if [ "${artist}" != "" ]; then
+ l2="${artist}"
+ l4="${song}"
+ else
+ l2="${song}${fill}"
+ l4="$(printf "%.20s\n" "${l2:20}")"
+ fi
+
+ # Bug, écran défectueux ligne 3...
+ l3=""
+
+ lcd_update
+
+ sleep 1
+done
--- /dev/null
+DESCRIPTION = "hvmpd daemon"
+SECTION = "multimedia"
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
+
+PV = "0.0.1"
+
+SRC_URI = "\
+ file://hvmpd.service \
+ file://hvmpd.sh \
+"
+
+RDEPENDS:${PN} += "bash hvutils"
+
+inherit systemd
+
+do_install() {
+ install -d ${D}${sbindir}
+ install -m 0755 ${WORKDIR}/hvmpd.sh ${D}${sbindir}
+
+ install -d ${D}${systemd_unitdir}/system
+ install -m 0644 ${WORKDIR}/hvmpd.service ${D}${systemd_unitdir}/system
+}
+
+FILES:${PN} = " \
+ ${systemd_unitdir}/system/hvmpd.service \
+ ${sbindir}/hvmpd.sh \
+"
+
+SYSTEMD_AUTO_ENABLE = "enable"
+SYSTEMD_SERVICE:${PN} = "hvmpd.service"