mirror of
https://github.com/fHDHR/fHDHR_NextPVR.git
synced 2025-12-06 08:16:58 -05:00
Merge pull request #146 from deathbybandaid/dev
Improve Channel Creation Logic
This commit is contained in:
commit
cbe8deb965
@ -49,10 +49,10 @@ class Channels():
|
|||||||
channel_ids = self.fhdhr.db.get_fhdhr_value("channels", "list") or []
|
channel_ids = self.fhdhr.db.get_fhdhr_value("channels", "list") or []
|
||||||
if len(channel_ids):
|
if len(channel_ids):
|
||||||
self.fhdhr.logger.info("Found %s existing channels in the database." % str(len(channel_ids)))
|
self.fhdhr.logger.info("Found %s existing channels in the database." % str(len(channel_ids)))
|
||||||
for channel_id in channel_ids:
|
for channel_id in channel_ids:
|
||||||
channel_obj = Channel(self.fhdhr, self.id_system, channel_id=channel_id)
|
channel_obj = Channel(self.fhdhr, self.id_system, channel_id=channel_id)
|
||||||
channel_id = channel_obj.dict["id"]
|
channel_id = channel_obj.dict["id"]
|
||||||
self.list[channel_id] = channel_obj
|
self.list[channel_id] = channel_obj
|
||||||
|
|
||||||
def save_db_channels(self):
|
def save_db_channels(self):
|
||||||
channel_ids = [x["id"] for x in self.get_channels()]
|
channel_ids = [x["id"] for x in self.get_channels()]
|
||||||
|
|||||||
@ -12,12 +12,13 @@ def channel_sort(channel_list):
|
|||||||
"""Take a list of channel number strings and sort the Numbers and SubNumbers"""
|
"""Take a list of channel number strings and sort the Numbers and SubNumbers"""
|
||||||
chan_dict_list_split = {}
|
chan_dict_list_split = {}
|
||||||
for number in channel_list:
|
for number in channel_list:
|
||||||
try:
|
if number and number not in ["None"]:
|
||||||
subnumber = number.split(".")[1]
|
try:
|
||||||
except IndexError:
|
subnumber = number.split(".")[1]
|
||||||
subnumber = None
|
except IndexError:
|
||||||
prinumber = number.split(".")[0]
|
subnumber = None
|
||||||
chan_dict_list_split[number] = {"number": prinumber, "subnumber": subnumber}
|
prinumber = number.split(".")[0]
|
||||||
|
chan_dict_list_split[number] = {"number": prinumber, "subnumber": subnumber}
|
||||||
return sorted(chan_dict_list_split, key=lambda i: (int(chan_dict_list_split[i]['number']), int(chan_dict_list_split[i]['subnumber'] or 0)))
|
return sorted(chan_dict_list_split, key=lambda i: (int(chan_dict_list_split[i]['number']), int(chan_dict_list_split[i]['subnumber'] or 0)))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user