def StartLog(self): client = GetMPD() state = client.status() if (state['state'] == "play"): currentSong = client.currentsong() self.lastSong = currentSong['file'] self.lastTime = state['elapsed'] client.disconnect()
def StartLog(self): client = GetMPD() state = client.status() if(state['state'] == "play"): currentSong = client.currentsong() self.lastSong = currentSong['file'] self.lastTime = state['elapsed'] client.disconnect();
def Fix(): client = GetMPD() state = client.status() if(state['state'] == "stop"): client.disconnect() return while(client.currentsong()["pos"] != "0"): queue = client.playlistinfo() print queue songName = queue[0]["file"] songID = queue[0]["id"] client.deleteid(songID) client.add(songName) client.disconnect()
def AddLog(self): client = GetMPD() state = client.status() currentSong = client.currentsong() if (state['state'] != "play"): client.disconnect() return print "time= " + currentSong['time'] if (currentSong['file'] == self.lastSong and state['elapsed'] >= self.lastTime): client.disconnect() return self.lastSong = currentSong['file'] self.lastTime = state['elapsed'] print self.lastSong conn = Database.GetConnection() c = conn.cursor() Exists = c.execute( "SELECT EXISTS(SELECT 1 FROM songPlays WHERE fileName=? LIMIT 1)", (self.lastSong, )) if (Exists.fetchone()[0] == 0): c.execute("INSERT INTO songPlays VALUES (?,1)", (self.lastSong, )) else: c.execute("UPDATE songPlays SET times=times+1 WHERE fileName=?", (self.lastSong, )) conn.commit() conn.commit() conn.close() client.disconnect()
def AddLog(self): client = GetMPD() state = client.status() currentSong = client.currentsong() if(state['state'] != "play"): client.disconnect() return print "time= "+currentSong['time'] if(currentSong['file'] == self.lastSong and state['elapsed'] >= self.lastTime): client.disconnect() return self.lastSong = currentSong['file'] self.lastTime = state['elapsed'] print self.lastSong conn = Database.GetConnection() c = conn.cursor() Exists = c.execute("SELECT EXISTS(SELECT 1 FROM songPlays WHERE fileName=? LIMIT 1)",(self.lastSong,)); if(Exists.fetchone()[0] == 0): c.execute("INSERT INTO songPlays VALUES (?,1)",(self.lastSong,)) else: c.execute("UPDATE songPlays SET times=times+1 WHERE fileName=?",(self.lastSong,)) conn.commit() conn.commit() conn.close() client.disconnect();