Skip to content

Commit 678b32e

Browse files
committed
Use the playlist resolver also in custom stations
1 parent 63fce09 commit 678b32e

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

resources/lib/api.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,17 @@ def get_station_by_station_id(self, station_id, resolve_playlists=True, force_ht
130130
stations = (station, )
131131
return self.__format_stations_v2(stations)[0]
132132

133+
def internal_resolver(self, station, ):
134+
if station.get('is_custom', False):
135+
stream_url = station['stream_url']
136+
else:
137+
stream_url = station['streamUrl']
138+
139+
if self.__check_paylist(stream_url):
140+
return self.__resolve_playlist(station)
141+
else:
142+
return station
143+
133144
def get_top_stations(self, sizeperpage, pageindex):
134145
self.log(('get_top_stations started with '
135146
'sizeperpage=%s, pageindex=%s') % (
@@ -250,7 +261,13 @@ def __resolve_playlist(self, station):
250261
self.log('__resolve_playlist started with station=%s'
251262
% station['id'])
252263
servers = []
253-
stream_url = station['streamUrl']
264+
265+
# Check if it is a custom station
266+
if station.get('is_custom', False):
267+
stream_url = station['stream_url']
268+
else:
269+
stream_url = station['streamUrl']
270+
254271
if stream_url.lower().endswith('m3u'):
255272
response = self.__urlopen(stream_url)
256273
self.log('__resolve_playlist found .m3u file')

resources/lib/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ def sub_menu_entry(option, category, value, page=1):
476476
def get_stream_url(station_id):
477477
if my_stations.get(station_id, {}).get('is_custom', False):
478478
station = my_stations[station_id]
479-
stream_url = station['stream_url']
479+
stream_url = radio_api.internal_resolver(station)
480480
current_track = ''
481481
else:
482482
station = radio_api.get_station_by_station_id(

0 commit comments

Comments
 (0)