@@ -148,15 +148,21 @@ class SelectPlayer(object):
148
148
X = Y = maxX = maxY = 0
149
149
_win = _parent = None
150
150
151
- _players = {
152
- 'mpv' : ' MPV Media Player' ,
153
- 'mplayer' : ' MPlayer Media Player' ,
154
- 'vlc' : ' VLC Media Player' ,
155
- }
156
151
157
- def __init__ (self , active_player , parent ):
152
+ def __init__ (self , active_player , parent , recording ):
153
+ self ._players = {
154
+ 'mpv' : ' MPV Media Player' ,
155
+ 'mplayer' : ' MPlayer Media Player' ,
156
+ 'vlc' : ' VLC Media Player' ,
157
+ }
158
158
self ._selected = 0
159
159
self ._active_player = active_player
160
+ self ._recording = recording
161
+ self ._no_vlc = False
162
+ if recording > 0 and \
163
+ platform .startswith ('win' ):
164
+ self ._players ['vlc' ] += ' (Not Supported)'
165
+ self ._no_vlc = True
160
166
self ._available_players = [x .PLAYER_NAME for x in player .available_players if x .PLAYER_NAME != self ._active_player ]
161
167
if logger .isEnabledFor (logging .DEBUG ):
162
168
logger .debug ('available players = {}' .format (player .available_players ))
@@ -234,8 +240,10 @@ def keypress(self, char):
234
240
ord ('s' ), ord (' ' ),
235
241
ord ('l' ), curses .KEY_RIGHT
236
242
):
237
- return self ._available_players [self ._selected ]
238
- elif char in (ord ('h' ), ord ('q' ), curses .KEY_EXIT , 27 ):
243
+ if not self ._no_vlc :
244
+ return self ._available_players [self ._selected ]
245
+ elif char in (ord ('h' ), curses .KEY_LEFT ,
246
+ ord ('q' ), curses .KEY_EXIT , 27 ):
239
247
return None
240
248
return ''
241
249
@@ -566,6 +574,7 @@ def __init__(self, pyradio_config,
566
574
self .ws .GROUP_SELECTION_MODE : self ._show_group_selection ,
567
575
self .ws .GROUP_HELP_MODE : self ._show_group_help ,
568
576
self .ws .RECORD_WINDOW_MODE : self ._show_recording_toggle_window ,
577
+ self .ws .WIN_VLC_NO_RECORD_MODE : self ._show_win_no_record ,
569
578
}
570
579
571
580
''' list of help functions '''
@@ -6236,15 +6245,34 @@ def _ask_to_save_browser_config_from_browser(self):
6236
6245
prompt = '' ,
6237
6246
is_message = True )
6238
6247
6248
+ def _show_win_no_record (self ):
6249
+ txt = '''
6250
+ |VLC| on |Windows| does not support recording.
6251
+
6252
+ If you really need to record a station, please use one
6253
+ of the other two supported players, preferably |MPV|.
6254
+
6255
+ To use one of them (|MPV| or |MPlayer|), close this window
6256
+ and press |\m| to activate it.
6257
+
6258
+ If none of them is installed, close this window and
6259
+ press |F8| to get to the player installation window.
6260
+ '''
6261
+ self ._show_help (txt ,
6262
+ mode_to_set = self .ws .WIN_VLC_NO_RECORD_MODE ,
6263
+ caption = ' Recording not supported! ' ,
6264
+ prompt = '' ,
6265
+ is_message = True )
6266
+
6239
6267
def _show_recording_toggle_window (self ):
6240
6268
if self .player .recording > 0 :
6241
6269
caption = ' Recording Enable '
6242
6270
txt = ''' _____Next time you play a station,
6243
6271
_____it will be |written to a file|!
6244
6272
6245
- A [|r|] at the right top corner of the
6246
- window indicates that recording is |enabled|.
6247
- A [|R|] indicates that a station is actually
6273
+ A |[r]| at the right top corner of the window
6274
+ indicates that recording is |enabled|.
6275
+ A |[R]| indicates that a station is actually
6248
6276
|being recorded| to a file.
6249
6277
'''
6250
6278
else :
@@ -6709,7 +6737,8 @@ def keypress(self, char):
6709
6737
self .ws .operation_mode = self .ws .CHANGE_PLAYER_MODE
6710
6738
self ._change_player = SelectPlayer (
6711
6739
active_player = self .player .PLAYER_NAME ,
6712
- parent = self .bodyWin
6740
+ parent = self .bodyWin ,
6741
+ recording = self .player .recording
6713
6742
)
6714
6743
self ._change_player .show ()
6715
6744
@@ -7024,7 +7053,9 @@ def keypress(self, char):
7024
7053
self ._add_station_to_stations_history ,
7025
7054
self ._recording_lock
7026
7055
)
7027
- self .player .recording = to_record
7056
+ if not (self .player .PLAYER_NAME == 'vlc' and \
7057
+ platform .startswith ('win' )):
7058
+ self .player .recording = to_record
7028
7059
self .log .display_help_message = False
7029
7060
self .log .write (ret + ': Player activated!!!' , help_msg = False , suffix = '' )
7030
7061
self .player .volume = - 1
@@ -7033,6 +7064,7 @@ def keypress(self, char):
7033
7064
self .setStation (to_play )
7034
7065
self .playSelection ()
7035
7066
self .refreshBody ()
7067
+ self ._change_player = None
7036
7068
7037
7069
elif self .ws .operation_mode == self .ws .REMOTE_CONTROL_SERVER_ACTIVE_MODE :
7038
7070
if char == ord ('s' ):
@@ -8627,7 +8659,10 @@ def keypress(self, char):
8627
8659
if char == ord ('|' ):
8628
8660
self ._reset_status_bar_right ()
8629
8661
# if self.player.PLAYER_NAME != 'vlc':
8630
- if self .player .PLAYER_NAME :
8662
+ if self .player .PLAYER_NAME == 'vlc' and \
8663
+ platform .startswith ('win' ):
8664
+ self ._show_win_no_record ()
8665
+ else :
8631
8666
self .player .recording = 1 if self .player .recording == 0 else 0
8632
8667
if self .player .recording > 0 :
8633
8668
if self .player .isPlaying ():
@@ -8638,8 +8673,6 @@ def keypress(self, char):
8638
8673
self .player .already_playing = False
8639
8674
self ._show_recording_status_in_header ()
8640
8675
self ._show_recording_toggle_window ()
8641
- else :
8642
- self ._print_not_implemented_yet ()
8643
8676
8644
8677
elif char == curses .ascii .BEL :
8645
8678
''' ^G - show groups '''
0 commit comments