mirror of
https://github.com/LaQuay/TDTChannels.git
synced 2024-11-23 01:13:25 +01:00
add extra info script
This commit is contained in:
parent
c052fc5676
commit
d630718241
2 changed files with 16 additions and 10 deletions
|
@ -1,11 +1,12 @@
|
||||||
class Channel:
|
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.name = name
|
||||||
self.web = web
|
self.web = web
|
||||||
self.resolution = resolution
|
self.resolution = resolution
|
||||||
self.logo = logo
|
self.logo = logo
|
||||||
self.epg_id = epg_id
|
self.epg_id = epg_id
|
||||||
self.options = []
|
self.options = []
|
||||||
|
self.extra_info = extra_info
|
||||||
|
|
||||||
def add_option(self, format, url):
|
def add_option(self, format, url):
|
||||||
self.options.append(self.Web(format, url))
|
self.options.append(self.Web(format, url))
|
||||||
|
@ -25,6 +26,9 @@
|
||||||
def get_options(self):
|
def get_options(self):
|
||||||
return self.options
|
return self.options
|
||||||
|
|
||||||
|
def get_extra_info(self):
|
||||||
|
return self.extra_info
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
options_string = ""
|
options_string = ""
|
||||||
for option in self.options:
|
for option in self.options:
|
||||||
|
@ -44,7 +48,8 @@
|
||||||
"logo": self.logo,
|
"logo": self.logo,
|
||||||
"resolution": self.resolution,
|
"resolution": self.resolution,
|
||||||
"epg_id": self.epg_id,
|
"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):
|
def to_m3u8(self, ambit_name, option):
|
||||||
|
|
|
@ -20,14 +20,12 @@ def stringbetweenparantheses(text):
|
||||||
|
|
||||||
|
|
||||||
def get_channels_from_part(text):
|
def get_channels_from_part(text):
|
||||||
line_where_first_channel_starts = 15
|
line_where_first_channel_starts = 17
|
||||||
attributes_per_item = 6
|
attributes_per_item = 7
|
||||||
channel_list = []
|
list_to_iterate = text.split("|")[line_where_first_channel_starts:-1]
|
||||||
list_to_iterate = text.split("|")[line_where_first_channel_starts:]
|
|
||||||
while "\n" in list_to_iterate:
|
while "\n" in list_to_iterate:
|
||||||
list_to_iterate.remove("\n")
|
list_to_iterate.remove("\n")
|
||||||
while "\n\n" in list_to_iterate:
|
channel_list = []
|
||||||
list_to_iterate.remove("\n\n")
|
|
||||||
for i in range(0, len(list_to_iterate), attributes_per_item):
|
for i in range(0, len(list_to_iterate), attributes_per_item):
|
||||||
item_name = list_to_iterate[i].strip()
|
item_name = list_to_iterate[i].strip()
|
||||||
|
|
||||||
|
@ -53,9 +51,12 @@ def get_channels_from_part(text):
|
||||||
if len(item_epg) == 1:
|
if len(item_epg) == 1:
|
||||||
item_epg = ""
|
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] != "-":
|
if len(item_options) > 0 and item_options[0] != "-":
|
||||||
for option in item_options:
|
for option in item_options:
|
||||||
format = (option[1:5]).replace("]", "")
|
format = (option[1:5]).replace("]", "")
|
||||||
|
|
Loading…
Reference in a new issue