Skip to content
Extraits de code Groupes Projets
Avatar de Kubat
Kubat rédigé
fd0b546e
Historique
Nom Dernière validation Dernière mise à jour
doc
inc
scripts
src
.gitignore
CONTRIBUTING.md
LICENSE
README.md
init.sql
meson.build

lektor mk 7

A Karaoke player made to replace the old bash scripts on Sakura. They will enable one to have a database and make requests over the network.

Building the player

Prerequisites:

  • meson
  • a C compiler with C18 support (e.g. gcc>8.1, clang>7.0)
  • the libpcre development library
  • the sqlite3 development library, version 3.31.0 or newer for generated columns support
  • the json-c development library
  • a POSIX.1-2008 compatible system (i.e. not MS Windows)

For the module x11, you will need the folowing prerequisites:

  • the mpv development library
  • you will need x11 for the default window module

You will also need the following executables, with their path setted in the configuration file:

The manual way of installing and setting up lektor:

meson build
ninja -C build
./build/lktadm --init                   # Modify mkv, if the metadata ar already set do not do this.
# Create and modify the ini file manually, must be at ~/.config/lektor/config at the moment.
sqlite3 /home/kara/kara.db < init.sql   # Create the database.
./build/lktadm --populate-all           # Populate the sqlite database.

You may need to put the lib_window_x11.so in the right directory to have the lektor player actually playing something (see the ini file). This path can be setted manually in the INI file.

Preparing a kara for lektor

A karamaker needs at least python3, with mkvpropedit (often installed with the mkvtoolnix-gui package in distributions). The sqlite3 program is also needed. The path to these programs must be setted in the lektor.ini config file.

As a karamaker, you need to add necessary information to your kara so that lektor can store it in its database. This information is to be directly written in the .mkv file.

For that purpose, run the karadata from the command-line, with your kara as an argument, like:

./lktadm --file /path/to/my/kara.mkv

or

./lktadm --prompt-file /path/to/my/kara.mkv

A karamaker may use the scripts/karafont.py to set the right MIME type for fonts (stored as attachments in the mkv).

How to launch lektor

To run lektor, you can simply run the binary like: ./lektord.

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:

optirun ./lektord

How to use lektor

Lektor is compatible with mpd, which means that you can use any client (only mpc is tested) to interact with lektor. Some functions are not really compatible (somme work to be done) because mpc really makes some assumptions.

The ideal way is to use lkt.

How to configure lektor

Lektor configuration is done with an INI file. Modules' configuration is also done by the same INI file using diferent sections.

Lektor searches for the configuration file in that order:

  • $(pwd)/lektor.ini
  • if XDG_CONFIG_HOME defined then $XDG_CONFIG_HOME/lektor/lektor.ini else $HOME/.config/lektor/lektor.ini
  • /opt/lektor/lektor.ini
  • /usr/local/etc/lektor.ini
  • /etc/lektor.ini

The first one to be found is picked up by lektor. Note that if the environment variable XDG_CONFIG_HOME is not defined, it is replaced by HOME/.config.

To get the default config file, you can use the lktadm command.

Modules

Modules are .so files (i.e. dynamic libraries) loaded by lektors using a function named module_set_function which takes a void * and a struct lkt_option * in argument and must return an int (may return an uint16_t in the future). This function must initialize correctly the module. The name of this function can be defined in the INI file.

Module can be configured with the ini configuration file in a section named module_${name}.

Like in the player, modules are loaded into slots and must be refered by their section name. The function used to load the .so file will be determied depending on the context in which the module is configured and will pass the option corresponding on the section's name.

MPD

Lektor is almost MPD compatible, at least it uses the same protocol, which can be got here.