seek: Ceil position to duration - 5s
[cmus.git] / cmus-status-display
blob12b8977fba93c41e078849e48df920251af855fb
1 #!/bin/sh
3 # cmus-status-display
5 # Usage:
6 # in cmus command ":set status_display_program=cmus-status-display"
8 # This scripts is executed by cmus when status changes:
9 # cmus-status-display key1 val1 key2 val2 ...
11 # All keys contain only chars a-z. Values are UTF-8 strings.
13 # Keys: status file url artist album discnumber tracknumber title date
14 # - status (stopped, playing, paused) is always given
15 # - file or url is given only if track is 'loaded' in cmus
16 # - other keys/values are given only if they are available
19 output()
21 # write status to /tmp/cmus-status (not very useful though)
22 echo "$*" >> /tmp/cmus-status 2>&1
24 # WMI (http://wmi.modprobe.de/)
25 #wmiremote -t "$*" &> /dev/null
28 while test $# -ge 2
30 eval _$1='$2'
31 shift
32 shift
33 done
35 if test -n "$_file"
36 then
37 h=$(($_duration / 3600))
38 m=$(($_duration % 3600))
40 duration=""
41 test $h -gt 0 && dur="$h:"
42 duration="$dur$(printf '%02d:%02d' $(($m / 60)) $(($m % 60)))"
44 output "[$_status] $_artist - $_album - $_title ($_date) $duration"
45 elif test -n "$_url"
46 then
47 output "[$_status] $_url - $_title"
48 else
49 output "[$_status]"