Skip to content

Commit 4d42c8c

Browse files
committed
Fix notification setting resetting to 0
'0' and '1' are valid inputs in the config file but followed the logic of the 'try' block and thus if the user set -1, it would change to 0. With this change, '0' and '1' remain the same, and only if the value is not either of them will the try/except block run.
1 parent 946a476 commit 4d42c8c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pyradio/config.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,12 +1947,13 @@ def read_config(self):
19471947
else:
19481948
self.opts['enable_mouse'][1] = True
19491949
elif sp[0] == 'enable_notifications':
1950-
# if not (sp[1] in ('0', '-1')):
1951-
try:
1952-
t = int(int(sp[1]) / 30)
1953-
self.opts['enable_notifications'][1] = str(t * 30)
1954-
except (ValueError, TypeError):
1955-
self.opts['enable_notifications'][1] = '-1'
1950+
self.opts['enable_notifications'][1] = sp[1]
1951+
if sp[1] not in ('0', '-1'):
1952+
try:
1953+
t = int(int(sp[1]) / 30)
1954+
self.opts['enable_notifications'][1] = str(t * 30)
1955+
except (ValueError, TypeError):
1956+
self.opts['enable_notifications'][1] = '-1'
19561957
elif sp[0] == 'confirm_station_deletion':
19571958
if sp[1].lower() == 'false':
19581959
self.opts['confirm_station_deletion'][1] = False

0 commit comments

Comments
 (0)