Exemple #1
0
    def inter(self, getter, status, volume, track, position):
        Logger.debug("Spotify : {} : volume={} : track ={} : position {}".format(status, volume, track, position))
        if status == "start":
            if self.analysis:
                self.player.start()
                self.track = Track(self.sp, self.player, track)
        elif status == "playing":
            if self.analysis:
                self.player.start()
                print("music = {} : player = {} : diff = {}".format(position, self.player.tps, int(position)-self.player.tps))
                self.player.set(int(position))
            if not(self.state) and self.scenar_start:
                self.scenar_start.do()
            self.state = True

        elif status == "paused":
            if self.analysis:
                self.player.stop()
                print("music = {} : player = {} : diff = {}".format(position, self.player.tps, int(position)-self.player.tps))
            if self.state and self.scenar_stop:
                self.scenar_stop.do()
            self.state = False

        elif status == "stop":
            if self.analysis:
                self.player.stop()
            if self.state and self.scenar_stop:
                self.scenar_stop.do()
            self.state = False

        elif status == "volume_set":
            # on set le nv volume
            print("nv volume = "+str(volume))
            if abs(volume-self.volume) > 20:
                self.scenar_volume.do()
                self.volume = volume

        elif status == "change":
            if self.analysis:
                track = Track(self.sp, self.player, track)
                if self.track != None:
                    self.track.kill()
                self.track = track
Exemple #2
0
 def start(self):
     hello = self.connect()
     while hello == None:
         hello = self.connect()
         sleep(0.1)
     Logger.debug("hello msg : " + hello)