mirror of
https://github.com/gryf/wmdocklib.git
synced 2025-12-19 04:20:17 +01:00
migliorie sul feedback:
se il player muore o viene ammazzato esternamente, il programma se ne accorge.
This commit is contained in:
@@ -47,8 +47,18 @@ class Application(wmoo.Application):
|
|||||||
else:
|
else:
|
||||||
self.radioList.append( (radioname+' '*24, radiodef[1], radiodef[2]) )
|
self.radioList.append( (radioname+' '*24, radiodef[1], radiodef[2]) )
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
self._cacheLevel = -50
|
||||||
|
self.child = None
|
||||||
|
self._paused = None
|
||||||
|
self.showCacheLevel()
|
||||||
|
|
||||||
|
|
||||||
|
def handler(self, num, frame):
|
||||||
|
self.reset()
|
||||||
|
|
||||||
def startPlayer(self):
|
def startPlayer(self):
|
||||||
import os, subprocess
|
import os, subprocess, signal
|
||||||
commandline = [mplayer,
|
commandline = [mplayer,
|
||||||
'-cache', self.radioList[self.currentRadio][2],
|
'-cache', self.radioList[self.currentRadio][2],
|
||||||
self.radioList[self.currentRadio][1]
|
self.radioList[self.currentRadio][1]
|
||||||
@@ -57,6 +67,7 @@ class Application(wmoo.Application):
|
|||||||
stdin =subprocess.PIPE,
|
stdin =subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=devnull)
|
stderr=devnull)
|
||||||
|
signal.signal(signal.SIGCHLD, self.handler)
|
||||||
self._paused = False
|
self._paused = False
|
||||||
self._buffered = ''
|
self._buffered = ''
|
||||||
self._buffering = 1
|
self._buffering = 1
|
||||||
@@ -71,8 +82,6 @@ class Application(wmoo.Application):
|
|||||||
self.child.stdin.write('q')
|
self.child.stdin.write('q')
|
||||||
import os, signal
|
import os, signal
|
||||||
os.kill(self.child.pid, signal.SIGKILL)
|
os.kill(self.child.pid, signal.SIGKILL)
|
||||||
self.child = None
|
|
||||||
self._paused = None
|
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -102,8 +111,7 @@ class Application(wmoo.Application):
|
|||||||
|
|
||||||
def stopStream(self, event):
|
def stopStream(self, event):
|
||||||
self.stopPlayer()
|
self.stopPlayer()
|
||||||
self._cacheLevel = -50
|
self.reset()
|
||||||
self.showCacheLevel()
|
|
||||||
|
|
||||||
def pauseStream(self, event):
|
def pauseStream(self, event):
|
||||||
if self.child:
|
if self.child:
|
||||||
@@ -162,6 +170,10 @@ class Application(wmoo.Application):
|
|||||||
self._buffered = self._buffered[rpos:]
|
self._buffered = self._buffered[rpos:]
|
||||||
self.showCacheLevel()
|
self.showCacheLevel()
|
||||||
|
|
||||||
|
def handler(num, frame):
|
||||||
|
hdmon.updateMonitoredPaths()
|
||||||
|
signal.alarm(10)
|
||||||
|
|
||||||
palette = {
|
palette = {
|
||||||
'-': "#000000",
|
'-': "#000000",
|
||||||
".": "#868682",
|
".": "#868682",
|
||||||
|
|||||||
Reference in New Issue
Block a user