diff --git a/database/init.sql b/init.sql similarity index 100% rename from database/init.sql rename to init.sql diff --git a/scripts/install.sh b/scripts/install.sh deleted file mode 100755 index 41a77e02a5945dfc0a41bd34f3ad93eb6a2d30a3..0000000000000000000000000000000000000000 --- a/scripts/install.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/sh - -# Variables -SYSD_DIR="$HOME/.config/systemd/user" -SYSD_FILE="$SYSD_DIR/lektor.service" - -SERV_DIR="$HOME/.local/lib/lektor" -SERV_EXE="$SERV_DIR/lektord" -SERV_LIB="$SERV_DIR/liblektor.so" - -KARA_DIR="/home/kara" -KARA_DB="$KARA_DIR/kara.db" -TEMP_DB="" - -# Are the needed executables here? -if ! [ $(type -P "meson") ] || ! [ $(type -P "ninja") ] -then - echo "This script needs 'meson' and 'ninja' as build tools" - exit -2 -fi - -# Are we in the right directory? -if test "$0" != "./scripts/install.sh" || ! test -f meson.build -then - echo "This scripts needs to be executed from the root of the project" - echo "$0" - exit -1 -fi - -# Build the project -! [ -d build ] && mkdir build -meson build -ninja -C build || exit 1 - -# Write the service file -if [ -f $SYSD_FILE ] -then - echo "A service file is already here, skip this step" -else - cat > $SYSD_FILE << EOF -[Unit] -Description=Lektor kara player - -[Service] -ExecStart=$SERV_EXE - -[Install] -WantedBy=default.target -EOF - if test $? -ne 0 - then - echo "Failed to write the service file" - exit 2 - fi -fi - -# Copy the build exe -mkdir -p $SERV_DIR || (echo "Failed to create the lib directory for lektor" && exit 3) -cp build/lektord $SERV_EXE || (echo "Failed to copy the executable in the right directory" && exit 4) -cp build/liblektor.so $SERV_LIB || (echo "Failed to copy the executable in the right directory" && exit 7) - -# Install the database -if ! [ -d "$KARA_DIR" ] || ! [ -r "$KARA_DIR" ] || ! [ -w "$KARA_DIR" ] -then - echo "You need to create manually the '$KARA_DIR' directory and give write access to the current user" - exit 5 -fi - -if [ -f "$KARA_DB" ] -then - echo "A database already exists, skip this step" -else - TEMP_DB=$(mktemp) - sqlite3 $TEMP_DB < database/init.sql - if ! [ $? ] - then - echo "Failed to initiate the database" - rm $TEMP_DB - exit 6 - else - mv $TEMP_DB $KARA_DB - fi -fi - -# Init the system -exec $SERV_EXE --init diff --git a/scripts/lektor_info.csh b/scripts/lektor_info.csh deleted file mode 100755 index ac0e4f3b75233ac26bcae06d4509fd54294be04c..0000000000000000000000000000000000000000 --- a/scripts/lektor_info.csh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/csh -f - -# Get info more easely from the putput of lektor -alias _set_if 'if ( \!:1 == "$last" ) set \!:2 = "$line"' - -## Get the status of lektor -set last = "" -set host = ` cat ~/.local/etc/lektor_host ` -set reply = ` printf "status\nclose\n" | nc $host 6600 ` - -if ( $? != 0 ) goto _exit - -foreach line ( $reply ) - _set_if "volume:" volume - _set_if "state:" state - set last = $line -end - -if ( $state == "stop" || $last != "OK" ) goto _exit - -## Get the current song, let's do some magic -set last = "" -set reply = ` printf "currentsong\nclose\n" | nc $host 6600 | sed -e 's/ / /g' ` - -if ( $? != 0 ) goto _exit - -foreach line ( $reply ) - set last = ` echo $line | sed 's/ .*//' ` - set line = ` echo $line | sed 's/[^ ]*: //' ` - - _set_if "Title:" title - _set_if "Author:" author - _set_if "Source:" source - _set_if "Type:" type - _set_if "Category:" category - _set_if "Language:" lang -end - -if ( $last != "OK" ) goto _exit -if ( $host == "localhost" || $host == "127.0.0.1" || $host == "127.0.1.1" ) then - set host = "" -else - set host = "($host)" -endif - -if ( $?lang ) then - echo "$category - $lang / $source - $type - $title [ $author ] $host" -else - echo "$category / $source - $type - $title [ $author ] $host" -endif -exit 0 - -_exit: -echo "" -exit 0