Skip to content
Extraits de code Groupes Projets
Avatar de Kubat
Kubat rédigé
Process queue

Closes #55

See merge request !95
10cad9da
Historique

lektor mk7

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 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 and sdl2, you will need the folowing prerequisites:

  • the mpv development library
  • the sdl2 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:

  • mkvpropedit from mkvtoolnix
  • the bourn shell again: bash
  • the command line tool xxd, is distributed in the vim and gvim packages on archlinux, seems to be distributed in its own package on debian: xxd

The manual way of installing and setting up lektor:

sudo mkdir /home/kara && sudo chown USER:USER /home/kara
meson build
ninja -C build && sudo ninja -C build install
sudo chown USER:USER /home/kara/kara.db

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.

On archlinux, you need only to install the package:

makepkg -si

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. For that, karas must be placed in a folder hierarchy like the following:

/some/directory/$CAT/$LANG/$AUTH/$SOURCE - $TYPE$NUM - $TITLE.mkv

The ideal way of populating lektor is using Kurisu. The update and rescan commands are here for that.

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

The x11 module may have some issues with optirun and primusrun.

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. To see what are the settings used by lektor, you can also use the lktadm command.

Be aware that if the home directory or the XDG_CONFIG_HOME are too long they will be ignored.

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}, this a convention but it can be anything as long as it don't make collision with sections used by lektor (may be fine, but don't to this!).

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 by the load_function property. The path to the .so file is determined by the path property.

MPD

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