@@ -518,6 +518,10 @@ def __init__(self, pyradio_config,
518
518
ord ('~' ): self ._toggle_claculated_colors ,
519
519
ord ('<' ): self ._stations_history_previous ,
520
520
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 ,
521
525
}
522
526
523
527
@@ -875,6 +879,9 @@ def _get_redisplay_index():
875
879
def refreshBody (self , start = 0 ):
876
880
if self .player .ctrl_c_pressed :
877
881
return
882
+ if self ._limited_height_mode or self ._limited_width_mode :
883
+ self ._print_limited_info ()
884
+ return
878
885
self ._update_redisplay_list ()
879
886
end = len (self ._redisplay_list )
880
887
if end == 0 :
@@ -1709,6 +1716,7 @@ def stopPlayer(self,
1709
1716
#self.selections[0][2] = -1
1710
1717
if reset_playing :
1711
1718
self .playing = - 1
1719
+ self .player .process = None
1712
1720
if show_message :
1713
1721
self ._show_player_is_stopped (from_update_thread )
1714
1722
@@ -3726,7 +3734,10 @@ def _align_stations_and_refresh(self,
3726
3734
else :
3727
3735
self .selections [self .ws .NORMAL_MODE ] = [self .selection , self .startPos , self .playing , self ._cnf .stations ]
3728
3736
# 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 ' )
3730
3741
3731
3742
def _show_connect_to_server_message (self ):
3732
3743
''' display a passive message telling the user
@@ -3814,6 +3825,7 @@ def _open_playlist(self, a_url=None):
3814
3825
if logger .isEnabledFor (logging .DEBUG ):
3815
3826
logger .debug ('Opening a playlist or a register...' )
3816
3827
''' open a register '''
3828
+ self .ws .window_mode = self .ws .PLAYLIST_MODE
3817
3829
self ._playlist_in_editor = self ._cnf .register_to_open
3818
3830
if logger .isEnabledFor (logging .DEBUG ):
3819
3831
logger .debug ('opening register: ' + self ._cnf .register_to_open )
@@ -5104,16 +5116,32 @@ def _move_cursor_one_down(self):
5104
5116
self ._handle_cursor_move_down ()
5105
5117
5106
5118
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 ()
5111
5131
5112
5132
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 ()
5117
5145
5118
5146
def _ask_to_save_browser_config_to_exit (self ):
5119
5147
if self ._cnf .online_browser :
@@ -5216,7 +5244,9 @@ def _show_stations_history_notification(self, msg_id):
5216
5244
if self ._limited_height_mode or self ._limited_width_mode :
5217
5245
msg = (
5218
5246
'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...'
5220
5250
)
5221
5251
if self .player .isPlaying ():
5222
5252
self .log .write (msg = msg [msg_id ])
@@ -5226,7 +5256,9 @@ def _show_stations_history_notification(self, msg_id):
5226
5256
else :
5227
5257
msg = (
5228
5258
'___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...___'
5230
5262
)
5231
5263
self ._show_notification_with_delay (
5232
5264
txt = msg [msg_id ],
@@ -5235,20 +5267,24 @@ def _show_stations_history_notification(self, msg_id):
5235
5267
)
5236
5268
5237
5269
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 )
5241
5278
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 ()
5247
5281
5248
5282
def _stations_history_next (self ):
5249
5283
self ._update_status_bar_right (status_suffix = '' )
5250
5284
if int (self ._cnf .connection_timeout_int ) == 0 :
5251
5285
self ._show_stations_history_notification (0 )
5286
+ elif self .ws .window_mode == self .ws .PLAYLIST_MODE :
5287
+ self ._show_stations_history_notification (2 )
5252
5288
else :
5253
5289
if self .player .connecting :
5254
5290
self ._show_stations_history_notification (1 )
@@ -6211,9 +6247,6 @@ def keypress(self, char):
6211
6247
''' browser config save canceled '''
6212
6248
self ._exit_browser_config ()
6213
6249
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()):
6217
6250
elif self .ws .operation_mode == self .ws .BROWSER_SEARCH_MODE :
6218
6251
6219
6252
if char in self ._global_functions .keys () and \
@@ -7233,16 +7266,6 @@ def keypress(self, char):
7233
7266
''' uninstall on Windows '''
7234
7267
self ._show_win_remove_old_installation ()
7235
7268
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
-
7246
7269
elif char in (ord ('a' ), ord ('A' )):
7247
7270
self ._reset_status_bar_right ()
7248
7271
if self ._cnf .browsing_station_service : return
@@ -8606,13 +8629,20 @@ def _load_playlist_and_station_from_station_history(self, h_item, func):
8606
8629
logger .error ('==== update outer Body!' )
8607
8630
self .outerBodyWin .box ()
8608
8631
self ._print_body_header ()
8609
- self .outerBodyWin .refresh ()
8632
+ # self.outerBodyWin.refresh()
8610
8633
self .playSelection ()
8611
8634
self ._set_active_stations ()
8612
8635
self ._get_playlists_data_from_playlist_name (h_item [0 ])
8613
8636
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 ()
8616
8646
return
8617
8647
8618
8648
try :
0 commit comments