8 class MplayerController
:
11 self
.vars = "XAUTHORITY=/home/honza801/.Xauthority DISPLAY=:0.0"
14 process
= os
.popen('pgrep mplayer').readline()
16 return int(string
.strip(process
))
19 def getchannels(self
):
20 process
= os
.popen('tv lschan').readline()
22 channels
= map(string
.strip
, process
.split(","))
27 pid
= self
.is_running()
32 print "Sending SIGTERM to", pid
33 os
.kill(pid
,signal
.SIGTERM
)
35 def play(self
, channel
):
36 pid
= self
.is_running()
38 print "Another mplayer is running with pid", pid
41 ret
= os
.system(self
.vars+" tv "+channel
+" >/dev/null 2>&1 &")
45 class VolumeController
:
47 def __init__(self
, mixdevice
='Master'):
48 self
.mixdevice
= alsaaudio
.Mixer(mixdevice
)
51 return self
.mixdevice
.getvolume()
54 newvol
= self
.mixdevice
.getvolume()+10
57 self
.mixdevice
.setvolume(newvol
)
60 newvol
= self
.mixdevice
.getvolume()-10
63 self
.mixdevice
.setvolume(newvol
)
66 if __name__
== "__main__":
67 mpc
= MplayerController()