Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
flatsiedatsie authored May 24, 2022
1 parent adf07c1 commit 5cfd2f1
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 11 deletions.
3 changes: 0 additions & 3 deletions css/extension.css
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@
}


.extension-voco-select-satellites-question{

}

.extension-voco-item{
padding: 0;
Expand Down
2 changes: 1 addition & 1 deletion js/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@


if(this.busy_polling){
console.log("was still polling, aborting new poll");
console.log("voco: was still polling, aborting new poll");
return;
}
else{
Expand Down
12 changes: 7 additions & 5 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
"Sound detection": false,
"Hey Candle": true,
"Mute the radio": false,
"Satellite device control": true,
"Satellite device control": false,
"Disable security": false,
"MQTT port": 1885,
"Debugging": false
},
"schema": {
"properties": {
"Authorization token": {
"description": "Advanced. To be allowed to get information on all your devices, you have to create an 'authorization' code. It's basically a very long password. You can generate it yourself under Settings -> Developer -> Create local authorization. Any code you add here will override the code set throug the interface.",
"description": "Advanced. To be allowed to get information on all your devices, you have to create an 'authorization' code. It's basically a very long password. You can generate it yourself under Settings -> Developer -> Create local authorization. Any code you add here will override the code set through the interface.",
"type": "string"
},
"Metric": {
Expand Down Expand Up @@ -92,7 +92,7 @@
"type": "string"
},
"Use Aplay instead of OMX Player": {
"description": "In some cases Voco will use OMX Player to play audio files. If this is causing issues you can choose to only use Aplay.",
"description": "Advanced. In some cases Voco will use OMX Player to play audio files. If this is causing issues you can choose to only use Aplay.",
"type": "boolean"
},
"Voice accent": {
Expand Down Expand Up @@ -167,8 +167,10 @@
"type": "string"
},
"System audio volume": {
"description": "Advanced. When provided, the system volume will be set to this volume percentage level when Voco starts. This is separate from Voco's own volume, which is relative to the system volume. Can be between 0 and 100 percent. The default is 95.",
"type": "integer"
"description": "Advanced. When provided, the system volume will be set to this volume percentage level when Voco starts. This is separate from Voco's own volume, which is relative to the system volume. Can be between 0 and 100 percent. The default is 90.",
"type": "integer",
"minimum": 10,
"maximum": 100
},
"Sound detection": {
"description": "When enabled, an extra switch will be created in the voice control thing. That switch will be turned on for 10 seconds whenever speech or sound is detected.",
Expand Down
45 changes: 43 additions & 2 deletions pkg/voco_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1696,16 +1696,57 @@ def mute(self):
if self.DEBUG:
print("In mute. current_control_name: " + str(self.current_control_name))
run_command("amixer sset " + str(self.current_control_name) + " mute")
#self.pause_omxplayer()




def unmute(self):
if self.DEBUG:
print("In unmute. current_control_name: " + str(self.current_control_name))
run_command("amixer sset " + str(self.current_control_name) + " unmute")
#self.pause_omxplayer()


# dangerous if it gets out of sync somehow..
def pause_omxplayer(self):
if self.DEBUG:
print("Trying dbus mute of omxplayer")


omxplayerdbus_user = run_command('cat /tmp/omxplayerdbus.${USER:-root}')
if self.DEBUG:
print("DBUS_SESSION_BUS_ADDRESS: " + str(omxplayerdbus_user))
if omxplayerdbus_user != None:
if self.DEBUG:
print("trying dbus-send")
environment = os.environ.copy()
environment["DBUS_SESSION_BUS_ADDRESS"] = str(omxplayerdbus_user).strip()
environment["DISPLAY"] = ":0"

if self.DEBUG:
print("environment: " + str(environment))

dbus_volume = volume / 100
if self.DEBUG:
print("dbus_volume: " + str(dbus_volume))

dbus_command = 'dbus-send --print-reply --session --reply-timeout=500 --dest=org.mpris.MediaPlayer2.omxplayer /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Action int32:16'
#dbus_command = 'dbus-send --print-reply --session --reply-timeout=500 --dest=org.mpris.MediaPlayer2.omxplayer /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Set string:"org.mpris.MediaPlayer2.Player" string:"Volume" double:' + str(dbus_volume)
#export DBUS_SESSION_BUS_ADDRESS=$(cat /tmp/omxplayerdbus.${USER:-root})
dbus_process = subprocess.Popen(dbus_command,
env=environment,
shell=True, # Streaming to bluetooth seems to only work if shell is true. The position of the volume string also seemed to matter
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=True)

stdout,stderr = dbus_process.communicate()

if self.DEBUG:
print("dbus stdout: " + str(stdout))
print("dbus stderr: " + str(stderr))



#
Expand Down Expand Up @@ -3437,7 +3478,7 @@ def on_message(self, client, userdata, msg):
self.last_injection_time = time.time() # if a site is injecting, all sites should wait a while before attempting their own injections.
self.injection_in_progress = True
if self.DEBUG:
print("INJECTION PERFORM MESSAGE RECEIVED")
print("INJECTION PERFORM MESSAGE RECEIVED (injection is now in progress)")

elif msg.topic.startswith('hermes/injection/complete'):
if self.DEBUG:
Expand Down

0 comments on commit 5cfd2f1

Please sign in to comment.