The request table will keep track of 3 states (played, ignored, pending). Do check that table, i've had erroneous request hang in pending state for no apparent reason. Also, the request table takes the code returned - filter for requests that have a code of 200 and played as reqstatus. Not all your request counts will be of those values. A song can be requested 400 times, but only return a 200 code the 1st time, as it doesn't violate your playlist rules. Sort your requestlist by songID, then by code = 200, then by status = played, then t_stamp < date1 and > date2. That will give you as close to what you are looking for as i can think of. then take the top X number of rows and output the songIDs. You can easily do a fetch to songlist where songID = songID.
You could capture the 200 response of a successful request and send it to a mongoDB server that only holds songIDS, numeric value and timestamp, then do a simple descending sort on request count with today - 30 days on timestamp values.
|