Opening web links with the desktop client

main
Bob Mottram 2021-03-15 14:53:21 +00:00
parent 42e11d3b83
commit a640a6f61a
1 changed files with 14 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import html
import time import time
import sys import sys
import select import select
import webbrowser
from pathlib import Path from pathlib import Path
from random import randint from random import randint
from utils import getStatusNumber from utils import getStatusNumber
@ -1138,3 +1139,16 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
systemLanguage, espeak) systemLanguage, espeak)
else: else:
print('No --screenreader option was specified') print('No --screenreader option was specified')
elif keyPress.startswith('open '):
if speakerJson.get('detectedLinks'):
sayStr = 'Opening web links in browser.'
_sayCommand(sayStr, sayStr, originalScreenReader,
systemLanguage, espeak)
for url in speakerJson['detectedLinks']:
if '://' in url:
webbrowser.open(url)
else:
sayStr = 'There are no web links to open.'
_sayCommand(sayStr, sayStr, originalScreenReader,
systemLanguage, espeak)
print('')