Lektor
A Karaoke player made to replace the old bash scripts on Sakura.
Table of content
Building the player
Prerequisites
- rust compiler with version >= 1.72
- cmake at least the version 3.17
- a C++ compiler with C++20 support
- mpv development library
- Qt6 development library, QtCore, QtWidgets, QtOpenGL, QtOpenGLWidgets.
On arch you may install the following packages: qt6-multimedia-ffmpeg
, qt6-translations
,
qt6-declarative
, qt6-multimedia
, qt6-wayland
, qt6-tools
, qt6-base
, qt6-svg
, mpv
,
cmake
, cmake-extra-modules
. The usual way of installing rust is by executing their script:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
To visualize dependencies of the rust part of lektor, you can call the script
utils/scripts/print-cargo-deps.bash
from the workspaces. You will also need to have dot
utility
from the graphviz
package to be installed for that script to work.
Building instructions
The manual way of installing and setting up lektor. We will suppose that cargo will place all the
binaries inside the target
folder:
cargo build --release
install -CD -m 0755 utils/scripts/kagary.py $HOME/.local/bin/kagary
cp target/release/{lektord,liblektor_c.so,lkt,amadeus} $HOME/.local/bin/
To develop, you can use cargo run --bin $BINARY
to run the desired binary without installing it.
To change the used c++ compiler, you must export the CXX
variable that indicates the correct
compiler: CXX=clang++ cargo build --release
. By default the build artifacts for the c++ code are
placed in the .build
folder at the root of the project. If you specify another compiler they will
be placed in the .build.$(basename "$CXX")
folder.
Important note: Upgrading the database from version 2.4 to version 3 is not possible. You need to delete the database and re-dl all the karas from kurisu.
How to use lektor
Launch instructions
To run lektor, you can simply run the binary like: ./lektord
. Be sure to place the
liblektor_c.so
shared library next to the lektord
binary before executing it. If lektord did
not exit normally. Lektor will use specialized software (hwdec set to yes), if you have an nvidia
card with optimus (in almose every laptop), please use optirun
or primusrun
.
How to update the lektord database
To update the lektor database, you first need to launch lektord
, then use the lkt -Au
to update
the database and import users' favorite lists as playlists. You can also perform the update action
from the amadeus
client, in the search section.
While connected to kurisu, you need to obtain a token, it can be achieved by visiting the page
https://kurisu.iiens.net/api/download.php?token while being connected. You must copy this token in
the token
field of the repo
section. For amadeus
you can also use the link in the settings
section.
How to send commands to lektor
To send commands to lektor, you can use lkt
or build your own by calling directly the REST API
with curl or other things. For graphical things, you can use amadeus
which is a client written in
iced.
The lektord
daemon and the amadeus
client implements the
MPRIS Specification. As such you can
use any MPRIS-able client to control them (playerctl, directly calling dbus things, etc.) By default
lektord
enables MPRIS while amadeus
doesn't, this behaviour can be changed in the config files.
How to configure lektor
Lektor uses a single configuration file per tool, you will find those files in the folder:
-
$XDG_CONFIG_HOME/lektor
ifXDG_CONFIG_HOME
is defined -
$HOME/.config/lektor
otherwise
The default configuration file will be created on the first launch of the tool. In this
configuration folder the lektord program will store its configuration in lektord.toml
, lkt in
lkt.toml
, amadeus in amadeus.toml
, etc.
For amadeus
, you can edit its configuration file in the settings section.
Misc
The lektord and related binaries and source code are under the MIT license. Please, refer to the CONTRIBUTING file for any contributions.
Building for windows
Windows 64 bit binaries are built from a linux system. On arch, install the packages
mingw-w64-gcc
, mingw-w64-cmake
(aur), mingw-w64-make
(aur). You may also install the
mingw-w64-qt6-*
(aur) packages. For the mpv library, install the packages in [utils/arch-pkgs].
Make sure that you have the windows toolchain for 64 bit installed. Run the followinf commands:
(cd utils/arch-pkgs/mingw-w64-shaderc && makepkg -si)
yay -Sy mingw-w64-gcc mingw-w64-cmake mingw-w64-make mingw-w64-dlfcn x86_64-w64-mingw32-ldd
yay -Sy mingw-w64-mpv # Be sure to install it after building shaderc from source
yay -Sy mingw-w64-qt6-* # You may specify the packages
rustup target add x86_64-pc-windows-gnu
MAKE=x86_64-w64-mingw32-make CMAKE=x86_64-w64-mingw32-cmake CXX=x86_64-w64-mingw32-g++ cargo build --target x86_64-pc-windows-gnu
To run on linux, don't forget to tell wine where to find all the dlls for Qt/mpv, from the build folder run either commands:
# With wine
WINEPATH=/usr/x86_64-w64-mingw32/bin lektord.exe
# Copy DLL files
for F in $(WINEPATH=/usr/x86_64-w64-mingw32/bin x86_64-w64-mingw32-ldd lektor_c.dll | grep -v "not found" | awk '{print $3}'); do cp "$F" .; done
./lektord.exe
Be sure to have the multilib repos and install the bootstrap
minwg-w64-*-bootstrap
packages first, to avoid the circular dependencies... And be sure to have a lot of time to waste.
TODO List
- Finish Amadeus.
- Finish popups.
- Query state from lektord in a sensible way.
- The windows build.
- Implements a kurisu server in lektord to be able to synchronize with other lektord instances.
- Make two custom themes (one light, the other dark) for amadeus, not the default ones from iced.