Skip to content

Commit 5995d7c

Browse files
committed
- fixing a theme download regression
- fixing station history rename
1 parent 72234cb commit 5995d7c

File tree

2 files changed

+23
-26
lines changed

2 files changed

+23
-26
lines changed

pyradio/config.py

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,29 +2556,18 @@ def remove_station(self, a_station):
25562556
self.item = len(self.items) - 1
25572557
self._show_station_history_debug()
25582558

2559-
def rename_station(self, orig, new):
2560-
self.remove_station(orig[0])
2561-
# return
2562-
# ''' makes a copy of the item and inserts it back to the
2563-
# list, so that the station will be there regardless
2564-
# of saving or not saving the playlist
2565-
# '''
2566-
# logger.error('orig = "{}"'.format(orig))
2567-
# logger.error('new = "{}"'.format(new))
2568-
# self._show_station_history_debug()
2569-
# for i in range(len(self.items) - 1, -1, -1):
2570-
# if self.items[i][1] == orig:
2571-
# logger.error('item = {}'.format(self.items[i]))
2572-
# an_item = self.items[i][:]
2573-
# logger.error('an_item = {}'.format(an_item))
2574-
# self.items[i][1] = new
2575-
# logger.error('item = {}'.format(self.items[i]))
2576-
# self.items.insert(i, an_item)
2577-
# if i == self.item:
2578-
# self.item += 1
2579-
# if logger.isEnabledFor(logging.DEBUG):
2580-
# logger.debug(' item is = {}'.format(self.item))
2581-
# self._show_station_history_debug()
2559+
def rename_station(self, playlist, orig_station, new_station):
2560+
# logger.error('playlist = "{}"'.format(playlist))
2561+
# logger.error('orig_station = "{}"'.format(orig_station))
2562+
# logger.error('new_station = "{}"'.format(new_station))
2563+
self._show_station_history_debug()
2564+
for i in range(len(self.items) - 1, -1, -1):
2565+
if self.items[i][0] == playlist and \
2566+
self.items[i][1] == orig_station:
2567+
logger.error('item = {}'.format(self.items[i]))
2568+
self.items[i][1] = new_station
2569+
logger.error('item = {}'.format(self.items[i]))
2570+
self._show_station_history_debug()
25822571

25832572
def rename_playlist(self, orig, new):
25842573
self._show_station_history_debug()
@@ -2874,7 +2863,7 @@ def download(self, a_theme=None, a_path=None, print_errors=None):
28742863
self.theme_url = url
28752864
self.status = requests_response.status_code
28762865

2877-
ret = requests_response.status_code == 201 and written
2866+
ret = requests_response.status_code == 200 and written
28782867
if not ret:
28792868
try:
28802869
remove(w_path)

pyradio/radio.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5939,7 +5939,11 @@ def keypress(self, char):
59395939
restart_player = True
59405940

59415941
if self.stations[self.selection] != self._station_editor.new_station:
5942-
self._cnf.stations_history.rename_station(self.stations[self.selection], self._station_editor.new_station)
5942+
self._cnf.stations_history.rename_station(
5943+
self._cnf.station_title,
5944+
self.stations[self.selection][0],
5945+
self._station_editor.new_station[0]
5946+
)
59435947
self._cnf.dirty_playlist = True
59445948
self.stations[self.selection] = self._station_editor.new_station
59455949
if self.selection == self.playing:
@@ -6874,7 +6878,11 @@ def keypress(self, char):
68746878
self._update_status_bar_right()
68756879
icy_data_name = self.player.icy_data('icy-name')
68766880
if char == ord('r') and self.stations[self.playing][0] != icy_data_name:
6877-
self._cnf.stations_history.rename_station(self.stations[self.playing][0], icy_data_name)
6881+
self._cnf.stations_history.rename_station(
6882+
self._cnf.station_title,
6883+
self.stations[self.playing][0],
6884+
icy_data_name
6885+
)
68786886
self.stations[self.playing][0] = icy_data_name
68796887
self._cnf.dirty_playlist = True
68806888
self._last_played_station = self.stations[self.playing]

0 commit comments

Comments
 (0)