MycroftOS: Update mycroft-volume skill

This commit is contained in:
j1nx 2020-09-16 19:49:48 +02:00
parent 87fbc5ecef
commit 560f20060f
221 changed files with 420 additions and 42 deletions

View File

@ -1,2 +0,0 @@
Lydstyrken er allerede på maximum
Jeg kan ikke blive højere

View File

@ -1,15 +0,0 @@
0
1
2
3
4
5
6
7
8
9
10
11
leise
standard
laut

View File

@ -1,15 +0,0 @@
0
1
2
3
4
5
6
7
8
9
10
11
tyst
normal
hög

View File

@ -23,7 +23,7 @@ from mycroft.util import play_wav
from mycroft.util.parse import extract_number
ALSA_PLATFORMS = ['MycroftOS', 'mycroft_mark_1', 'picroft', 'unknown']
ALSA_PLATFORMS = ['mycroft_mark_1', 'picroft', 'MycroftOS', 'unknown']
class VolumeSkill(MycroftSkill):

View File

@ -0,0 +1,2 @@
Lydstyrke er allerede på maks
Jeg kan ikke blive højere

View File

@ -0,0 +1,3 @@
Lydstyrke er sat til højeste niveau
Lydstyrke er nu på maks
Lydstyrke er nu sat til højeste niveau

View File

@ -1,3 +1,3 @@
Lydstyrke stillet til {{volume}}
Lydstyrke sat til {{volume}}
Lydstyrke indstillet til {{volume}}
Lydstyrken ændret til {{volume}}

View File

@ -0,0 +1,3 @@
Volymen har satts till högsta nivå
Volymen är nu på max
Volymen är nu satt på högsta nivå

View File

@ -0,0 +1,70 @@
from time import sleep
from behave import given, then
from mycroft.messagebus import Message
from mycroft.audio import wait_while_speaking
from test.integrationtests.voight_kampff import emit_utterance
@given("Mycroft audio is muted")
def given_muted(context):
context.bus.emit(Message('mycroft.volume.mute',
data={'speak_message': False}))
sleep(0.5)
@given("the volume is set to 5")
def given_volume_is_five(context):
emit_utterance(context.bus, 'Set volume to 5')
context.volume = 0.5
sleep(1)
wait_while_speaking()
context.bus.clear_messages()
@given("the volume is set to 10")
def given_volume_is_ten(context):
emit_utterance(context.bus, 'Set volume to 10')
context.volume = 1.0
sleep(1)
wait_while_speaking()
context.bus.clear_messages()
@then('"mycroft-volume" should decrease the volume')
def then_decrease(context):
cnt = 0
msgs = context.bus.get_messages('mycroft.volume.set')
while msgs == []:
if cnt > 20:
assert False, "Message not found"
break
else:
cnt += 1
sleep(0.5)
msgs = context.bus.get_messages('mycroft.volume.set')
if msgs:
err_info = "Volume hasn't decreased!"
print(msgs[0].data['percent'])
assert msgs[0].data['percent'] < context.volume, err_info
@then('"mycroft-volume" should increase the volume')
def then_increase(context):
cnt = 0
msgs = context.bus.get_messages('mycroft.volume.set')
while msgs == []:
if cnt > 20:
assert False, "Message not found"
break
else:
cnt += 1
sleep(0.5)
msgs = context.bus.get_messages('mycroft.volume.set')
if msgs:
err_info = "Volume hasn't increased!"
print(msgs[0].data['percent'])
assert msgs[0].data['percent'] > context.volume, err_info

View File

