test
This commit is contained in:
parent
3e38cc3a47
commit
53c14d3e90
@ -13,23 +13,8 @@ class OriginChannels():
|
||||
unfiltered_chan_json = urlopn.json()
|
||||
self.fhdhr.logger.info("Found %s Total Channels Lists" % len(unfiltered_chan_json))
|
||||
|
||||
filter_dict = {
|
||||
"country": [],
|
||||
"language": []
|
||||
}
|
||||
|
||||
for filter in ["country", "language"]:
|
||||
|
||||
filterconf = self.fhdhr.config.dict["origin"]["filter_%s" % filter]
|
||||
if filterconf:
|
||||
if isinstance(filterconf, str):
|
||||
filterconf = [filterconf]
|
||||
self.fhdhr.logger.info("Found %s Enabled %s Filters" % (len(filterconf), filter))
|
||||
filter_dict[filter].extend(filterconf)
|
||||
else:
|
||||
self.fhdhr.logger.info("Found No Enabled %s Filters" % (filter))
|
||||
|
||||
print(filter_dict)
|
||||
filtered_chan_list = self.filterlist(unfiltered_chan_json)
|
||||
self.fhdhr.logger.info("Found %s Channels Lists after applying filters." % len(filtered_chan_list))
|
||||
|
||||
return
|
||||
|
||||
@ -37,6 +22,19 @@ class OriginChannels():
|
||||
|
||||
return channel_list
|
||||
|
||||
def filterlist(self, unfiltered_chan_json):
|
||||
filtered_chan_list = []
|
||||
for channels_item in unfiltered_chan_json:
|
||||
for filter_key in list(self.origin.filter_dict.keys()):
|
||||
|
||||
chan_filter_values = []
|
||||
|
||||
if filter_key in ["country", "language"]:
|
||||
for filter_subkey in ["code", "name"]:
|
||||
chan_filter_values.append(channels_item[filter_key][filter_subkey])
|
||||
|
||||
return filtered_chan_list
|
||||
|
||||
def get_channel_stream(self, chandict):
|
||||
streamurl = ""
|
||||
return streamurl
|
||||
|
||||
@ -7,7 +7,23 @@ class OriginService():
|
||||
|
||||
self.channels_json_url = "https://iptv-org.github.io/iptv/channels.json"
|
||||
|
||||
self.m3u_url = "https://iptv-org.github.io/iptv/countries/us.m3u"
|
||||
self.filter_dict = {
|
||||
"country": [],
|
||||
"language": []
|
||||
}
|
||||
self.setup_filters()
|
||||
|
||||
def setup_filters(self):
|
||||
for filter in ["country", "language"]:
|
||||
|
||||
filterconf = self.fhdhr.config.dict["origin"]["filter_%s" % filter]
|
||||
if filterconf:
|
||||
if isinstance(filterconf, str):
|
||||
filterconf = [filterconf]
|
||||
self.fhdhr.logger.info("Found %s Enabled %s Filters" % (len(filterconf), filter))
|
||||
self.filter_dict[filter].extend(filterconf)
|
||||
else:
|
||||
self.fhdhr.logger.info("Found No Enabled %s Filters" % (filter))
|
||||
|
||||
def get_status_dict(self):
|
||||
ret_status_dict = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user