1
0
Fork 0
mirror of https://github.com/LaQuay/TDTChannels.git synced 2024-11-22 17:03:24 +01:00

add extra info script

This commit is contained in:
Marc 2019-02-02 17:42:08 +01:00
parent c052fc5676
commit d630718241
2 changed files with 16 additions and 10 deletions

View file

@ -1,11 +1,12 @@
class Channel:
def __init__(self, name, web, resolution, logo, epg_id):
def __init__(self, name, web, resolution, logo, epg_id, extra_info):
self.name = name
self.web = web
self.resolution = resolution
self.logo = logo
self.epg_id = epg_id
self.options = []
self.extra_info = extra_info
def add_option(self, format, url):
self.options.append(self.Web(format, url))
@ -25,6 +26,9 @@
def get_options(self):
return self.options
def get_extra_info(self):
return self.extra_info
def __str__(self):
options_string = ""
for option in self.options:
@ -44,7 +48,8 @@
"logo": self.logo,
"resolution": self.resolution,
"epg_id": self.epg_id,
"options": self.__options_to_json__()
"options": self.__options_to_json__(),
"extra_info": self.extra_info
}
def to_m3u8(self, ambit_name, option):

View file

@ -20,14 +20,12 @@ def stringbetweenparantheses(text):
def get_channels_from_part(text):
line_where_first_channel_starts = 15
attributes_per_item = 6
channel_list = []
list_to_iterate = text.split("|")[line_where_first_channel_starts:]
line_where_first_channel_starts = 17
attributes_per_item = 7
list_to_iterate = text.split("|")[line_where_first_channel_starts:-1]
while "\n" in list_to_iterate:
list_to_iterate.remove("\n")
while "\n\n" in list_to_iterate:
list_to_iterate.remove("\n\n")
channel_list = []
for i in range(0, len(list_to_iterate), attributes_per_item):
item_name = list_to_iterate[i].strip()
@ -53,9 +51,12 @@ def get_channels_from_part(text):
if len(item_epg) == 1:
item_epg = ""
item_options = item_options.split(" - ")
item_extra_info = list_to_iterate[i + 6].strip()
if len(item_extra_info) == 1:
item_extra_info = ""
channel = Channel(item_name, item_web, item_resolution, item_logo, item_epg)
channel = Channel(item_name, item_web, item_resolution, item_logo, item_epg, item_extra_info)
item_options = item_options.split(" - ")
if len(item_options) > 0 and item_options[0] != "-":
for option in item_options:
format = (option[1:5]).replace("]", "")