@ -0,0 +1,195 @@
Feature: volume control
Scenario Outline: turning up the volume
Given an english speaking user
And the volume is set to 5
When the user says "<volume up>"
Then "mycroft-volume" should increase the volume
Examples: turning up the volume
| volume up |
| volume up |
| increase volume |
| volume up |
| turn it up |
| louder |
| more sound |
| more audio |
| higher volume |
| raise the volume |
| boost volume |
| turn up the volume |
| crank it up |
| crank volume |
| make it louder |
Scenario Outline: turning down the volume
Given an english speaking user
And the volume is set to 5
When the user says "<volume down>"
Then "mycroft-volume" should decrease the volume
Examples: turning down the volume
| volume down |
| volume down |
| decrease volume |
| volume down |
| turn it down |
| quieter please |
| less sound |
| lower volume |
| reduce volume |
| quieter |
| less volume |
| lower sound |
| make it quieter |
| make it lower |
| make it softer |
Scenario Outline: change volume to a number between 1 and 10
Given an english speaking user
And the volume is set to 5
When the user says "<change volume to a number>"
Then "mycroft-volume" should reply with dialog from "set.volume.dialog"
Examples: change volume to a number between 0 and 10
| change volume to a number |
| change volume to 7 |
| change volume to 8 |
| set volume to 9 |
| set audio to 6 |
| decrease volume to 4 |
| raise volume to 8 |
| lower volume to 4 |
| volume 8 |
Scenario Outline: change volume to a percent of 100
Given an english speaking user
And the volume is set to 5
When the user says "<change volume to a percent>"
Then "mycroft-volume" should reply with dialog from "set.volume.percent.dialog"
Examples: change volume to a percent
| change volume to a percent |
| volume 80 percent |
Scenario Outline: max volume
Given an english speaking user
And the volume is set to 5
When the user says "<max volume>"
Then "mycroft-volume" should reply with dialog from "max.volume.dialog"
Examples: max volume
| max volume |
| max volume |
| maximum volume |
| loudest volume |
| max audio |
| maximum audio |
| max sound |
| maximum sound |
| turn it up all the way |
| set volume to maximum |
| highest volume |
| raise volume to max |
| raise volume all the way |
| increase volume to 10 |
Scenario Outline: volume status
Given an english speaking user
And the volume is set to 5
When the user says "<volume status>"
Then "mycroft-volume" should reply with dialog from "volume.is.dialog"
Examples: volume status
| volume status |
| volume status |
| what's your volume |
| what's your current volume level |
| whats your sound level |
| what's your audio level |
| volume level |
| volume status |
| what volume are you set to |
| how loud is it |
| how loud is the volume |
| how loud is that |
| how high is the volume |
| how high is the sound |
| how high is the audio |
| how high is the sound level |
| how high is the audio level |
| how high is the volume level |
| what's the volume at |
| what's the current volume |
| what's the volume set to |
| what is the volume at |
| what level is the volume set to |
| what level is the volume at |
Scenario Outline: reset volume
Given an english speaking user
And the volume is set to 10
When the user says "<reset volume>"
Then "mycroft-volume" should reply with dialog from "reset.volume.dialog"
Examples: reset volume
| reset volume |
| reset volume |
| default volume |
| go to default volume |
| restore volume |
| change volume to default volume |
| set volume to default volume |
Scenario Outline: mute audio
Given an english speaking user
And the volume is set to 5
When the user says "<mute audio>"
Then "mycroft-volume" should reply with dialog from "mute.volume.dialog"
Examples: mute audio
| mute audio |
| mute audio |
| mute volume |
| mute all audio |
| mute the sound |
| silence the audio |
@xfail
Scenario Outline: mute audio
Given an english speaking user
And the volume is set to 5
When the user says "<mute audio>"
Then "mycroft-volume" should reply with dialog from "mute.volume.dialog"
Examples: mute audio
| mute audio |
| be quiet |
Scenario Outline: unmute audio
Given an english speaking user
And Mycroft audio is muted
When the user says "<unmute audio>"
Then "mycroft-volume" should reply with dialog from "reset.volume.dialog"
Examples: unmute audio
| unmute audio |
| unmute audio |
| unmute the volume |
@xfail
Scenario Outline: unmute audio
Given an english speaking user
And Mycroft audio is muted
When the user says "<unmute audio>"
Then "mycroft-volume" should reply with dialog from "reset.volume.dialog"
Examples: unmute audio
| unmute audio |
| unmute |
| turn sound back on |
| turn on sound |
| turn muting off |
| turn mute off |
| unmute all sound |

Some files were not shown because too many files have changed in this diff Show More