Crates.io | mecomp-daemon |
lib.rs | mecomp-daemon |
version | 0.1.1 |
source | src |
created_at | 2024-10-11 05:52:17.911476 |
updated_at | 2024-10-12 00:27:32.162643 |
description | The RPC daemon for the mecomp music player, contains client library and server executable. |
homepage | |
repository | https://github.com/AnthonyMichaelTDM/mecomp |
max_upload_size | |
id | 1404950 |
size | 279,564 |
(name subject to change)
MECOMP is a local music player that it is designed to solve a very specific problem:
I have a large collection of music, organizing my music by artist and album is not enough, I want to be able to organize my music by other criteria, such as genre, mood, etc. Typically, I would have to create a playlist for each of these criteria, but that is tedious and time consuming. I want to have automatically curated playlists of similar songs (analogous to genres), dynamically updated playlists of songs that match a certain criteria (basically filters), and be able to create queues of songs that are similar to the current song (think Pandora). There are some services that let you do most of these, like Spotify, but I want to be able to do this with my local music collection and not have to rely on a third party service.
On linux, you will need to have the following packages installed:
libasound2-dev
pkg-config
wget
libavutil-dev
libavformat-dev
# debian/ubuntu
sudo apt-get install libasound2-dev pkg-config wget libavutil-dev libavformat-dev
# Arch (btw)
sudo pacman -S alsa-lib pkg-config wget ffmpeg
MECOMP is written in rust, so you will need to have the rust toolchain installed, you can find installation instructions here.
then clone the repository and compile the project, we provide an x.sh
script that will compile the binaries for you:
git clone https://github.com/AnthonyMichaelTDM/mecomp.git
cd mecomp
./x.sh b # or `cargo build --release --bins` if you don't want to use the script
this will compile the project and place the binaries in the target/release
directory.
As part of the CI/CD pipeline, we provide pre-compiled binaries for the latest commits on the main
branch.
You can find these by navigating to the actions tab and downloading the artifacts for the latest successful build.
The artifacts you'll want to download are dependent on your platform:
mecomp-cli-Windows-x86_64
mecomp-daemon-Windows-x86_64
mecomp-tui-Windows-x86_64
mecomp-cli-Windows-aarch64
mecomp-daemon-Windows-aarch64
mecomp-tui-Windows-aarch64
mecomp-cli-macOs-aarch64
mecomp-daemon-macOs-aarch64
mecomp-tui-macOs-aarch64
mecomp-cli-macOs-x86_64
mecomp-daemon-macOs-x86_64
mecomp-tui-macOs-x86_64
mecomp-cli-Linux-x86_64
mecomp-daemon-Linux-x86_64
mecomp-tui-Linux-x86_64
Other platforms are not currently supported, but you can try compiling the binaries from source.
Precompiled binaries for the latest releases can be found on the releases page. Checksums for the binaries are attached to the release notes.
MECOMP is published on crates.io, you can install the binaries by running:
cargo install mecomp-daemon mecomp-cli mecomp-tui
Note: the following commands assume the MECOMP binaries are either in your
PATH
or in the current directory.If you compiled the binaries from source, you can
cd
into thetarget/release
directory and run the commands from there.
MECOMP is composed of a daemon and several clients that communicate with the daemon, the daemon is the core of the application and handles all the backend logic and state-management necessary for the application to function, the clients are simply frontends to this server.
Before you can use MECOMP, you will need to start the daemon, you can do this by running the daemon binary:
./mecomp-daemon
this will start the daemon, which will listen for RPC requests on localhost:6600
by default (the same port that MPD uses).
Once the daemon starts, it will create a configuration file in the "mecomp" directory in your user's configuration directory:
C:\Users\username\AppData\Roaming\mecomp
on windows$HOME/Library/Application Support/mecomp
on mac$XDG_CONFIG_HOME/mecomp
on linuxYou can use this file to configure things such as the root directory of your music collection, the port the daemon listens on, etc.
Once you have things configured to your liking, you'll have to restart the daemon for the changes to take effect.
Then, you'll have to tell the daemon to start scanning and analysing your music collection, you can do this (in a separate terminal) by running:
# Tell the daemon to start scanning your music collection
./mecomp-cli library rescan
# before moving on, wait for the daemon to finish scanning your music collection
# it will tell you in the logs when it's done, but you can also check the status by running
./mecomp-cli status rescan
# once the daemon has finished scanning your music collection, you can tell it to start analysing your music collection
./mecomp-cli library analyse
# again, wait for the daemon to finish analysing your music collection, it will tell you in the logs when it's done,
# and you can check the status by running
./mecomp-cli status analyse
# once the daemon has finished analysing your music collection, you can tell it to start clustering your music collection
./mecomp-cli library recluster
# again, wait for the daemon to finish clustering your music collection, it will tell you in the logs when it's done,
# and you can check the status by running
./mecomp-cli status recluster
Each of these commands will take some time to complete.
Once the daemon is up and running and has finished scanning, analysing, and clustering your music collection, you can use the clients to interact with the daemon, the current most "user-friendly" client is the TUI, you can start the TUI by running:
./mecomp-tui
this will start the TUI in your console, which will allow you to interact with the daemon.
To add music to the app, simply put the music files into one of the directories configured in the daemon's configuration file, then tell the daemon to rescan your music collection. By default, this includes your users Music directory, but you can add more directories by editing the configuration file.
You can get music from a variety of sources, such as:
For example, you can use a tool like yt-dlp to download music from youtube music
# example, downloads a playlist from YouTube Music, and converts it to mp3
yt-dlp --extract-audio --audio-format mp3 --yes-playlist --embed-thumbnail --embed-metadata --concurrent-fragments 4 -o '%(title)s.%(ext)s' <playlist-url>
(replace <playlist-url>
with the url of the playlist you want to download)
you can then use an audio tagger such as MusicBrainz Picard to tag the music files with missing metadata.
MECOMP is designed to be modular and extensible, and is composed of a daemon (which is the core of the application), and several clients that communicate with the daemon.
MECOMP-Daemon is a long-running RPC server that is the core of the application, it handles all the backend logic and state-management necessary for the application to function. the MECOMP clients are simply frontends to this server. It is written in rust and uses google's tarpc library for inter-process communication via RPC.
MECOMP-CLI is a command line interface for MECOMP, it provides a simple way to interact with the daemon.
MECOMP-TUI is a terminal user interface for MECOMP, it provides a more user friendly way to interact with the daemon, but still in a terminal.
MECOMP-GUI is a graphical user interface for MECOMP, it provides a more user friendly way to interact with the daemon.
the GUI is not currently implemented, but is planned for the future.
If you have a question or need help, feel free ask in the discussions section of the repository.
If you encounter a bug or have a feature request, please open an issue in the issues section of the repository.
Note about bugs: if you encounter a bug, please provide as much information as possible, including the steps to reproduce the bug, the expected behavior, the actual behavior, and any error messages you see, without this information it will be very difficult to diagnose and fix the bug.
Note: this section is only relevant if you are a developer working on MECOMP.
MECOMP uses open-telemetry for tracing, and is designed to integrate with a jaeger instance for distributed tracing.
this can be enabled by enabling the otel_tracing
feature.
cargo run --features otel_tracing
to run a jaeger instance, you can use the official docker image, for convenience there is a script that will run a jaeger instance in a docker container:
./scripts/start_jaeger_container.sh
to create a flame graph of the daemon, compile it with the flame
feature enabled, and run the daemon as you normally would.
cargo run --features flame
this will create a file called tracing.folded
in the current directory, which can be used to create a flame graph with inferno:
cargo install inferno
then run:
# flamegraph
cat tracing.folded | inferno-flamegraph > tracing-flamegraph.svg
# flamechart
cat tracing.folded | inferno-flamegraph --flamechart > tracing-flamechart.svg
MECOMP uses cargo-nextest
for testing (cargo test
will work too, but is slower), to run the test suite:
cargo nextest run
MECOMP uses tarpaulin
to generate test coverage reports, to generate a test coverage report, run:
cargo coverage
this will generate a file called tarpaulin-report.html
in the current directory, which can be viewed in your browser.
MECOMP uses several git hooks to ensure code quality, these are stored in the .githooks
directory, to install these hooks, run:
git config core.hooksPath .githooks