class Snooze(Thread): """Activate a thread for Snooze function.""" def __init__(self, radiosnooze, minutessnooze): Thread.__init__(self) self.radio = radiosnooze self.duree = minutessnooze * 60 self.client = PersistentMPDClient() self.client.clear() def run(self): """start jouerMPD stop during minutesnooze then stop MPD.""" self.client.add(self.radio) self.client.play() time.sleep(self.duree) self.client.stop()
class Snooze(Thread): """Activate a thread for Snooze function.""" def __init__(self, radiosnooze, minutessnooze): Thread.__init__(self) self.radio = radiosnooze self.duree = minutessnooze*60 self.client = PersistentMPDClient() self.client.clear() def run(self): """start jouerMPD stop during minutesnooze then stop MPD.""" self.client.add(self.radio) self.client.play() time.sleep(self.duree) self.client.stop()
class Chrono_(Thread): """Activate a thread for chrono function.""" def __init__(self, mediachrono, minuteschrono): Thread.__init__(self) self.media = mediachrono self.duree = minuteschrono * 60 self.client = PersistentMPDClient() self.client.clear() def run(self): """start jouerMPD after a delay = minuteschrono.""" print "ok" time.sleep(self.duree) self.client.add( '/home/pi/Apiclock_PROD/app/static/music/UPLOAD_call.mp3') self.client.play() # DEBUGG print "----------------" print self.media # DEBUGG time.sleep(120) self.client.stop()
class Chrono_(Thread): """Activate a thread for chrono function.""" def __init__(self, mediachrono, minuteschrono): Thread.__init__(self) self.media = mediachrono self.duree = minuteschrono * 60 self.client = PersistentMPDClient() self.client.clear() def run(self): """start jouerMPD after a delay = minuteschrono.""" print "ok" time.sleep(self.duree) self.client.add('/home/pi/Apiclock_PROD/app/static/music/UPLOAD_call.mp3') self.client.play() # DEBUGG print "----------------" print self.media # DEBUGG time.sleep(120) self.client.stop()