musicdb/README.md

99 lines
3.5 KiB
Markdown
Raw Normal View History

2023-08-13 23:58:53 +02:00
# musicdb
2023-09-28 16:39:32 +02:00
custom music player which can be controlled from other WiFi devices (phone/pc)
2023-08-13 23:58:53 +02:00
should perform pretty well (it runs well on my Pine A64 with 10k+ songs)
2023-09-28 16:39:32 +02:00
https://github.com/Dummi26/musicdb/assets/67615357/8ba85f00-27a5-4e41-8688-4816b8aaaff4
2023-08-13 23:58:53 +02:00
## why???
#### server/client
allows you to play music on any device you want while controlling playback from anywhere.
2023-09-28 16:39:32 +02:00
you can either run the client and server on the same machine or have them be in the same network
so that they can connect using TCP.
2023-08-13 23:58:53 +02:00
if one client makes a change, all other clients will be notified of it and update almost instantly.
it is also possible for a fake "client" to mirror the main server's playback, so you could sync up your entire house if you wanted to.
#### complicated queue
- allows more customization of playback (loops, custom shuffles, etc.)
- is more organized (adding an album doesn't add 10-20 songs, it creates a folder so you can (re)move the entire album in/from the queue)
#### caching of songs
for (almost) gapless playback, even when the data is stored on a NAS or cloud
2023-09-28 16:49:40 +02:00
#### custom database file
2023-08-13 23:58:53 +02:00
when storing data on a cloud, it would take forever to load all songs and scan them for metadata.
you would also run into issues with different file formats and where to store the cover images.
a custom database speeds up server startup and allows for more features.
2023-08-14 00:20:09 +02:00
## usage
### build
build `musicdb-server` and `musicdb-client` (and `musicdb-filldb`) using cargo.
2023-08-24 16:28:28 +02:00
Note: the client has a config file in ~/.config/musicdb-client/, which includes the path to a font. You need to set this manually or the client won't start.
The file and directory will be created when you first run the client in gui mode.
2023-08-14 00:20:09 +02:00
## setup
2023-08-24 16:23:18 +02:00
### prep
2023-08-14 00:20:09 +02:00
You need some directory where your music is located (mp3 files).
I will assume this is `/music` for simplicity.
You will also need a file that will hold your database.
I will assume this is `dbfile`.
Note: Instead of adding the executables (`musicdb-client` and `musicdb-server`) to your `$PATH`, you can run `cargo run --release -- ` followed by the arguments.
2023-09-28 16:49:40 +02:00
Since this is using cargo, you need to be in the source directory for whatever you want to run.
2023-08-14 00:20:09 +02:00
2023-08-24 16:23:18 +02:00
### database
2023-08-14 00:20:09 +02:00
2023-08-24 16:23:18 +02:00
`musicdb-filldb` will read all files in the /music directory and all of its subdirectories, read their metadata and try to figure out as much about these songs as possible. It will then generate a `dbfile` which `musicdb-server` can read.
You can make changes to the database later, but this should be the easiest way to get started:
2023-08-14 00:20:09 +02:00
```sh
2023-08-24 16:23:18 +02:00
musicdb-filldb /music
2023-08-14 00:20:09 +02:00
```
2023-08-24 16:23:18 +02:00
### starting the server
2023-08-14 00:20:09 +02:00
2023-09-28 16:49:40 +02:00
Copy the `musicdb-server/assets` directory to `./assets`, then run:
2023-08-14 00:20:09 +02:00
```sh
musicdb-server dbfile /music --tcp 127.0.0.1:26314 --web 127.0.0.1:8080
2023-08-14 00:20:09 +02:00
```
2023-09-28 16:49:40 +02:00
Note: If you don't care about the HTML site, you can leave out the `--web 127.0.0.1:8080`.
You also won't need the `assets` then.
2023-08-24 16:23:18 +02:00
And that's it - the rest should just work.
2023-08-14 00:20:09 +02:00
2023-08-24 16:23:18 +02:00
You can now open 127.0.0.1:8080 in a browser or use `musicdb-client`:
2023-08-14 00:20:09 +02:00
```sh
musicdb-client 127.0.0.1:26314 gui
2023-08-14 00:20:09 +02:00
```
### syncplayer
`musicdb-client` has a syncplayer mode, where it will play back songs in sync with the server.
It's usually easier to use syncplayer-network, which will get the song files from the server,
but syncplayer-local may be more stable and responsive, because it assumes you have a local copy of the server's music files (`/music`) somewhere, for example at `~/music`:
2023-08-14 00:20:09 +02:00
```sh
musicdb-client 127.0.0.1:26314 syncplayer-network
```
```sh
musicdb-client 127.0.0.1:26314 syncplayer-local ~/music
2023-08-14 00:20:09 +02:00
```