From 02696960b0c2511468b64d5bdf9a909d8e0e888e Mon Sep 17 00:00:00 2001 From: bkfox Date: Sun, 31 May 2020 20:35:50 +0200 Subject: [PATCH] status_verbose --- aircox_streamer/controllers.py | 4 ++ .../locale/fr/LC_MESSAGES/django.po | 54 +++++++++++-------- aircox_streamer/serializers.py | 4 ++ .../aircox_streamer/source_item.html | 2 +- 4 files changed, 42 insertions(+), 22 deletions(-) diff --git a/aircox_streamer/controllers.py b/aircox_streamer/controllers.py index a966fe0..e99873c 100755 --- a/aircox_streamer/controllers.py +++ b/aircox_streamer/controllers.py @@ -59,6 +59,10 @@ class BaseMetadata: def is_playing(self): return self.status == 'playing' + @property + def status_verbose(self): + return self.validate_status(self.status, True) + def fetch(self): data = self.controller.send('request.metadata ', self.rid, parse=True) if data: diff --git a/aircox_streamer/locale/fr/LC_MESSAGES/django.po b/aircox_streamer/locale/fr/LC_MESSAGES/django.po index 29f1fb2..711e40e 100644 --- a/aircox_streamer/locale/fr/LC_MESSAGES/django.po +++ b/aircox_streamer/locale/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-05-30 13:53+0000\n" +"POT-Creation-Date: 2020-05-31 18:34+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,79 +18,91 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: aircox_streamer/templates/aircox_streamer/source_item.html:18 +#: controllers.py:75 +msgid "playing" +msgstr "en cours de lecture" + +#: controllers.py:77 +msgid "paused" +msgstr "pause" + +#: controllers.py:79 +msgid "stopped" +msgstr "arrêt" + +#: templates/aircox_streamer/source_item.html:18 msgid "Edit related program" msgstr "Éditer le programme correspondant" -#: aircox_streamer/templates/aircox_streamer/source_item.html:27 +#: templates/aircox_streamer/source_item.html:27 msgid "Synchronize source with Liquidsoap" msgstr "Synchroniser la source avec Liquidsoap" -#: aircox_streamer/templates/aircox_streamer/source_item.html:31 +#: templates/aircox_streamer/source_item.html:31 msgid "Synchronise" msgstr "Synchroniser" -#: aircox_streamer/templates/aircox_streamer/source_item.html:34 +#: templates/aircox_streamer/source_item.html:34 msgid "Restart current track" msgstr "Rejouer le morceau en cours" -#: aircox_streamer/templates/aircox_streamer/source_item.html:38 +#: templates/aircox_streamer/source_item.html:38 msgid "Restart" msgstr "Rejouer" -#: aircox_streamer/templates/aircox_streamer/source_item.html:41 +#: templates/aircox_streamer/source_item.html:41 msgid "Skip current file" msgstr "Passer le fichier actuel" -#: aircox_streamer/templates/aircox_streamer/source_item.html:42 +#: templates/aircox_streamer/source_item.html:42 msgid "Skip" msgstr "Passer" -#: aircox_streamer/templates/aircox_streamer/source_item.html:51 +#: templates/aircox_streamer/source_item.html:51 msgid "Add sound" msgstr "Ajouter un son" -#: aircox_streamer/templates/aircox_streamer/source_item.html:59 +#: templates/aircox_streamer/source_item.html:59 msgid "Select a sound" msgstr "Sélectionner un son" -#: aircox_streamer/templates/aircox_streamer/source_item.html:61 +#: templates/aircox_streamer/source_item.html:61 msgid "Add a sound to the queue (queue may start playing)" msgstr "Ajouter un son à la file de lecture (la file de lecture peut démarer)" -#: aircox_streamer/templates/aircox_streamer/source_item.html:70 +#: templates/aircox_streamer/source_item.html:70 msgid "Add" msgstr "Ajouter" -#: aircox_streamer/templates/aircox_streamer/source_item.html:76 +#: templates/aircox_streamer/source_item.html:76 msgid "Sounds in queue" msgstr "Sons dans la file de lecture" -#: aircox_streamer/templates/aircox_streamer/source_item.html:94 +#: templates/aircox_streamer/source_item.html:94 msgid "Status" msgstr "Statut" -#: aircox_streamer/templates/aircox_streamer/source_item.html:104 +#: templates/aircox_streamer/source_item.html:104 msgid "Air time" msgstr "En antenne depuis" -#: aircox_streamer/templates/aircox_streamer/source_item.html:114 +#: templates/aircox_streamer/source_item.html:114 msgid "Time left" msgstr "Temps restant" -#: aircox_streamer/templates/aircox_streamer/source_item.html:122 +#: templates/aircox_streamer/source_item.html:122 msgid "Data source" msgstr "Source de donnée" -#: aircox_streamer/templates/aircox_streamer/streamer.html:19 +#: templates/aircox_streamer/streamer.html:19 msgid "Reload" msgstr "Recharger" -#: aircox_streamer/templates/aircox_streamer/streamer.html:26 -#: aircox_streamer/templates/aircox_streamer/streamer.html:27 +#: templates/aircox_streamer/streamer.html:26 +#: templates/aircox_streamer/streamer.html:27 msgid "Select a station" msgstr "Sélectionner une station" -#: aircox_streamer/urls.py:9 aircox_streamer/views.py:9 +#: urls.py:9 views.py:9 msgid "Streamer Monitor" msgstr "Moniteur de stream" diff --git a/aircox_streamer/serializers.py b/aircox_streamer/serializers.py index f187f8f..7157413 100644 --- a/aircox_streamer/serializers.py +++ b/aircox_streamer/serializers.py @@ -38,12 +38,16 @@ class SourceSerializer(BaseMetadataSerializer): rid = serializers.IntegerField() air_time = serializers.DateTimeField() status = serializers.CharField() + status_verbose = serializers.CharField() remaining = serializers.FloatField() def get_url(self, obj, **kwargs): kwargs['station_pk'] = obj.station.pk return super().get_url(obj, **kwargs) + def get_status_verbose(self, obj, **kwargs): + return obj.status_verbose + class PlaylistSerializer(SourceSerializer): program = serializers.CharField(source='program.id') diff --git a/aircox_streamer/templates/aircox_streamer/source_item.html b/aircox_streamer/templates/aircox_streamer/source_item.html index d93a669..b015a76 100644 --- a/aircox_streamer/templates/aircox_streamer/source_item.html +++ b/aircox_streamer/templates/aircox_streamer/source_item.html @@ -95,7 +95,7 @@ - [[ source.data.status || "—" ]] + [[ source.data.status_verbose || "—" ]]