Skip to content

Commit 76c518b

Browse files
committed
- TTS: speaking errors when timeout occurs
- TTS: errors will not say error code - Windows always shows config is dirty - fixed - macOS would never issue a Desktop Notification - fixed
1 parent b325f8b commit 76c518b

File tree

6 files changed

+24
-2
lines changed

6 files changed

+24
-2
lines changed

pyradio/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1679,7 +1679,7 @@ def enable_mouse(self, val):
16791679
def enable_notifications(self):
16801680
if is_graphical_environment_running():
16811681
return self.opts['enable_notifications'][1]
1682-
return False
1682+
return '-1'
16831683

16841684
@enable_notifications.setter
16851685
def enable_notifications(self, val):

pyradio/config_window.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class PyRadioConfigWindow():
8080
_help_text.append(['Notice: Not applicable on Windows!', '|', 'Online Radio Directory Services (like RadioBrowser) will usually provide an icon for the stations they advertise.', '|', 'PyRadio can use this icon (provided that one exists and is of JPG or PNG format) while displaying Desktop Notifications.', '|', 'Setting this option to True, will enable the behavior above.', '|', 'If this option is False, the default icon will be used.', '|', 'Default value: True'])
8181
_help_text.append(['Notice: Not applicable on Windows!', '|', 'If the previous option is enabled, Stations Icons will be cached.', '|', 'If this option is set to True, all icons will be deleted at program exit.', '|', 'If set to False, the icons will be available for future use.', '|', 'Default value: True'])
8282
_help_text.append(None)
83-
_help_text.append(['Enable TTS', ])
83+
_help_text.append(['PyRadio now features comprehensive Text-to-Speech (TTS) support, providing auditory feedback for an enhanced radio streaming experience.', '|', 'This system delivers contextual information about station navigation, playback status, and system events.', '|', 'Default value: False'])
8484
_help_text.append(None)
8585
_help_text.append(['If this option is enabled, the current time will be displayed at the bottom left corner of the window at program startup.', '|', 'Adjust the time format in the next option to change how the current time is displayed.', '|', r'You can always hide it by pressing ' + to_str('open_extra') + to_str('toggle_time') + '.', '|', 'Default value: False'])
8686
_help_text.append(['This is the time format to be used when the clock is visible.', '|', 'Available values are:', ' 0: 24h, with seconds', ' 1: 24h, no seconds', ' 2: 12h, with am/pm and seconds', ' 3: 12h, no am/pm, with seconds', ' 4: 12h, with am/pm, no seconds', ' 5: 12h, no am/pm, no seconds', '|', 'Default value: 1'])
@@ -213,6 +213,7 @@ def __init__(
213213
self._config_options = deepcopy(config.opts)
214214
self._default_config_options = config.config_opts
215215

216+
self._old_use_transparency = self._saved_config_options['use_transparency'][1]
216217
self._orig_redording_dir = self._config_options['recording_dir'][1]
217218
for n in self._default_config_options, \
218219
self._saved_config_options, \

pyradio/html_help.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from sys import platform
66
from os import path, environ, listdir, getenv
77
from shutil import which
8+
from platform import system
89
from .install import get_a_linux_resource_opener
910
try:
1011
import psutil
@@ -29,6 +30,10 @@ def convert_to_md(a_file):
2930

3031
def is_graphical_environment_running():
3132
global HAS_GRAPHICAL_ENV
33+
this_system = system()
34+
if this_system == 'Darwin' or this_system == 'Windows':
35+
HAS_GRAPHICAL_ENV = 1
36+
return True
3237
if getenv('TERM') == 'linux':
3338
HAS_GRAPHICAL_ENV = 2
3439
return False

pyradio/messages_system.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,14 @@ def set_text(self, parent, *args):
188188
{toggle_station_volume} |*| Toggle use of station |V|olume.
189189
{toggle_time} |*| Toggle time display.
190190
{toggle_tts} |*| Toggle Text-to-Speech.
191+
{open_remote_control} |*| Open "PyRadio Remote Control" window.
192+
{open_dirs} |*| Open dirs in file manager
193+
{buffer} |*| Toggle buffering.
194+
{open_buffer} |*| Open buffering window.
195+
{unnamed} |*| Show unnamed register.
196+
{last_playlist} |*| Toggle Open last playlist.
197+
{toggle_time} |*| Toggle displaying time.
198+
{clear_reg} |*| Clear current register.
191199
192200
!Copy mode ({add_to_reg})
193201
Enter |*| Copy station to unnamed register.
@@ -592,6 +600,7 @@ def set_text(self, parent, *args):
592600
{hist_top} |*| Open first opened playlist.
593601
{buffer} {open_buffer} |*| Set player |b|uffering.
594602
{toggle_time} |*| Toggle |t|ime display.
603+
{toggle_tts} |*| Toggle TTS.
595604
{last_playlist} |*| Toggle |Open last playlist|.
596605
{change_player} |*| Cahnge |m|edia player.
597606
{new_playlist} |*| Create a |n|ew playlist.
@@ -612,6 +621,7 @@ def set_text(self, parent, *args):
612621
{hist_top} |*| Open first opened playlist.
613622
{buffer} {open_buffer} |*| Set player |b|uffering.
614623
{toggle_time} |*| Toggle |t|ime display.
624+
{toggle_tts} |*| Toggle TTS.
615625
{last_playlist} |*| Toggle |Open last playlist|.
616626
{change_player} |*| Cahnge |m|edia player.
617627
{new_playlist} |*| Create a |n|ew playlist.
@@ -636,6 +646,8 @@ def set_text(self, parent, *args):
636646
{open_dirs} |*| |O|pen dirs in file manager.
637647
{station_volume} |*| Save station |v|olume.
638648
{toggle_station_volume} |*| Toggle use of station |V|olume.
649+
{toggle_time} |*| Toggle |t|ime display.
650+
{toggle_tts} |*| Toggle TTS.
639651
640652
Any other key exits current mode.
641653
'''

pyradio/radio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2739,6 +2739,7 @@ def connectionFailed(self):
27392739
logger.info('*** Start of playback NOT detected!!! ***')
27402740
self.player.stop_mpv_status_update_thread = True
27412741
self.log.write(msg_id=STATES.CONNECT_ERROR, msg=self.player.PLAYER_NAME + ': ' + M_STRINGS['error-1001'])
2742+
self._speak_high(M_STRINGS['error-1001'])
27422743
self.player.connecting = False
27432744
if self._random_requested and \
27442745
self.ws.operation_mode == self.ws.NORMAL_MODE:
@@ -7293,6 +7294,7 @@ def keypress(self, char):
72937294
)
72947295
else:
72957296
self.log.stop_timer()
7297+
self._update_status_bar_right(status_suffix='')
72967298

72977299
elif char == kbkey['open_dirs'] or \
72987300
check_localized(char, (kbkey['open_dirs'],)):

pyradio/tts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,8 @@ def queue_speech(self, text, priority=Priority.NORMAL):
775775
return False
776776
if '%' in text:
777777
text = text.replace('%', ' precent')
778+
if priority == Priority.HIGH and ' (error ' in text:
779+
text = text.split(' (error ')[0]
778780

779781
# Volume debouncing logic
780782
if (priority == Priority.HIGH and

0 commit comments

Comments
 (0)