Пример #1
0
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()
Пример #2
0
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()
Пример #3
0
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()
Пример #4
0
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()