Skip to content

Commit b2318e9

Browse files
committed
cleaning up old playist validation code
1 parent 241860a commit b2318e9

File tree

5 files changed

+18
-320
lines changed

5 files changed

+18
-320
lines changed

pyradio/config.py

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ def __init__(self, stationFile='', user_config_dir=None):
115115
self.foreign_copy_asked = False
116116
self.added_stations = 0
117117
self._is_register = False
118-
self.check_playlist = None
119118

120119
''' True if playlist not in config dir '''
121120
self.foreign_file = False
@@ -1262,8 +1261,6 @@ class PyRadioConfig(PyRadioStations):
12621261
)
12631262

12641263
def _init_vars(self):
1265-
self.check_playlist = False
1266-
12671264
''' if debug is on, this will tell the logger to
12681265
0: not log input from the player
12691266
1: input accepted input from the player
@@ -2318,12 +2315,7 @@ def _read_localized_shortcuts(self, name=None):
23182315
# logger.error('\n\nsetting lkbkey 1\n{}\n\n'.format(reversed_dict))
23192316
set_lkbkey(reversed_dict)
23202317

2321-
def read_config(self, distro_config=False, check_playlist=False):
2322-
if check_playlist:
2323-
if self._i_created_the_lock_file:
2324-
self.remove_session_lock_file()
2325-
self.locked = True
2326-
self.check_playlist = check_playlist
2318+
def read_config(self, distro_config=False):
23272319
self._read_config(distro_config=True)
23282320
self.config_opts = deepcopy(self.opts)
23292321
# for n in self.config_opts.items():
@@ -2609,16 +2601,6 @@ def _read_config(self, distro_config=False):
26092601
self.opts['dirty_config'][1] = False
26102602
self.saved_params = deepcopy(self.params)
26112603

2612-
if self.check_playlist:
2613-
self._headless = None
2614-
self._distro = 'Check Playlist Mode'
2615-
self.opts['enable_notifications'][1] = '-1'
2616-
self.opts['remote_control_server_auto_start'][1] = False
2617-
self.opts['enable_clock'][1] = False
2618-
self.opts['auto_update_theme'][1] = False
2619-
self.opts['enable_clock'][1] = True
2620-
self.opts['time_format'][1] = 0
2621-
26222604
if self.headless:
26232605
self.opts['remote_control_server_ip'][1], self.opts['remote_control_server_port'][1] = to_ip_port(self._headless)
26242606
self.opts['remote_control_server_auto_start'][1] = True
@@ -2965,12 +2947,6 @@ def save_config(self, from_command_line=False):
29652947
0: Config saved successfully
29662948
1: Config not saved (not modified)
29672949
TODO: 2: Config not saved (session locked) '''
2968-
if self.check_playlist:
2969-
if not from_command_line and \
2970-
logger.isEnabledFor(logging.INFO):
2971-
logger.info('Not saving Config (checking playlist mode activated)')
2972-
return 1
2973-
29742950
if self.locked:
29752951
if not from_command_line and \
29762952
logger.isEnabledFor(logging.INFO):
@@ -3635,15 +3611,7 @@ def configure_logger(self, recording_dir=None, debug=None, titles=None):
36353611
if debug or titles:
36363612
if debug and not self.log_debug:
36373613
# Handler
3638-
if self._cnf.check_playlist:
3639-
if self._cnf.check_output_folder is None:
3640-
ret = self._create_check_output_folder()
3641-
if not ret:
3642-
return False
3643-
log_file = path.join(self._cnf.check_output_folder, 'pyradio.log')
3644-
self._cnf.check_output_file = log_file
3645-
else:
3646-
log_file = path.join(path.expanduser('~'), 'pyradio.log')
3614+
log_file = path.join(path.expanduser('~'), 'pyradio.log')
36473615
self.debug_handler = logging.FileHandler(log_file)
36483616
self.debug_handler.setLevel(logging.DEBUG)
36493617

pyradio/log.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,6 @@ def __init__(self,
290290

291291
self._stop_using_buffering_msg = False
292292

293-
if config.check_playlist:
294-
self._check_start_time = datetime.datetime.now()
295-
logger.error(f'{self._check_start_time = }')
296293
self._current_msg_id = STATES.RESET
297294
self._current_player_id = current_player_id
298295
self._active_player_id = active_player_id
@@ -627,9 +624,9 @@ def write(self,
627624
if msg:
628625
msg = fix_chars(msg)
629626
if msg_id in (STATES.PLAY, STATES.TITLE):
630-
self.set_win_title(d_msg if d_msg else msg, is_checking_playlist=self._cnf.check_playlist)
627+
self.set_win_title(d_msg if d_msg else msg)
631628
elif msg_id not in (STATES.ANY, STATES.VOLUME, STATES.BUFF_MSG):
632-
self.set_win_title(is_checking_playlist=self._cnf.check_playlist)
629+
self.set_win_title()
633630
self._write_title_to_log(msg if msg else 'No')
634631
self._show_notification(msg)
635632
self._set_web_title(msg)
@@ -1086,7 +1083,7 @@ def _restore_startup_window_title(self):
10861083
stdout.flush()
10871084

10881085
@staticmethod
1089-
def set_win_title(msg=None, is_checking_playlist=None):
1086+
def set_win_title(msg=None):
10901087
default = M_STRINGS['win-title']
10911088
# just_return = (
10921089
# 'Config saved',
@@ -1153,9 +1150,7 @@ def set_win_title(msg=None, is_checking_playlist=None):
11531150
# if logger.isEnabledFor(logging.DEBUG):
11541151
# logger.debug('set_win_title(): d_msg = "' + d_msg + '"')
11551152

1156-
if is_checking_playlist:
1157-
d_msg += M_STRINGS['checking-playlist']
1158-
elif token_id == 0 and Log.locked:
1153+
if token_id == 0 and Log.locked:
11591154
d_msg += M_STRINGS['session-locked']
11601155

11611156
if platform.lower().startswith('win'):

pyradio/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@ def shell():
11531153
win_title = M_STRINGS['session-locked']
11541154
else:
11551155
win_title = None
1156-
Log.set_win_title(win_title, args.check_playlist)
1156+
Log.set_win_title(win_title)
11571157
except:
11581158
pass
11591159

0 commit comments

Comments
 (0)