mirror of
https://github.com/leon-ai/leon.git
synced 2024-09-20 14:27:40 +03:00
feat: Add speedtest package
This commit is contained in:
parent
aff32be78e
commit
09ad43406d
36
packages/speedtest/README.md
Normal file
36
packages/speedtest/README.md
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# SpeedTest Package
|
||||||
|
|
||||||
|
The SpeedTest package will give you information about your network speed
|
||||||
|
* Ping
|
||||||
|
* Download speed
|
||||||
|
* Speed Upload)
|
||||||
|
|
||||||
|
Based on the package https://github.com/sivel/speedtest-cli
|
||||||
|
|
||||||
|
## Modules
|
||||||
|
|
||||||
|
### Speedtest
|
||||||
|
|
||||||
|
#### Usage
|
||||||
|
|
||||||
|
**en-US**:
|
||||||
|
```
|
||||||
|
(en-US) "What is my current Internet speed?"
|
||||||
|
(en-US) "Can you make me a speedtest?"
|
||||||
|
(en-US) "Made a speedtest"
|
||||||
|
(en-US) "Start a speed test"
|
||||||
|
(en-US) "Is my internet network good?"
|
||||||
|
(en-US) "Is my internet connection good?"
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
**fr-FR**:
|
||||||
|
```
|
||||||
|
(fr-FR) "Quelle est ma vitesse Internet actuelle?"
|
||||||
|
(fr-FR) "Peux-tu me faire un speedtest ?"
|
||||||
|
(fr-FR) "Fait un speedtest"
|
||||||
|
(fr-FR) "Lance moi un test de vitesse"
|
||||||
|
(fr-FR) "Mon réseau internet est-il bon ?"
|
||||||
|
(fr-FR) "Ma connexion internet est-elle bonne ?"
|
||||||
|
...
|
||||||
|
```
|
0
packages/speedtest/__init__.py
Normal file
0
packages/speedtest/__init__.py
Normal file
0
packages/speedtest/config/.gitkeep
Normal file
0
packages/speedtest/config/.gitkeep
Normal file
5
packages/speedtest/config/config.sample.json
Normal file
5
packages/speedtest/config/config.sample.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"speedtest": {
|
||||||
|
"options": {}
|
||||||
|
}
|
||||||
|
}
|
0
packages/speedtest/data/.gitkeep
Normal file
0
packages/speedtest/data/.gitkeep
Normal file
0
packages/speedtest/data/answers/.gitkeep
Normal file
0
packages/speedtest/data/answers/.gitkeep
Normal file
13
packages/speedtest/data/answers/en.json
Normal file
13
packages/speedtest/data/answers/en.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"speedtest": {
|
||||||
|
"start": [
|
||||||
|
"Well, I start the analysis. The results of the test will be given to you in a few moments..."
|
||||||
|
],
|
||||||
|
"end": [
|
||||||
|
"Analysis completed. Here are your results:"
|
||||||
|
],
|
||||||
|
"error": [
|
||||||
|
"Ooh, an error occurred during my research... Sorry, but I can not analyze your network."
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
14
packages/speedtest/data/answers/fr.json
Normal file
14
packages/speedtest/data/answers/fr.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"speedtest": {
|
||||||
|
"start": [
|
||||||
|
"Bien, je démarre l'analyse.\nLes résultats du test vous seront donnés dans quelques instants...",
|
||||||
|
"Je démarre l'analyse de votre vitesse réseau.\nLes résultats du test vous seront donnés dans quelques instants..."
|
||||||
|
],
|
||||||
|
"end": [
|
||||||
|
"Analyse terminée. Voici vos résultats :"
|
||||||
|
],
|
||||||
|
"error": [
|
||||||
|
"Mince, une erreur est survenue durant mes recherches... Désolé, mais je ne parviens pas à analyser votre réseau."
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
0
packages/speedtest/data/db/.gitkeep
Normal file
0
packages/speedtest/data/db/.gitkeep
Normal file
0
packages/speedtest/data/expressions/.gitkeep
Normal file
0
packages/speedtest/data/expressions/.gitkeep
Normal file
10
packages/speedtest/data/expressions/en.json
Normal file
10
packages/speedtest/data/expressions/en.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"speedtest": [
|
||||||
|
"What is my current Internet speed?",
|
||||||
|
"Can you make me a speedtest?",
|
||||||
|
"Made a speedtest",
|
||||||
|
"Start a speed test",
|
||||||
|
"Is my internet network good?",
|
||||||
|
"Is my internet connection good?"
|
||||||
|
]
|
||||||
|
}
|
10
packages/speedtest/data/expressions/fr.json
Normal file
10
packages/speedtest/data/expressions/fr.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"speedtest": [
|
||||||
|
"Quelle est ma vitesse Internet actuelle?",
|
||||||
|
"Peux-tu me faire un speedtest ?",
|
||||||
|
"Fait un speedtest",
|
||||||
|
"Lance moi un test de vitesse",
|
||||||
|
"Mon réseau internet est-il bon ?",
|
||||||
|
"Ma connexion internet est-elle bonne ?"
|
||||||
|
]
|
||||||
|
}
|
1895
packages/speedtest/speedtest.lib.py
Normal file
1895
packages/speedtest/speedtest.lib.py
Normal file
File diff suppressed because it is too large
Load Diff
36
packages/speedtest/speedtest.py
Normal file
36
packages/speedtest/speedtest.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
|
# The SpeedTest package will give you information about your network speed
|
||||||
|
# Author: Florian Bouché
|
||||||
|
# Date: 2019-03-09
|
||||||
|
# Based on the package https://github.com/sivel/speedtest-cli
|
||||||
|
|
||||||
|
import utils
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
def speedtest(string):
|
||||||
|
"""The SpeedTest package will give you information about your network speed """
|
||||||
|
|
||||||
|
utils.output('inter', 'start', utils.translate('start'))
|
||||||
|
|
||||||
|
realpath = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
process = subprocess.Popen(
|
||||||
|
[sys.executable, realpath + '\speedtest.lib.py', '--simple'],
|
||||||
|
shell=True,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.STDOUT
|
||||||
|
)
|
||||||
|
|
||||||
|
(output, err) = process.communicate()
|
||||||
|
p_status = process.wait()
|
||||||
|
|
||||||
|
if err:
|
||||||
|
utils.output('end', 'error', utils.translate('error'))
|
||||||
|
|
||||||
|
utils.output('inter', 'end', utils.translate('end'))
|
||||||
|
|
||||||
|
return utils.output('end', 'test', output.decode('utf-8'))
|
1
packages/speedtest/version.txt
Normal file
1
packages/speedtest/version.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.0.0
|
Loading…
Reference in New Issue
Block a user