mirror of
https://github.com/fHDHR/fHDHR_NextPVR.git
synced 2025-12-06 05:36:59 -05:00
Add Channel Thumbnail Attribute
This commit is contained in:
parent
3b766f380e
commit
283aee262f
@ -12,9 +12,19 @@ class Channel():
|
||||
channel_id = id_system.get(origin_id)
|
||||
else:
|
||||
channel_id = id_system.assign()
|
||||
self.dict = self.fhdhr.db.get_channel_value(str(channel_id), "dict") or self.create_empty_channel(channel_id)
|
||||
self.dict = self.fhdhr.db.get_channel_value(str(channel_id), "dict") or self.default_dict(channel_id)
|
||||
self.verify_dict()
|
||||
self.fhdhr.db.set_channel_value(self.dict["id"], "dict", self.dict)
|
||||
|
||||
def verify_dict(self):
|
||||
"""Development Purposes
|
||||
Add new Channel dict keys
|
||||
"""
|
||||
default_dict = self.default_dict(self.dict["id"])
|
||||
for key in list(default_dict.keys()):
|
||||
if key not in list(self.dict.keys()):
|
||||
self.dict[key] = default_dict[key]
|
||||
|
||||
def basics(self, channel_info):
|
||||
"""Some Channel Information is Critical"""
|
||||
|
||||
@ -46,16 +56,23 @@ class Channel():
|
||||
if not self.dict["number"]:
|
||||
self.dict["number"] = self.dict["origin_number"]
|
||||
|
||||
if "thumbnail" not in list(channel_info.keys()):
|
||||
channel_info["thumbnail"] = None
|
||||
self.dict["origin_thumbnail"] = channel_info["thumbnail"]
|
||||
if not self.dict["thumbnail"]:
|
||||
self.dict["thumbnail"] = self.dict["origin_thumbnail"]
|
||||
|
||||
self.fhdhr.db.set_channel_value(self.dict["id"], "dict", self.dict)
|
||||
|
||||
def create_empty_channel(self, channel_id):
|
||||
def default_dict(self, channel_id):
|
||||
return {
|
||||
"id": str(channel_id), "origin_id": None,
|
||||
"name": None, "origin_name": None,
|
||||
"callsign": None, "origin_callsign": None,
|
||||
"number": None, "origin_number": None,
|
||||
"tags": [], "origin_tags": [],
|
||||
"enabled": True
|
||||
"enabled": True,
|
||||
"thumbnail": None, "origin_thumbnail": None
|
||||
}
|
||||
|
||||
def destroy(self):
|
||||
|
||||
@ -8,6 +8,15 @@ class OriginChannels():
|
||||
self.fhdhr = fhdhr
|
||||
self.origin = origin
|
||||
|
||||
def get_channel_thumbnail(self, channel_id):
|
||||
channel_thumb_url = ("%s%s:%s/service?method=channel.icon&channel_id=%s" %
|
||||
("https://" if self.fhdhr.config.dict["origin"]["ssl"] else "http://",
|
||||
self.fhdhr.config.dict["origin"]["address"],
|
||||
str(self.fhdhr.config.dict["origin"]["port"]),
|
||||
str(channel_id)
|
||||
))
|
||||
return channel_thumb_url
|
||||
|
||||
def get_channels(self):
|
||||
|
||||
data_url = ('%s%s:%s/service?method=channel.list&sid=%s' %
|
||||
@ -36,6 +45,7 @@ class OriginChannels():
|
||||
"callsign": channel_dict["name"],
|
||||
"number": channel_dict["formatted-number"],
|
||||
"id": channel_dict["id"],
|
||||
"thumbnail": self.get_channel_thumbnail(channel_dict["id"])
|
||||
}
|
||||
channel_list.append(clean_station_item)
|
||||
return channel_list
|
||||
|
||||
Loading…
Reference in New Issue
Block a user