Skip to content

Commit da60da1

Browse files
committed
removing ungetch from playlist reload
1 parent c6d6612 commit da60da1

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

pyradio/radio.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6089,6 +6089,21 @@ def _show_remote_control_server_active(self):
60896089
is_message=True
60906090
)
60916091

6092+
def _reload_playlist_after_confirmation(self, char=121):
6093+
if char in (ord('y'), ord('Y')):
6094+
if not self._cnf.locked and char == ord('Y'):
6095+
self._cnf.confirm_playlist_reload = False
6096+
self.reloadCurrentPlaylist(self.ws.PLAYLIST_DIRTY_RELOAD_CONFIRM_MODE)
6097+
self.ws.close_window()
6098+
self.refreshBody()
6099+
else:
6100+
''' close confirmation message '''
6101+
self.stations = self._cnf.stations
6102+
if logger.isEnabledFor(logging.DEBUG):
6103+
logger.debug('Canceling Playlist Reload')
6104+
self.ws.close_window()
6105+
self.refreshBody()
6106+
60926107
def _remove_station(self, char=121):
60936108
''' removes a station
60946109
char=121 is ord('y')
@@ -7879,19 +7894,7 @@ def keypress(self, char):
78797894
if char in self._global_functions.keys():
78807895
self._global_functions[char]()
78817896
return
7882-
if char in (ord('y'), ord('Y')):
7883-
if not self._cnf.locked and char == ord('Y'):
7884-
self._cnf.confirm_playlist_reload = False
7885-
self.reloadCurrentPlaylist(self.ws.PLAYLIST_DIRTY_RELOAD_CONFIRM_MODE)
7886-
self.ws.close_window()
7887-
self.refreshBody()
7888-
else:
7889-
''' close confirmation message '''
7890-
self.stations = self._cnf.stations
7891-
if logger.isEnabledFor(logging.DEBUG):
7892-
logger.debug('Canceling Playlist Reload')
7893-
self.ws.close_window()
7894-
self.refreshBody()
7897+
self._reload_playlist_after_confirmation(char)
78957898
return
78967899

78977900
elif self.ws.operation_mode == self.ws.REMOVE_STATION_MODE:
@@ -8394,13 +8397,13 @@ def keypress(self, char):
83948397
self._print_playlist_dirty_reload_confirmation()
83958398
else:
83968399
self.ws.operation_mode = self.ws.PLAYLIST_RELOAD_CONFIRM_MODE
8397-
curses.ungetch('y')
8400+
self._reload_playlist_after_confirmation(char)
83988401
else:
83998402
if not self._cnf.is_register and self._cnf.confirm_playlist_reload:
84008403
self._print_playlist_reload_confirmation()
84018404
else:
84028405
self.ws.operation_mode = self.ws.PLAYLIST_RELOAD_CONFIRM_MODE
8403-
curses.ungetch('y')
8406+
self._reload_playlist_after_confirmation(char)
84048407
return
84058408

84068409
elif char in (ord('z'), ):

0 commit comments

Comments
 (0)