test
This commit is contained in:
parent
d5363522c2
commit
2d5ca0d90d
@ -18,6 +18,10 @@ class OriginChannels():
|
|||||||
|
|
||||||
def get_channels(self):
|
def get_channels(self):
|
||||||
|
|
||||||
|
channel_list = []
|
||||||
|
|
||||||
|
channel_ids = []
|
||||||
|
|
||||||
station_locations = ["national", "abc3340"]
|
station_locations = ["national", "abc3340"]
|
||||||
|
|
||||||
station_by_state_opn = self.fhdhr.web.session.get(self.base_station_url)
|
station_by_state_opn = self.fhdhr.web.session.get(self.base_station_url)
|
||||||
@ -30,23 +34,26 @@ class OriginChannels():
|
|||||||
state_url_req = self.fhdhr.web.session.get(state_url)
|
state_url_req = self.fhdhr.web.session.get(state_url)
|
||||||
state_url_json = state_url_req.json()
|
state_url_json = state_url_req.json()
|
||||||
for item in state_url_json["rss"]["channel"]["pagecomponent"]["component"]:
|
for item in state_url_json["rss"]["channel"]["pagecomponent"]["component"]:
|
||||||
print(item["item"]["media:content"]['sinclair:action_value'])
|
stationitem = item["item"]["media:content"]['sinclair:action_value']
|
||||||
return []
|
if stationitem not in station_locations:
|
||||||
|
station_locations.append(stationitem)
|
||||||
|
|
||||||
chan_list_url = "%s/channels/stirr?station=national" % (self.base_api_url)
|
for station_item in station_locations:
|
||||||
|
|
||||||
|
chan_list_url = "%s/channels/stirr?station=%s" % (self.base_api_url, station_item)
|
||||||
chan_list_urlopn = self.fhdhr.web.session.get(chan_list_url)
|
chan_list_urlopn = self.fhdhr.web.session.get(chan_list_url)
|
||||||
stirr_chan_list = chan_list_urlopn.json()
|
stirr_chan_list = chan_list_urlopn.json()
|
||||||
|
|
||||||
channel_list = []
|
|
||||||
# chanindex = 0
|
|
||||||
for channel_dict in stirr_chan_list["channel"]:
|
for channel_dict in stirr_chan_list["channel"]:
|
||||||
|
|
||||||
# chanindex += 1
|
if str(channel_dict["id"]) not in channel_ids:
|
||||||
|
|
||||||
chan_item_url = "%s/status/%s" % (self.base_api_url, str(channel_dict["id"]))
|
chan_item_url = "%s/status/%s" % (self.base_api_url, str(channel_dict["id"]))
|
||||||
chan_item_urlopn = self.fhdhr.web.session.get(chan_item_url)
|
chan_item_urlopn = self.fhdhr.web.session.get(chan_item_url)
|
||||||
stirr_chan_item = chan_item_urlopn.json()
|
stirr_chan_item = chan_item_urlopn.json()
|
||||||
|
|
||||||
|
channel_ids.append(str(channel_dict["id"]))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
thumbnail = channel_dict["icon"]["src"].split("?")[0]
|
thumbnail = channel_dict["icon"]["src"].split("?")[0]
|
||||||
except TypeError:
|
except TypeError:
|
||||||
@ -55,7 +62,6 @@ class OriginChannels():
|
|||||||
clean_station_item = {
|
clean_station_item = {
|
||||||
"name": stirr_chan_item['rss']["channel"]["title"],
|
"name": stirr_chan_item['rss']["channel"]["title"],
|
||||||
"callsign": channel_dict["display-name"],
|
"callsign": channel_dict["display-name"],
|
||||||
# "number": chanindex,
|
|
||||||
"id": str(channel_dict["id"]),
|
"id": str(channel_dict["id"]),
|
||||||
"thumbnail": thumbnail
|
"thumbnail": thumbnail
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user