π΄ Demo: https://msw-open-music.live
The best way to search for a music is to load up a huge playlist and shuffle until you find it.
A πͺ light weight β‘οΈ blazingly fast π₯οΈ cross platform personal music streaming platform. Manage your existing music files and enjoy them on any devices.
Front-end web application build with react.js
and water.css
, back-end build with golang
and sqlite
.
Screenshot
-
π Index your existing music files, and record file name and folder information.
-
π Use folder π tag π·οΈ review π¬ to manage your music.
-
π Provide a light weight web application with multi-language support.
-
π₯ Multi-user support.
-
π₯ Call
ffmpeg
with customizable preset to stream your music. -
π Share music with others!
-
Already saved a lot of music files on disk. π΄
-
Downloaded tons of huge lossless music. π΅
-
Wants to stream your music files from PC/Server to PC/phone. π
-
Wants to share your stored music. π
-
Modify the
secret
inconfig.json
-
Run back-end server
msw-open-music.exe
ormsw-open-music
. Server will listen on 8080 port by default. Then open http://127.0.0.1:8080 to setup first admin account.
The front-end HTML files are under web/build
The first administrator account will be active automatically, other administrator accounts need active manually.
Go to register page, select the role to admin, and register the first admin account.
-
secret
string type. Secret to encrypt the session. -
database_name
string type. The filename ofsqlite3
database. Will create if that file doesn't exist. -
addr
string type. The listen address and port. -
ffmpeg_config_list
list type, includeffmpegConfig
object. -
file_life_time
integer type (second). Life time for temporary file. If the temporary file is not accessed for more than this time, back-end server will delete this file. -
cleaner_internal
integer type (second). Interval fortmpfs
checking temporary file. -
root
string type. Directory to store temporary files. Default is/tmp
, please modify this directory if you are using Windows. Directory will be created if not exists. -
permission
. Specify each API's permission level.0
for no permission required.1
require admin level (highest level) permission.2
require normal user level permission. That is, both admins and registered users can access to this URL, except anonymous users.- If you want to avoid abuse of the playback API, you can adjust the permission level for these 5 playback-related APIs.
/get_file
get file withio.copy()
method/get_file_direct
get file withhttp.serveFile()
method/get_file_stream
call ffmpeg and stream itsstdout
output/prepare_file_stream_direct
call ffmpeg to convert a file/get_file_stream_direct
get the converted file withhttp.serveFile()
- Other URLs not metion in
config.json
will have0
permission level by default.
For windows user, make sure you have ffmpeg
installed.
Any issues or pull requests are welcome.
v1.0.0
First version. Implement the core streaming function.v1.1.0
UseReact
to rewrite the font-end web pages.v1.2.0
Add user, tag, review and other functions for DBMS course project.
Database Entities Relationship Diagram
-
avatar
is not using currently -
The first time you run the program, the server will create an anonymous user with id
1
. All users who are not logged in will be automatically logged in to this account. -
tmpfs
is store in memory, which will be empty everytime server restart.
If the Prepare
mode is enabled in the font-wed player, back-end server will convert the whole file into the temporary folder, then serve file. This can avoid ffmpeg
pipe break problem cause by unstable network connection while streaming audio.
The default temporary folder is /tmp
, which is a tmpfs
file system in Linux operating system. Default life time for temporary files is 600 seconds (10 minutes). If the temporary file is not accessed for more than this time, back-end server will delete this file.
API does not need to respond any data will return the following JSON object.
{
"status": "OK"
}
Sometime errors happen, server will return the following JSON object, which error
is the detailed error message.
{
"error": "Wrong password"
}
API does not need to send any data should use GET
method, otherwise use POST
method.
Server use cookies to authenticate a user. Any request without cookies will be consider from an anonymous user (aka. user with ID 1
).
Some important source code files:
-
pkg/api/api.go
define URL -
pkg/database/sql_stmt.go
define SQL queries and do the init job. -
pkg/database/struct.go
define JSON structures for database entities.