selectsong
public sql v1 · immutableSELECT song_id, localpath, IFNULL( IF(played+skipped>=10, (played/(played+skipped))*10, 0), 0) + IFNULL( least(604800, time_to_sec(timediff(NOW(), lastPlayed)))/604800*8, 0) + IF( played+skipped=0, 15, 0) + IFNULL( IF( time_to_sec(timediff(NOW(),added))<1209600, time_to_sec(timediff(NOW(),added))/1209600*5, 0), 0) scoreFROM songsORDER BY score DESC, rand()LIMIT 0,1