Skip to content
Extraits de code Groupes Projets
Vérifiée Valider f8e13481 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

Script to get lektor information on current song modified and the

database scheme for the view on kara also
parent 0abf1b47
Branches
Étiquettes
1 requête de fusion!25Search functions
...@@ -111,7 +111,7 @@ INSERT INTO misc (id) VALUES (42); ...@@ -111,7 +111,7 @@ INSERT INTO misc (id) VALUES (42);
CREATE VIEW IF NOT EXISTS view_kara AS CREATE VIEW IF NOT EXISTS view_kara AS
SELECT SELECT
id, id,
(category || '/' || source_name || ' - ' || song_type || ' - ' || song_name) AS string, (song_type || '/' || source_name || ' - ' || category || song_number || ' - ' || song_name) AS string,
file_path file_path
FROM kara FROM kara
; ;
...@@ -5,7 +5,8 @@ alias _set_if 'if ( \!:1 == $last ) set \!:2 = "$line"' ...@@ -5,7 +5,8 @@ alias _set_if 'if ( \!:1 == $last ) set \!:2 = "$line"'
## Get the status of lektor ## Get the status of lektor
set last = "" set last = ""
set reply = ` printf "status\nclose\n" | nc localhost 6600 ` set host = ` cat ~/.local/etc/lektor_host `
set reply = ` printf "status\nclose\n" | nc $host 6600 `
if ( $? != 0 ) exit 0 if ( $? != 0 ) exit 0
...@@ -15,11 +16,11 @@ foreach line ( $reply ) ...@@ -15,11 +16,11 @@ foreach line ( $reply )
set last = $line set last = $line
end end
if ( $state == "stopped" || $last != "OK" ) exit 1 if ( $state == "stop" || $last != "OK" ) exit 0
## Get the current song, let's do some magic ## Get the current song, let's do some magic
set last = "" set last = ""
set reply = ` printf "currentsong\nclose\n" | nc localhost 6600 | sed -e 's/ / /g' ` set reply = ` printf "currentsong\nclose\n" | nc $host 6600 | sed -e 's/ / /g' `
if ( $? != 0 ) exit 0 if ( $? != 0 ) exit 0
...@@ -36,5 +37,10 @@ foreach line ( $reply ) ...@@ -36,5 +37,10 @@ foreach line ( $reply )
end end
if ( $last != "OK" ) exit 0 if ( $last != "OK" ) exit 0
if ( $host == "localhost" || $host == "127.0.0.1" || $host == "127.0.1.1" ) then
set host = ""
else
set host = "($host)"
endif
echo "$category / $source - $type - $title [ $author ]" echo "$category / $source - $type - $title [ $author ] $host"
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter