diff --git a/app.py b/app.py index 8de7c7e..eec0b61 100755 --- a/app.py +++ b/app.py @@ -23,7 +23,26 @@ from waitress import serve # l10n LOCALE = os.getenv('LANG', 'en') _ = gettext.translation('template', localedir='locales', languages=[LOCALE]).gettext - + +gui_l10n = { "str_pilpil_title" : _("Pilpil-server"), + "str_filename" : _("Media Files"), + "str_scan" : _("Scan"), + "str_previous" : _("Previous"), + "str_play" : _("Play"), + "str_pause" : _("Pause"), + "str_stop" : _("Stop"), + "str_next" : _("Next"), + "str_loop" : _("Loop"), + "str_repeat" : _("Repeat"), + "str_clear" : _("Clear"), + "str_sort" : _("Sort"), + "str_sync" : _("Sync"), + "str_poweroff" : _("Poweroff"), + "str_reboot" : _("Reboot"), + "str_blink" : _("Blink"), + "str_link" : _("Link"), +} + app = Flask(__name__) app.config.from_file("defaults.toml", load=toml.load) @@ -302,7 +321,6 @@ def get_meta_data(host, xml_data, request_="status", m3u_=0): media_infos = {host : host_medias} if debug: print(media_infos) - return media_infos def get_playlist(host, xml_data, m3u=0): @@ -453,7 +471,8 @@ def main(): templateData = { 'hosts' : hosts, 'status_message' : status_message, - 'queue_msgs' : queue_msgs + 'queue_msgs' : queue_msgs, + 'gui_l10n' : gui_l10n } return render_template('main.html', **templateData) diff --git a/locales/en/LC_MESSAGES/template.pot b/locales/en/LC_MESSAGES/template.pot index 7df0eee..2e57c1e 100644 --- a/locales/en/LC_MESSAGES/template.pot +++ b/locales/en/LC_MESSAGES/template.pot @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2022-11-01 19:56+0100\n" +"POT-Creation-Date: 2022-11-15 16:34+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -14,53 +14,112 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: pygettext.py 1.5\n" -#: app.py:19 -msgid "No file" + +#: ../app.py:27 +msgid "Pilpil-server" msgstr "" -#: app.py:20 -msgid "No files queued." +#: ../app.py:28 +msgid "Media Files" msgstr "" -#: app.py:22 +#: ../app.py:29 +msgid "Scan" +msgstr "" + +#: ../app.py:30 +msgid "Previous" +msgstr "" + +#: ../app.py:31 +msgid "Play" +msgstr "" + +#: ../app.py:32 +msgid "Pause" +msgstr "" + +#: ../app.py:33 +msgid "Stop" +msgstr "" + +#: ../app.py:34 +msgid "Next" +msgstr "" + +#: ../app.py:35 +msgid "Loop" +msgstr "" + +#: ../app.py:36 +msgid "Repeat" +msgstr "" + +#: ../app.py:37 +msgid "Clear" +msgstr "" + +#: ../app.py:38 +msgid "Sort" +msgstr "" + +#: ../app.py:39 +msgid "Sync" +msgstr "" + +#: ../app.py:40 +msgid "Poweroff" +msgstr "" + +#: ../app.py:41 +msgid "Reboot" +msgstr "" + +#: ../app.py:42 +msgid "Blink" +msgstr "" + +#: ../app.py:43 +msgid "Link" +msgstr "" + +#: ../app.py:52 msgid "Found configuration file in {}" msgstr "" -#: app.py:105 -msgid "Port {} reachable" +#: ../app.py:56 +msgid "No items" msgstr "" -#: app.py:109 +#: ../app.py:57 +msgid "No files queued." +msgstr "" + +#: ../app.py:168 +msgid "{} reachable on {}" +msgstr "" + +#: ../app.py:173 msgid "Error on connection to {} : {} : {} " msgstr "" -#: app.py:123 +#: ../app.py:190 msgid "{} of {} hosts found." msgstr "" -#: app.py:169 -msgid "{} files uploaded." +#: ../app.py:330 +msgid "Playlist" msgstr "" -#: app.py:252 app.py:253 -msgid "Connection to {} timed out" -msgstr "" - -#: app.py:255 -msgid "Error while connecting to {}:{}" -msgstr "" - -#: app.py:331 +#: ../app.py:465 msgid "Idle" msgstr "" -#: app.py:336 +#: ../app.py:469 msgid "Searching network for live hosts..." msgstr "" -#: app.py:373 +#: ../app.py:510 msgid "Wrong command" msgstr "" - - diff --git a/locales/fr/LC_MESSAGES/template.mo b/locales/fr/LC_MESSAGES/template.mo index ca9e8b2..f1562a2 100644 Binary files a/locales/fr/LC_MESSAGES/template.mo and b/locales/fr/LC_MESSAGES/template.mo differ diff --git a/locales/fr/LC_MESSAGES/template.pot b/locales/fr/LC_MESSAGES/template.pot index de815ad..81dd1de 100644 --- a/locales/fr/LC_MESSAGES/template.pot +++ b/locales/fr/LC_MESSAGES/template.pot @@ -22,6 +22,74 @@ msgstr "Aucun fichier." msgid "No files queued." msgstr "Aucun fichier en attente." +#: ../app.py:27 +msgid "Pilpil-server" +msgstr "Pilpil-server" + +#: ../app.py:28 +msgid "Media Files" +msgstr "Médias" + +#: ../app.py:29 +msgid "Scan" +msgstr "Scan réseau" + +#: ../app.py:30 +msgid "Previous" +msgstr "Précédent" + +#: ../app.py:31 +msgid "Play" +msgstr "Lecture" + +#: ../app.py:32 +msgid "Pause" +msgstr "Pause" + +#: ../app.py:33 +msgid "Stop" +msgstr "Stop" + +#: ../app.py:34 +msgid "Next" +msgstr "Suivant" + +#: ../app.py:35 +msgid "Loop" +msgstr "Boucler" + +#: ../app.py:36 +msgid "Repeat" +msgstr "Répéter" + +#: ../app.py:37 +msgid "Clear" +msgstr "Vider" + +#: ../app.py:38 +msgid "Sort" +msgstr "Trier" + +#: ../app.py:39 +msgid "Sync" +msgstr "Synchroniser" + +#: ../app.py:40 +msgid "Poweroff" +msgstr "Éteindre" + +#: ../app.py:41 +msgid "Reboot" +msgstr "Redémarrer" + +#: ../app.py:42 +msgid "Blink" +msgstr "Clignoter" + +#: ../app.py:43 +msgid "Link" +msgstr "Lien" + #: app.py:22 msgid "Found configuration file in {}" msgstr "Fichier de configuration trouvé dans {}" diff --git a/locales/gen_mo.sh b/locales/gen_mo.sh index b20995d..0d2c1c0 100755 --- a/locales/gen_mo.sh +++ b/locales/gen_mo.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +# pygettext -o template.pot ../app.py # +# Change to script dir +cd "$(dirname "$0")" for locale in */LC_MESSAGES/template.pot; do /usr/bin/msgfmt -o ${locale%.*}.mo $locale done diff --git a/locales/messages.pot b/locales/messages.pot deleted file mode 100644 index c1a34dd..0000000 --- a/locales/messages.pot +++ /dev/null @@ -1,17 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR ORGANIZATION -# FIRST AUTHOR , YEAR. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2022-11-02 18:58+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: pygettext.py 1.5\n" - - diff --git a/locales/template.pot b/locales/template.pot deleted file mode 100644 index c3434b2..0000000 --- a/locales/template.pot +++ /dev/null @@ -1,57 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR ORGANIZATION -# FIRST AUTHOR , YEAR. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2022-11-01 19:56+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: pygettext.py 1.5\n" - - -#: app.py:22 -msgid "Found configuration file in {}" -msgstr "" - -#: app.py:105 -msgid "Port {} reachable" -msgstr "" - -#: app.py:109 -msgid "Error on connection to {} : {} : {} " -msgstr "" - -#: app.py:123 -msgid "{} of {} hosts found." -msgstr "" - -#: app.py:169 -msgid "{} files uploaded." -msgstr "" - -#: app.py:252 app.py:253 -msgid "Connection to {} timed out" -msgstr "" - -#: app.py:255 -msgid "Error while connecting to {}:{}" -msgstr "" - -#: app.py:331 -msgid "Idle" -msgstr "" - -#: app.py:336 -msgid "Searching network for live hosts..." -msgstr "" - -#: app.py:373 -msgid "Wrong command" -msgstr "" - diff --git a/static/script.js b/static/script.js index 72f7431..1cbdd04 100644 --- a/static/script.js +++ b/static/script.js @@ -113,10 +113,10 @@ function addElement(type, attr, meta = 0, j = 0){ // Bouttons de commande addEventListener("DOMContentLoaded", function() { sendCmd("/scan"); - sendCmd("/browse_local"); - sendCmd("/all/rssi"); sendCmd("/all/list"); - sendCmd("/all/browse"); + sendCmd("/browse_local"); + setTimeout(sendCmd, 3000, "/all/browse"); + setTimeout(sendCmd, 4000, "/all/rssi"); adjustTl(); // Get filename when selected in table @@ -191,6 +191,8 @@ function parseResult(command, infos_array) { if (infos_array[i].status) { document.getElementById("status_"+infos_array[i].host).innerHTML = infos_array[i].file + "
" + infos_array[i].time + " / " + infos_array[i].leng; medias_status[infos_array[i].id] = infos_array[i].pos; + } else { + document.getElementById("status_"+infos_array[i].host).innerHTML = "

"; } if (infos_array[i].loop == "true") { document.getElementById("loop_ind_" + infos_array[i].host).style.backgroundColor = "#78E738" diff --git a/static/style.css b/static/style.css index 3ac6f70..645e6d6 100644 --- a/static/style.css +++ b/static/style.css @@ -133,6 +133,12 @@ tr:nth-child(2n+1) {background-color: #888;} width: 100%; margin: 0; } +.file_selection { + cursor: pointer; +} +.file_selection:hover { + background-color: rgb(255, 136, 57); +} .wl_indicator { display: inline-block; background-color: #bbb; diff --git a/templates/main.html b/templates/main.html index 401e284..28862fb 100644 --- a/templates/main.html +++ b/templates/main.html @@ -13,54 +13,51 @@
-

Pilpil-server

+

{{gui_l10n['str_pilpil_title']}}

{{status_message}}

{{queue_msgs[0]}}

- - - - - - - - - - - - - - + + + + + + + + + + +

{% for host in hosts %}
-

{{ host }}

+

{{host}}

- - - -

{{status_message}}

-

- Link: + + + +

{{status_message}}

+

+ {{gui_l10n['str_link']}}:

-

Loop

-

Repeat

+

{{gui_l10n['str_loop']}}

+

{{gui_l10n['str_repeat']}}

-
{{queue_msgs[1]}} -
- +
+
+
- +
Filename{{gui_l10n['str_filename']}}
@@ -74,15 +71,15 @@ -->
- - - - - - - - - + + + + + + + + +