1 -- Authors: Mark Tran <mark@nirv.net>
3 -- Last Changed: Unknown
5 -- statusd_amarok.lua : Mark Tran <mark@nirv.net>
7 -- Display current track from Amarok
9 if not statusd_amarok
then
10 statusd_amarok
= { interval
= 3*1000 }
13 local function amarok_dcop()
14 local f
= io
.popen('dcop amarok player nowPlaying 2> /dev/null', 'r')
15 local amarok
= f
:read('*l')
21 local function amarok_status()
22 local f
= io
.popen('dcop amarok player status 2> /dev/null', 'r')
23 local status
= f
:read('*l')
29 local function change_display()
30 local status
= amarok_status()
34 elseif status
== "1" then
35 local amarok
= amarok_dcop()
37 if (amarok
~= nil) then
38 return amarok
.." (paused)"
40 elseif status
== "2" then
49 local function update_amarok()
50 statusd
.inform("amarok", change_display())
51 amarok_timer
:set(statusd_amarok
.interval
, update_amarok
)
54 amarok_timer
= statusd
.create_timer()