anyaudio / anyaudio-server

:musical_note: Simple server to search youtube and give direct audio download and stream links
91 stars 19 forks source link

Api v1 doc #27

Closed singhpratyush closed 8 years ago

singhpratyush commented 8 years ago

API v1 is ready. Please check and comment/merge.

singhpratyush commented 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.

singhpratyush commented 8 years ago

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.

aviaryan commented 8 years ago

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.

singhpratyush commented 8 years ago

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.

aviaryan commented 8 years ago

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.

singhpratyush commented 8 years ago

Implemented SQLite database.

Also added networking.py, database.py and Scheduler class.

singhpratyush commented 8 years ago

I have tested the new API. You may merge this PR.

It closes #19 and #20.