(music) streaming service for bilibili and youtube
Inspiration
Sometimes ( & most of the working time) I just want to listen to the music from content creators on Bilibili rather than the video or drawings (though they may be quite awesome wwwww). That is fine if I am using a browser, because I can let the video playing in background. While on android devices, the application won't let us do this. The same issue exists for YouTube mobile application (This is why they introduced youtube Red?).
A great command line tool called youtube-dl may solve this problem. Together with mpv
, I managed to listen to music playlists on Youtube without video. It is as simple as one line mpv --no-video <url-of-the-video-or-playlist>
.
How to make use of this tool for mobile phones? I found an awesome otaku music streaming service recently: r/a/dio, in which people are free to request songs into the queue. Why not make a similar service but with music from Bilibili/YouTube video? I ask myself.
Preparation
For hardwares, this task requires a linux server, a development PC and a test android phone, which are quite handy for me. For softwares, the most tricky part will be left to web scrawling experts who develop youtube-dl
. However, basic web development and android application development are still required.
Since youtube-dl
is written in python, it would be convinient to glue with web frameworks like django
or flask
. But Java is the main language for android development and that is the problem. It seems there exists a tool called python-for-android for converting python softwares to apk. The application / server approach already solved this problem, that android app only need to communicate with server to get the results from youtube-dl
. A flask api-server may be folked to this project.
For the streaming part, a simple HTTP streaming may be not enough. I will take icecast into consideration if that is the case.
Projects / proposals
Pure Android Version
It would be a good practice to build a android app from python codes.
python-for-android and kivy made this possible. And this will not require a working server, which should be more convinient for slow connections.
Web + Server (stream)
This an easy one because both server and client parts can be coded using frameworks in python or javascript. Video files can be downloaded and converted into music files using system calls of youtube-dl or in pure python functions.
The web client part should take care of searching video or playlists, adding url to the queue, saving user collections, and of course playing the stream file.
Android + Server (stream)
Just another implement of the web client of last proposal. A good chance to dig into Kotlin / scala android development.
Android + Server (API)
If the python-to-android convertion is not working or too redundent, the API server will be useful. This solution is good for users who are more willing to enjoy their own collections of music.
raspberry Pi version
Raspberry Pi is basically a server with low computational power. So this implement should be as simple as writing a shell scripts to download and convert and play the music. In addition, the streaming service from other solution can be also streamed to raspberry Pi.