Meilleure gestion des morceaux sans artiste

This commit is contained in:
Breizh 2022-08-24 21:36:28 +02:00
parent 1592e3b1e9
commit 60116d5ded
6 changed files with 19 additions and 8 deletions
.i3blocks

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -x
# Fonction de réinitialisation en cas de perte de la connexion
self-reset() {
@ -99,11 +99,18 @@ do
# on réinitialise laffichage défilant
if [[ "${o["file"]}" != "${old["file"]}" || "${o["Title"]}" != "${old["Title"]}" || "${o["Name"]}" != "${old["Name"]}" ]]
then
unset bloc1 bloc2 bloc3 bloc4
artist="${o["Artist"]:-${o["Name"]}}"
song="${o["Title"]}"
[[ -z "$artist$song" ]] && song="$(basename "${o["file"]}")"
if [[ -z "$artist" ]]
then
if [[ -z "$song" ]]
then
song="$(basename "${o["file"]}")"
else
song="$song $(basename "${o["file"]}")"
fi
fi
if [[ "$(( ${#song} + ${#artist} + 1 ))" -gt "$SCROLL" ]]
then
scroll=true
@ -180,3 +187,5 @@ do
printf '<b>%s</b>%s<b>%s</b>%s%s\n' "$bloc1" "$bloc2" "$bloc3" "$bloc4" " $status$time</span>"
done
self-reset