Skip to content

Commit 6de9a40

Browse files
committed
\l will toggle the "Open last playlist" config setting
1 parent 0410406 commit 6de9a40

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

pyradio/config.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,10 @@ def open_last_playlist(self):
13801380

13811381
@open_last_playlist.setter
13821382
def open_last_playlist(self, val):
1383-
raise ValueError('parameter is read only')
1383+
old_val = self.opts['open_last_playlist'][1]
1384+
self.opts['open_last_playlist'][1] = val
1385+
if old_val != val:
1386+
self.dirty_config = True
13841387

13851388
@property
13861389
def distro(self):
@@ -2329,7 +2332,7 @@ def save_config(self, from_command_line=False):
23292332
# Open last playlist
23302333
# If this option is enabled, the last opened playlist will be opened
23312334
# the next time PyRadio is opened. This option will take precedence
2332-
# over the "Def. playlist" option.
2335+
# over the "Def. playlist" option and the "-s" commans line parameter.
23332336
# Default value: False
23342337
open_last_playlist = {1}
23352338

pyradio/config_window.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class PyRadioConfigWindow(object):
5454
'This is the eqivelant to the -u , --use-player command line option.', '|',
5555
'Example:', ' player = vlc', 'or', ' player = vlc,mpv, mplayer', '|',
5656
'Default value: mpv,mplayer,vlc'])
57-
_help_text.append(['If this option is enabled, the last local playlist loaded before terminating, will be automatically opened the next time PyRadio is executed.', '|', 'Furthermore, playback will resume, if it was on when PyRadio exited. Otherwise, station selection will be restored.', '|', 'This option will take precedence over the "Def. playlist" configuration option and the "-s" command line option.', '|', 'Default value: False'])
57+
_help_text.append(['If this option is enabled, the last local playlist loaded before terminating, will be automatically opened the next time PyRadio is executed. Furthermore, playback will resume, if it was on when PyRadio exited. Otherwise, station selection will be restored.', '|', 'This option will take precedence over the "Def. playlist" configuration option and the "-s" command line option.', '|', 'It can also be toggled on the fly by perssing \\l while on Main mode.', '|', 'Default value: False'])
5858
_help_text.append(['This is the playlist to open at start up, if none is specified and "Open last playlist" is not set.', '|',
5959
'This is the equivalent to the -s, --stations command line option.', '|',
6060
'Default value: stations'])

pyradio/radio.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3379,6 +3379,7 @@ def _show_extra_commands_help(self):
33793379
self.ws.previous_operation_mode == self.ws.NORMAL_MODE):
33803380
txt = '''\\ |Open previous playlist.
33813381
] |Open first opened playlist.
3382+
l |Toggle |Open last playlist|.
33823383
m |Cahnge |m|edia player.
33833384
n |Create a |n|ew playlist.
33843385
p |Select playlist/register to |p|aste to.
@@ -6843,6 +6844,16 @@ def keypress(self, char):
68436844
self._rename_playlist_dialog.show()
68446845
self.ws.operation_mode = self.ws.CREATE_PLAYLIST_MODE
68456846

6847+
elif char == ord('l'):
6848+
self._update_status_bar_right(status_suffix='')
6849+
self._cnf.open_last_playlist = not self._cnf.open_last_playlist
6850+
self._show_notification_with_delay(
6851+
txt='___Open last playlist set to {}___'.format(
6852+
self._cnf.open_last_playlist
6853+
),
6854+
mode_to_set=self.ws.operation_mode,
6855+
callback_function=self.refreshBody)
6856+
68466857
elif char == ord('p'):
68476858
''' paste '''
68486859
self._update_status_bar_right(status_suffix='')

0 commit comments

Comments
 (0)