Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier committed Dec 18, 2019
2 parents e8ef483 + b234e78 commit bc6a15b
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 38 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Ce système est conçu pour deux cartes :
- Une carte réalisée pour Maker Faire 2018, qui ne fonctionne qu'avec les Nabaztag v1 (sans micro ni RFID).
- Une nouvelle version de la carte, proposée via la campagne Ulule en mai 2019, qui fonctionne avec les Nabaztag v1 et v2 (les micros sont sur la carte, du coup les Nabaztag v1 bénéficient aussi de la reconnaissance vocale).

Les schémas et fichiers de fabrication de ces deux cartes sont dans le repository [hardware](https://github.com/nabaztag2018/hardware), respectivement [`RPI_Nabaztag`](https://github.com/nabaztag2018/hardware/blob/master/RPI_Nabaztag.PDF) (2018) et [`pyNab_v4.1`](https://github.com/nabaztag2018/hardware/blob/master/pyNab_V4.1_voice_reco.PDF) (2019).
Les schémas et fichiers de fabrication de ces deux cartes sont dans le repository [hardware](https://github.com/nabaztag2018/hardware), respectivement [`RPI_Nabaztag`](https://github.com/nabaztag2018/hardware/blob/master/RPI_Nabaztag.PDF) (2018) et [`tagtagtag_V2.0`](https://github.com/nabaztag2018/hardware/tree/master/tagtagtag_V2.0) (2019).

# Images

Les [releases](https://github.com/nabaztag2018/pynab/releases) sont des images de Raspbian Buster Lite 2019-09-26 avec pynab pré-installé. Elles ont les mêmes réglages que [Raspbian](https://www.raspberrypi.org/downloads/raspbian/).

La release actuelle (0.4.0) ne fonctionne que sur les cartes 2019.
La release actuelle (0.6.x) ne fonctionne que sur les cartes 2019 (cf #44)

# Installation sur Raspbian (pour développeurs !)

Expand Down Expand Up @@ -43,7 +43,7 @@ https://github.com/pguyot/tagtagtag-ears
2. Installer PostgreSQL et les paquets requis

```
sudo apt-get install postgresql libpq-dev git python3 python3-venv python3-dev gettext nginx openssl libssl-dev libffi-dev libmpg123-dev libasound2-dev libatlas-base-dev libgfortran3
sudo apt-get install postgresql libpq-dev git python3 python3-venv python3-dev gettext nginx openssl libssl-dev libffi-dev libmpg123-dev libasound2-dev libatlas-base-dev libgfortran3 libopenblas-dev liblapack-dev gfortran
```

3. Récupérer le code
Expand Down Expand Up @@ -74,12 +74,17 @@ cd pynab
bash upgrade.sh
```

# Nabblockly

[Nabblockly](https://github.com/pguyot/nabblockly), une interface de programmation des chorégraphies du lapin par blocs, nécessite une installation supplémentaire, et quelques connaissances en configuration Nginx. De base, il est conçu pour la salle de classe et remplace le site web de configuration du Nabaztag.

# Architecture

Cf le document [PROTOCOL.md](PROTOCOL.md)

- nabd : daemon qui gère le lapin (i/o, chorégraphies)
- nab8balld : daemon pour le service gourou
- nabairqualityd : daemon pour le service de qualité de l'air
- nabclockd : daemon pour le service horloge
- nabsurprised : daemon pour le service surprises
- nabtaichid : daemon pour le service taichi
Expand Down
19 changes: 8 additions & 11 deletions nabmastodond/locale/fr_FR/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-17 10:10+0100\n"
"POT-Creation-Date: 2019-12-17 14:57+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -36,8 +36,8 @@ msgid "Kindred soul"
msgstr "Âme sœur"

#: templates/nabmastodond/settings.html:25
msgid "friend@botsin.space"
msgstr ""
msgid "friend@mstdn.fr"
msgstr "ami(e)@mstdn.fr"

#: templates/nabmastodond/settings.html:25
msgid "Friend address"
Expand Down Expand Up @@ -175,11 +175,11 @@ msgid ""
"(Mastodon is a sort of decentralized Twitter - and Open Source). Currently "
"your Nabaztag is not connected to Mastodon."
msgstr ""
"Comme on a décidé que Nabaztag n'habiterait plus jamais dans le cloud mais que nous aimons bien la "
"communion d'oreilles (notamment), nous utilisons <a href='https://"
"fr.wikipedia.org/wiki/Mastodon_(r%C3%A9seau_social)'>Mastodon</a> pour connecter les lapins entre eux. "
"<b>En ce moment, votre Nabaztag n'est pas connecté à Mastodon</b>."

"Comme on a décidé que Nabaztag n'habiterait plus jamais dans le cloud mais "
"que nous aimons bien la communion d'oreilles (notamment), nous utilisons <a "
"href='https://fr.wikipedia.org/wiki/Mastodon_(r%C3%A9seau_social)'>Mastodon</"
"a> pour connecter les lapins entre eux. <b>En ce moment, votre Nabaztag "
"n'est pas connecté à Mastodon</b>."

#: templates/nabmastodond/settings.html:259
msgid ""
Expand Down Expand Up @@ -231,8 +231,5 @@ msgctxt "button"
msgid "Disconnect"
msgstr "Déconnexion"

#~ msgid "[email protected]"
#~ msgstr "ami(e)@mstdn.fr"

#~ msgid "Not connected to Mastodon."
#~ msgstr "Pas connecté à Mastodon."
24 changes: 15 additions & 9 deletions nabweatherd/nabweatherd.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import dateutil.parser
import logging
from asgiref.sync import sync_to_async
from nabcommon.nabservice import NabInfoCachedService
from nabcommon.nabservice import NabInfoService
from meteofrance.client import meteofranceClient


class NabWeatherd(NabInfoCachedService):
class NabWeatherd(NabInfoService):
UNIT_CELSIUS = 1
UNIT_FARENHEIT = 2

Expand Down Expand Up @@ -385,6 +385,13 @@ def update_next(self, next_date, next_args):
config.next_performance_type = next_args
config.save()

def next_info_update(self, config):
if config is None:
return None
now = datetime.datetime.now(datetime.timezone.utc)
next_5mn = now + datetime.timedelta(seconds=300)
return next_5mn

async def fetch_info_data(self, config_t):
location, unit = config_t
if location is None:
Expand All @@ -394,13 +401,11 @@ async def fetch_info_data(self, config_t):
logging.debug(data)

if ('next_rain') in data:
logging.debug(f"next_rain is available")
if (data["next_rain"] == 'No rain'):
next_rain = 'J_W1_0-N_0'
else :
next_rain = 'J_W1_32-N_0'
else :
logging.debug(f"next_rain is NOT available")
next_rain = None

current_weather_class = self.normalize_weather_class(
Expand All @@ -409,6 +414,7 @@ async def fetch_info_data(self, config_t):
today_forecast_weather_class = self.normalize_weather_class(
data["forecast"][0]["weather_class"]
)

today_forecast_max_temp = data["forecast"][0]["max_temp"]
tomorrow_forecast_weather_class = self.normalize_weather_class(
data["forecast"][1]["weather_class"]
Expand All @@ -432,11 +438,11 @@ def normalize_weather_class(self, weather_class):

def get_animation(self, info_data):
if info_data is None or info_data["next_rain"] is None:
return None
logging.debug(f"get_animation is not None")
(weather_class, info_animation) = NabWeatherd.WEATHER_CLASSES[
info_data["next_rain"]
]
logging.debug("No rain info, classic weather animation will be displayed")
(weather_class, info_animation) = NabWeatherd.WEATHER_CLASSES[info_data["today_forecast_weather_class"]]
else :
logging.debug("Rain info available")
(weather_class, info_animation) = NabWeatherd.WEATHER_CLASSES[info_data["next_rain"]]
return info_animation

async def perform_additional(self, expiration, type, info_data, config_t):
Expand Down
47 changes: 32 additions & 15 deletions nabweb/locale/fr_FR/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-17 11:38+0100\n"
"POT-Creation-Date: 2019-12-18 10:13+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -76,15 +76,19 @@ msgstr "Information système"
msgid "Upgrade"
msgstr "Mise à jour"

#: templates/nabweb/_base.html:44
#: templates/nabweb/_base.html:31
msgid "Help!"
msgstr "Aide !"

#: templates/nabweb/_base.html:45
msgid "Upgrading"
msgstr "Mise à jour"

#: templates/nabweb/_base.html:47
#: templates/nabweb/_base.html:48
msgid "Please wait while upgrading pynab..."
msgstr "Veuillez patienter pendant la mise à jour de pynab"

#: templates/nabweb/_base.html:81
#: templates/nabweb/_base.html:79
#, fuzzy
#| msgid "Unknown server error (LOL)"
msgid "Unknown server error"
Expand Down Expand Up @@ -124,20 +128,33 @@ msgstr ""
#: templates/nabweb/index.html:13
msgid ""
"You can trigger some services with your voice. The processing is done "
"locally and you need to push the button long enough to hear a 'bip' (keep the button pushed), then "
"wait a couple of seconds (We'll have a look at this later!) then speak and "
"when you're done just release the button. Your service should be played "
"shortly!"
"locally and you need to push the button long enough to hear a 'bip' (keep "
"the button pushed), then wait a couple of seconds (We'll have a look at this "
"later!) then speak and when you're done just release the button. Your "
"service should be played shortly!"
msgstr ""
"Vous pouvez aussi déclencher certains services en demandant à Nabaztag. La reconnaissance "
"vocale est effectuée localement et il vous faut appuyer sur le bouton (en le maintenant appuyé), attendre le 'bip', attendre encore quelques secondes "
"(oui c'est un bug) puis parler. Relacher quand vous n'avez plus rien à dire et attendez que Nabaztag vous réponde."
"Vous pouvez aussi déclencher certains services en demandant à Nabaztag. La "
"reconnaissance vocale est effectuée localement et il vous faut appuyer sur "
"le bouton (en le maintenant appuyé), attendre le 'bip', attendre encore "
"quelques secondes (oui c'est un bug) puis parler. Relacher quand vous n'avez "
"plus rien à dire et attendez que Nabaztag vous réponde."

#: templates/nabweb/index.html:14
msgid ""
"And don't forget to try <a href='http://nabaztag.local:8081' "
"target='_new'>Nabblocky</a> and learn how to code with Nabaztag. It's "
"fantastic."
msgstr ""
"Et n'oubliez pas d'essayer <a href='http://nabaztag.local:8081' "
"target='_new'>Nabblocky</a>. Pour tous ceux qui veulent apprendre à développer avec Nabaztag. "
"C'est fantastique !"


#: templates/nabweb/index.html:24 templates/nabweb/index.html:29
#: templates/nabweb/index.html:26 templates/nabweb/index.html:31
msgid "Language"
msgstr "Langue"

#: templates/nabweb/index.html:27
#: templates/nabweb/index.html:29
msgid ""
"The language is used by services with recorded sounds. U.S. English and "
"British English are based on distinct voices."
Expand All @@ -146,11 +163,11 @@ msgstr ""
"Typiquement, l'américain et le britannique utilisent des voix différentes. "
"le Japonais est intéressant."

#: templates/nabweb/index.html:42
#: templates/nabweb/index.html:44
msgid "Save"
msgstr "Enregistrer"

#: templates/nabweb/index.html:43
#: templates/nabweb/index.html:45
msgid "Reset"
msgstr "Annuler"

Expand Down
1 change: 1 addition & 0 deletions nabweb/templates/nabweb/_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<li><a class="nav-link{% if request.path == '/services/' %} active{% endif %}" href="{% if request.path == '/services/' %}#{% else %}/services/{% endif %}">{% trans "Services" %}{% if request.path == '/services/' %} <span class="sr-only">{% trans "(current)" %}</span>{% endif %}</a></li>
<li><a class="nav-link{% if request.path == '/system-info/' %} active{% endif %}" href="{% if request.path == '/system-info/' %}#{% else %}/system-info/{% endif %}">{% trans "System Information" %}{% if request.path == '/system-info/' %} <span class="sr-only">{% trans "(current)" %}</span>{% endif %}</a></li>
<li><a class="nav-link upgrade-link{% if request.path == '/upgrade/' %} active{% endif %}" href="{% if request.path == '/upgrade/' %}#{% else %}/upgrade/{% endif %}">{% trans "Upgrade" %} <span class="badge badge-info"></span>{% if request.path == '/upgrade/' %} <span class="sr-only">{% trans "(current)" %}</span>{% endif %}</a></li>
<li><a class="nav-link" href="https://tagtagtag.fr/forum" target="_new">{% trans "Help!" %} </a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a class="nav-link pull-right" href="https://github.com/nabaztag2018/pynab" target="_blank" aria-label="GitHub"><img src="{% static "nabweb/images/GitHub-Mark-32px.png" %}" title="GitHub" width="20" height="20" /></a></li>
Expand Down
2 changes: 2 additions & 0 deletions nabweb/templates/nabweb/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ <h1 class="display-3">{% trans "Nabaztag configuration" %}</h1>
<p>{% trans "Eventually, explore top navigation bar to configure <a href='/settings/'>Nabaztag services</a>, <a href='/upgrade/'>upgrade software</a> or even visit the <a target='_blank' href='https://github.com/nabaztag2018/pynab'>GitHub repository</a> to start hacking, adding features or simply report bugs." %}</p>

<p>{% trans "You can trigger some services with your voice. The processing is done locally and you need to push the button long enough to hear a 'bip' (keep the button pushed), then wait a couple of seconds (We'll have a look at this later!) then speak and when you're done just release the button. Your service should be played shortly!" %}</p>
<p>{% trans "And don't forget to try <a href='http://nabaztag.local:8081' target='_new'>Nabblocky</a> and learn how to code with Nabaztag. It's fantastic." %}</p>



</div>
Expand Down

0 comments on commit bc6a15b

Please sign in to comment.