|
41 | 41 | class PyRadioConfigWindow(): |
42 | 42 | _title = 'PyRadio Configuration' |
43 | 43 |
|
| 44 | + _tts_volume_date = (0, 0, 0) |
44 | 45 | _help_text = [] |
45 | 46 | _help_text.append(None) |
46 | 47 | _help_text.append(['Specify the player to use with PyRadio, or the player detection order.', '|', |
@@ -80,7 +81,15 @@ class PyRadioConfigWindow(): |
80 | 81 | _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']) |
81 | 82 | _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']) |
82 | 83 | _help_text.append(None) |
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']) |
| 84 | + _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.', '|', 'The TTS function cal also be termporarily toggled by pressing ' + to_str('open_extra') + to_str('toggle_tts') + '.', '|', 'Default value: False']) |
| 85 | + if platform.startswith('dar'): |
| 86 | + _help_text.append(['This option will not be used by the TTS engine.', '|', 'Adjust the System Volume instead.']) |
| 87 | + elif platform.startswith('win'): |
| 88 | + _help_text.append(['This is the volume to be used by the TTS engine.', '|', 'Valid values: 0 (silent) - 100', '|', 'Default value: 50']) |
| 89 | + _tts_volume_date = (0, 100, 5) |
| 90 | + else: |
| 91 | + _help_text.append(['This is the volume to be used by the speech dispatcher, provided that the engine selected supports it.', '|', 'Valid values: -100,+100', '|', 'Default value: 50']) |
| 92 | + _tts_volume_date = (-100, 100, 10) |
84 | 93 | _help_text.append(None) |
85 | 94 | _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']) |
86 | 95 | _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']) |
@@ -813,6 +822,7 @@ def keypress(self, char): |
813 | 822 | 'time_format', |
814 | 823 | 'buffering', |
815 | 824 | 'mplayer_save_br', |
| 825 | + 'tts_volume', |
816 | 826 | ) and char in ( |
817 | 827 | curses.KEY_LEFT, |
818 | 828 | curses.KEY_RIGHT, |
@@ -1123,6 +1133,37 @@ def keypress(self, char): |
1123 | 1133 | self._win.refresh() |
1124 | 1134 | return -1, [] |
1125 | 1135 |
|
| 1136 | + elif val[0] == 'tts_volume': |
| 1137 | + if char in (curses.KEY_RIGHT, kbkey['l']) or \ |
| 1138 | + check_localized(char, (kbkey['l'], )): |
| 1139 | + t = int(val[1][1]) |
| 1140 | + if t < self._tts_volume_date[1]: |
| 1141 | + t += self._tts_volume_date[2] |
| 1142 | + if t > self._tts_volume_date[1]: |
| 1143 | + t = self._tts_volume_date[1] |
| 1144 | + self._config_options[val[0]][1] = str(t) |
| 1145 | + self._win.addstr( |
| 1146 | + Y, 3 + len(val[1][0]), |
| 1147 | + str(t) + ' ', curses.color_pair(6)) |
| 1148 | + self._print_title() |
| 1149 | + self._win.refresh() |
| 1150 | + return -1, [] |
| 1151 | + |
| 1152 | + elif char in (curses.KEY_LEFT, kbkey['h']) or \ |
| 1153 | + check_localized(char, (kbkey['h'], )): |
| 1154 | + t = int(val[1][1]) |
| 1155 | + if t > self._tts_volume_date[0]: |
| 1156 | + t -= self._tts_volume_date[2] |
| 1157 | + if t < self._tts_volume_date[0]: |
| 1158 | + t = self._tts_volume_date[0] |
| 1159 | + self._config_options[val[0]][1] = str(t) |
| 1160 | + self._win.addstr( |
| 1161 | + Y, 3 + len(val[1][0]), |
| 1162 | + str(t) + ' ', curses.color_pair(6)) |
| 1163 | + self._print_title() |
| 1164 | + self._win.refresh() |
| 1165 | + return -1, [] |
| 1166 | + |
1126 | 1167 | if char in (curses.KEY_ENTER, ord('\n'), ord('\r'), |
1127 | 1168 | kbkey['pause'], kbkey['l'], curses.KEY_RIGHT) or \ |
1128 | 1169 | check_localized(char, (kbkey['l'], kbkey['pause'])): |
|
0 commit comments