@@ -518,6 +518,10 @@ def __init__(self, pyradio_config,
518518 ord ('~' ): self ._toggle_claculated_colors ,
519519 ord ('<' ): self ._stations_history_previous ,
520520 ord ('>' ): self ._stations_history_next ,
521+ curses .ascii .DLE : self ._play_previous_station ,
522+ curses .KEY_PREVIOUS : self ._play_previous_station ,
523+ curses .ascii .SO : self ._play_next_station ,
524+ curses .KEY_NEXT : self ._play_next_station ,
521525 }
522526
523527
@@ -875,6 +879,9 @@ def _get_redisplay_index():
875879 def refreshBody (self , start = 0 ):
876880 if self .player .ctrl_c_pressed :
877881 return
882+ if self ._limited_height_mode or self ._limited_width_mode :
883+ self ._print_limited_info ()
884+ return
878885 self ._update_redisplay_list ()
879886 end = len (self ._redisplay_list )
880887 if end == 0 :
@@ -1709,6 +1716,7 @@ def stopPlayer(self,
17091716 #self.selections[0][2] = -1
17101717 if reset_playing :
17111718 self .playing = - 1
1719+ self .player .process = None
17121720 if show_message :
17131721 self ._show_player_is_stopped (from_update_thread )
17141722
@@ -3726,7 +3734,10 @@ def _align_stations_and_refresh(self,
37263734 else :
37273735 self .selections [self .ws .NORMAL_MODE ] = [self .selection , self .startPos , self .playing , self ._cnf .stations ]
37283736 # self.ll('_align_stations_and_refresh')
3729- self .refreshBody ()
3737+ if self .ws .operation_mode == self .ws .NORMAL_MODE :
3738+ self .refreshBody ()
3739+ else :
3740+ logger .error ('\n \n 2 not refreshing\n \n ' )
37303741
37313742 def _show_connect_to_server_message (self ):
37323743 ''' display a passive message telling the user
@@ -3814,6 +3825,7 @@ def _open_playlist(self, a_url=None):
38143825 if logger .isEnabledFor (logging .DEBUG ):
38153826 logger .debug ('Opening a playlist or a register...' )
38163827 ''' open a register '''
3828+ self .ws .window_mode = self .ws .PLAYLIST_MODE
38173829 self ._playlist_in_editor = self ._cnf .register_to_open
38183830 if logger .isEnabledFor (logging .DEBUG ):
38193831 logger .debug ('opening register: ' + self ._cnf .register_to_open )
@@ -5104,16 +5116,32 @@ def _move_cursor_one_down(self):
51045116 self ._handle_cursor_move_down ()
51055117
51065118 def _play_next_station (self ):
5107- self .selection = self .playing
5108- self ._move_cursor_one_down ()
5109- self .playSelection ()
5110- self .refreshBody ()
5119+ self ._reset_status_bar_right ()
5120+ if self .ws .window_mode == self .ws .PLAYLIST_MODE :
5121+ self ._show_stations_history_notification (2 )
5122+ elif not self .player .isPlaying ():
5123+ self ._show_stations_history_notification (3 )
5124+ elif self .player .connecting :
5125+ self ._show_stations_history_notification (1 )
5126+ else :
5127+ self .selection = self .playing
5128+ self ._move_cursor_one_down ()
5129+ self .playSelection ()
5130+ self .refreshBody ()
51115131
51125132 def _play_previous_station (self ):
5113- self .selection = self .playing
5114- self ._move_cursor_one_up ()
5115- self .playSelection ()
5116- self .refreshBody ()
5133+ self ._reset_status_bar_right ()
5134+ if self .ws .window_mode == self .ws .PLAYLIST_MODE :
5135+ self ._show_stations_history_notification (2 )
5136+ elif not self .player .isPlaying ():
5137+ self ._show_stations_history_notification (3 )
5138+ elif self .player .connecting :
5139+ self ._show_stations_history_notification (1 )
5140+ else :
5141+ self .selection = self .playing
5142+ self ._move_cursor_one_up ()
5143+ self .playSelection ()
5144+ self .refreshBody ()
51175145
51185146 def _ask_to_save_browser_config_to_exit (self ):
51195147 if self ._cnf .online_browser :
@@ -5216,7 +5244,9 @@ def _show_stations_history_notification(self, msg_id):
52165244 if self ._limited_height_mode or self ._limited_width_mode :
52175245 msg = (
52185246 'Operation not supported' ,
5219- 'Please wait for the player to settle...'
5247+ 'Please wait for the player to settle...' ,
5248+ 'Operation supported in stations mode only...'
5249+ 'Player not playing...'
52205250 )
52215251 if self .player .isPlaying ():
52225252 self .log .write (msg = msg [msg_id ])
@@ -5226,7 +5256,9 @@ def _show_stations_history_notification(self, msg_id):
52265256 else :
52275257 msg = (
52285258 '___Operation not suported!!!___\n ____Connection timeout is 0 ' ,
5229- '___Please wait for the player___\n __________to settle'
5259+ '___Please wait for the player___\n __________to settle' ,
5260+ '___Operation supported in___\n _____station mode only___' ,
5261+ '___Player not playing...___'
52305262 )
52315263 self ._show_notification_with_delay (
52325264 txt = msg [msg_id ],
@@ -5235,20 +5267,24 @@ def _show_stations_history_notification(self, msg_id):
52355267 )
52365268
52375269 def _stations_history_previous (self ):
5238- self ._update_status_bar_right (status_suffix = '' )
5239- if int (self ._cnf .connection_timeout_int ) == 0 :
5240- self ._show_stations_history_notification (0 )
5270+ self ._update_status_bar_right (status_suffix = '' )
5271+ if int (self ._cnf .connection_timeout_int ) == 0 :
5272+ self ._show_stations_history_notification (0 )
5273+ elif self .ws .window_mode == self .ws .PLAYLIST_MODE :
5274+ self ._show_stations_history_notification (2 )
5275+ else :
5276+ if self .player .connecting :
5277+ self ._show_stations_history_notification (1 )
52415278 else :
5242- if self .player .connecting :
5243- self ._show_stations_history_notification (1 )
5244- else :
5245- self ._cnf .play_from_history = True
5246- self ._cnf .stations_history .play_previous ()
5279+ self ._cnf .play_from_history = True
5280+ self ._cnf .stations_history .play_previous ()
52475281
52485282 def _stations_history_next (self ):
52495283 self ._update_status_bar_right (status_suffix = '' )
52505284 if int (self ._cnf .connection_timeout_int ) == 0 :
52515285 self ._show_stations_history_notification (0 )
5286+ elif self .ws .window_mode == self .ws .PLAYLIST_MODE :
5287+ self ._show_stations_history_notification (2 )
52525288 else :
52535289 if self .player .connecting :
52545290 self ._show_stations_history_notification (1 )
@@ -6211,9 +6247,6 @@ def keypress(self, char):
62116247 ''' browser config save canceled '''
62126248 self ._exit_browser_config ()
62136249
6214- # elif self.ws.operation_mode == self.ws.BROWSER_SEARCH_MODE and \
6215- # (char not in self._chars_to_bypass_on_editor or \
6216- # self._cnf._online_browser.line_editor_has_focus()):
62176250 elif self .ws .operation_mode == self .ws .BROWSER_SEARCH_MODE :
62186251
62196252 if char in self ._global_functions .keys () and \
@@ -7233,16 +7266,6 @@ def keypress(self, char):
72337266 ''' uninstall on Windows '''
72347267 self ._show_win_remove_old_installation ()
72357268
7236- elif self .player .isPlaying () and char in (curses .ascii .SO , curses .KEY_NEXT ):
7237- self ._reset_status_bar_right ()
7238- self ._play_next_station ()
7239- return
7240-
7241- elif self .player .isPlaying () and char in (curses .ascii .DLE , curses .KEY_PREVIOUS ):
7242- self ._reset_status_bar_right ()
7243- self ._play_previous_station ()
7244- return
7245-
72467269 elif char in (ord ('a' ), ord ('A' )):
72477270 self ._reset_status_bar_right ()
72487271 if self ._cnf .browsing_station_service : return
@@ -8606,13 +8629,20 @@ def _load_playlist_and_station_from_station_history(self, h_item, func):
86068629 logger .error ('==== update outer Body!' )
86078630 self .outerBodyWin .box ()
86088631 self ._print_body_header ()
8609- self .outerBodyWin .refresh ()
8632+ # self.outerBodyWin.refresh()
86108633 self .playSelection ()
86118634 self ._set_active_stations ()
86128635 self ._get_playlists_data_from_playlist_name (h_item [0 ])
86138636 self .saved_active_stations = [['' , 0 ], ['' , - 1 ]]
8614- if self ._limited_height_mode or self ._limited_width_mode :
8615- self ._print_limited_info ()
8637+ # if self._limited_height_mode or self._limited_width_mode:
8638+ # self._print_limited_info()
8639+ # else:
8640+ # #if self.ws.operation_mode == self.ws.NORMAL_MODE:
8641+ # # self.refreshBody()
8642+ # #else:
8643+ # # logger.error('\n\n1 not refreshing\n\n')
8644+ # self.refreshBody()
8645+ self .refreshBody ()
86168646 return
86178647
86188648 try :
0 commit comments