Closed singhpratyush closed 8 years ago
API v1 is ready. Please check and comment/merge.
Implementation of trending songs is yet to be done. Please do not merge.
As of now, getting views
for trending songs is an expensive process (requires n+1
page load calls for n
videos), and getting age
for the same is not possible unless we get time of upload and deploy our own logic to calculate it.
And as of now, API v1
is ready.
As of now, getting views for trending songs is an expensive process (requires n+1 page load calls for n videos), and getting age for the same is not possible unless we get time of upload and deploy our own logic to calculate it.
As discussed, we can just run another thread every 3 hrs or so which fetches the trending songs and saves them to DB. As it won't require much storage and it is not important to preserve its state, using the inbuilt SQLite module should be sufficient . We can even consider using a simple text file for this situation.
We can even consider using a simple text file for this situation.
A better alternative to plain text would be json
. But then we will have to take care of the reader writer problem
, which will not be the case with SQLite
.
A better alternative to plain text would be json.
:unamused:
But then we will have to take care of the reader writer problem, which will not be the case with SQLite
Yes you are right. SQLite will not have this problem. So let's use it.
Implemented SQLite database
.
Also added networking.py
, database.py
and Scheduler
class.
I have tested the new API. You may merge this PR.
It closes #19 and #20.
API v1 is ready. Please check and comment/merge.