Fix i3blocks/mpd
This commit is contained in:
parent
f19e98e4c0
commit
d3c14342b3
1 changed files with 10 additions and 8 deletions
|
@ -17,12 +17,12 @@ OUT=${COPROC[0]}
|
||||||
sed '/^OK/q' <&$OUT &>/dev/null
|
sed '/^OK/q' <&$OUT &>/dev/null
|
||||||
|
|
||||||
# Initialisation des valeurs par défaut et des fonctions
|
# Initialisation des valeurs par défaut et des fonctions
|
||||||
declare -i SCROLL=50 I=0
|
declare -i SCROLL=4time_left0 I=0
|
||||||
declare -- artist song oldfile
|
declare -- artist song oldfile
|
||||||
|
|
||||||
human_time() {
|
human_time() {
|
||||||
local seconds="$1"
|
local seconds="${1:-0}"
|
||||||
if [[ "$seconds" -lt 0 ]]
|
if [[ "$seconds" -le 0 ]]
|
||||||
then
|
then
|
||||||
echo "--:--"
|
echo "--:--"
|
||||||
return
|
return
|
||||||
|
@ -159,13 +159,15 @@ do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Gestion du temps
|
# Gestion du temps
|
||||||
time_elapsed=$(human_time "${o["time"]%:*}")
|
|
||||||
time_total=$(human_time "${o["time"]#*:}")
|
|
||||||
time_left=$(human_time "$(( ${o["time"]#*:} - ${o["time"]%:*} ))")
|
|
||||||
|
|
||||||
time="[${time_elapsed:---:--} ${time_left:---:--} ${time_total:---:--}]"
|
declare -i time_elapsed time_total time_left
|
||||||
|
|
||||||
|
time_elapsed="${o["time"]%:*}"
|
||||||
|
time_total="${o["time"]#*:}"
|
||||||
|
time_left="${time_total:-${o["duration"]%.*}} - ${time_elapsed:-${o["Time"]}}"
|
||||||
|
|
||||||
|
time="[$(human_time ${time_elapsed}) $(human_time ${time_left}) $(human_time ${time_total})]"
|
||||||
|
|
||||||
# DEBUG
|
# DEBUG
|
||||||
printf '<b>%s</b>%s<b>%s</b>%s%s\n' "$bloc1" "$bloc2" "$bloc3" "$bloc4" " $status$time</span>"
|
printf '<b>%s</b>%s<b>%s</b>%s%s\n' "$bloc1" "$bloc2" "$bloc3" "$bloc4" " $status$time</span>"
|
||||||
done
|
done
|
||||||
done
|
|
||||||
|
|
Loading…
Reference in a new issue