def dj_heartbeat_check(): # Don't do this in testing environments if config.get("developer_mode"): return for sid in config.station_ids: if cache.get_station(sid, "backend_paused_playing"): hb = cache.get_station(sid, "dj_heartbeat") hbs = cache.get_station(sid, "dj_heartbeat_start") if not hbs or ((timestamp() - hbs) <= 10): pass elif not hb or ((timestamp() - hb) >= 15): log.warn("dj_heartbeat", "DJ heart attack - resetting station to normal.") cache.set_station(sid, "backend_paused", False) cache.set_station(sid, "backend_paused_playing", False) liquidsoap.kick_dj(sid) liquidsoap.skip(sid)
def post(self): if not cache.get_station(self.sid, "backend_paused"): result = "Station seems unpaused already. " else: result = "Unpausing station. " cache.set_station(self.sid, "backend_paused", False) if (cache.get_station(self.sid, "backend_paused_playing")): result += "Automatically starting music. " result += "\n" result += liquidsoap.skip(self.sid) else: result += "If station remains silent, music will start playing within 5 minutes unless you hit skip." if (self.get_argument("kick_dj", default=False)): result += "Kicking DJ. " result += "\n" result += liquidsoap.kick_dj(self.sid) attach_dj_info_to_request(self) self.append(self.return_name, { "success": True, "message": result })
def post(self): if not cache.get_station(self.sid, "backend_paused"): result = "Station seems unpaused already. " else: result = "Unpausing station. " cache.set_station(self.sid, "backend_paused", False) cache.set_station(self.sid, "backend_pause_extend", False) if (cache.get_station(self.sid, "backend_paused_playing")): result += "Automatically starting music. " result += "\n" result += liquidsoap.skip(self.sid) else: result += "If station remains silent, music will start playing within 5 minutes unless you hit skip." if (self.get_argument("kick_dj", default=False)): result += "Kicking DJ. " result += "\n" result += liquidsoap.kick_dj(self.sid) self.append(self.return_name, { "success": True, "message": result })