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
- C++ compiler with C++20 support
- mpv development library
- Qt6 development library: QtCore, QtWidgets, QtOpenGL, QtOpenGLWidgets.
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 a lektord distribution for windows (Cross Compilation)
Windows 64 bit binaries are built from a linux system. Here we will assume you are using an arch
linux system because it's what I'm using. 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, you may doo the bootstrap thingy here
rustup target add x86_64-pc-windows-gnu # Add the windows target, here we build 64bit applications
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 produce the zip file for windows users, from the target folder run the following commands:
mkdir -p lektor/platforms && cd lektor # Prepare folders
cp ../{lkt,amadeus,lektord}.exe . # Copy the produced executables
cp ../lektor_c.dll . # Copy the dll for lektord
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" . # Copy DLL files
done
chmod +x *.dll *.dll.* # Set DLL executable for linux, just in case
cp /usr/x86_64-w64-mingw32/lib/qt6/plugins/platforms/qwindows.dll platforms/ # Copy the windows platform dll for Qt
cp /usr/x86_64-w64-mingw32/lib/qt6/plugins/styles/qwindowsvistastyle.dll styles/ # Copy the style dll
(cd .. && zip lektor.zip lektor/* lektor/platforms/*) # Create the zip file
# Now you can run lektord and distribute the zip file!
./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.
Building a lektord distribution for linux (AppImage)
Note that it is preferable to build AppImages from the older system that you want to support, see the official website.
Build on host system (ArchLinux)
First you need the LinuxDeploy and AppImageTool binaries. We will assume you are using an x86_64 system. You can download it their repositories:
- https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous
- https://github.com/AppImage/AppImageKit/releases/tag/continuous
As an alternative you can use the following commands and add the $HOME/.local/bin
folder to you path.
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-static-x86_64.AppImage
mv appimagetool-x86_64.AppImage ~/.local/bin/appimagetool
mv linuxdeploy-static-x86_64.AppImage ~/.local/bin/linuxdeploy
chmod +x ~/.local/bin/appimagetool
chmod +x ~/.local/bin/linuxdeploy
For the packages needed to build the lektor project, 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
After building the lektord executable and .so files, you can use the following commands from the
target folder (where the executable where generated). We will reference the root folder of the
lektord repository as $ROOT
.
mkdir Amadeus Lektord Lkt # Create one folder for each AppImage
# Do the thing for Lkt
linuxdeploy --appdir Lkt --executable lkt --icon-file $ROOT/utils/desktop/lektor.png --desktop-file $ROOT/utils/desktop/lkt.desktop
appimagetool --comp xz --sign --sign-key $YOUR_SIGN_KEY Lkt
# Do the thing for Lektord
linuxdeploy --appdir Lektord --executable lektord --icon-file $ROOT/utils/desktop/lektor.png --desktop-file $ROOT/utils/desktop/lektord.desktop
appimagetool --comp xz --sign --sign-key $YOUR_SIGN_KEY Lektord
# Do the thing for Amadeus
linuxdeploy --appdir Amadeus --executable lektord --icon-file $ROOT/utils/desktop/amadeus.png --desktop-file $ROOT/utils/desktop/amadeus.desktop
appimagetool --comp xz --sign --sign-key $YOUR_SIGN_KEY Amadeus
Build in a container (Docker/Podman)
As an alternative you can run the docker which will use debian 12 (bookworm) to try to build an AppImage which is compatible with as many systems as possible, note that with Qt6 we won't be able to support systems that are too old.
You can use docker (must be configured) or podman, with podman you don't need a root daemon and
privileges, it will run as your current user. In the latter case your container registry config file
/etc/containers/registries.conf
must contains the following content:
[registries.search]
registries = ['docker.io']
When everything is configured you can run the following commands, using either docker or podman:
# Be sure that we have the target folder where the AppImages will be copied
mkdir -p appimage
# Run Podman/Docker, "lbc" stands for Lektor Build Container
podman build --rm -v "$PWD/appimage":/usr/src/lektor/target/appimage -t lbc .
# To clean up all the things left behind
podman system reset
TODO List
- Finish Amadeus.
- Query state from lektord in a sensible way.
- Implements a kurisu server in lektord to be able to synchronize with other lektord instances.