diff --git a/Dockerfile b/Dockerfile index d17e8a6..5b569dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,6 @@ FROM python:3.8-slim-buster WORKDIR /sportyfin -RUN pip install sportyfin==1.0.6 --no-binary=sportyfin +RUN pip install sportyfin==1.0.7 --no-binary=sportyfin CMD [ "python3", "-m" , "sportyfin", "run", "-a", "-o", "/sportyfin/output"] diff --git a/setup.cfg b/setup.cfg index d542734..57ac40d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ # https://github.com/axelmierczuk/sportyfin [metadata] name = sportyfin -version = 1.0.6 +version = 1.0.7 author = Axel Mierczuk author_email = axelmierczuk@gmail.com url = https://github.com/axelmierczuk/sportyfin diff --git a/setup.py b/setup.py index 7b89769..f157c15 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='sportyfin', - version='1.0.6', + version='1.0.7', author='Axel Mierczuk', author_email='axelmierczuk@gmail.com', packages=['sportyfin', 'sportyfin.util'], diff --git a/sportyfin/sportyfin.py b/sportyfin/sportyfin.py index 42e45f0..1892664 100644 --- a/sportyfin/sportyfin.py +++ b/sportyfin/sportyfin.py @@ -33,7 +33,7 @@ def header(): print(f"{colours.OKGREEN} is used in Jellyfin to provide a great viewing experience.") print() print(f"{colours.OKGREEN} Author: Axel Mierczuk") - print(f"{colours.OKGREEN} Version: 1.0.6") + print(f"{colours.OKGREEN} Version: 1.0.7") print(f"{colours.OKGREEN} Github: https://github.com/axelmierczuk/sportyfin") print() print() @@ -66,13 +66,17 @@ def generate_xmltv(self, lg: str): root = ET.Element("tv") for match in self.streaming_sites[lg]: for url in match['match']['m3u8_urls']: - doc = ET.SubElement(root, "programme", start=match['match']['start'], stop=match['match']['stop'], channel=str(url)) - ET.SubElement(doc, "title", lang="en").text = match['match']['name'] - ET.SubElement(doc, "category", lang="en").text = "sports" + doc = ET.SubElement(root, "channel", id=str(url)) + ET.SubElement(doc, "display-name").text = match['match']['name'] + ET.SubElement(doc, "icon").text = f"{OUTPUT}/{lg}/{match['match']['img_location'].split('/')[-1]}" + + doc_p = ET.SubElement(root, "programme", start=match['match']['start'], stop=match['match']['stop'], channel=str(url)) + ET.SubElement(doc_p, "title", lang="en").text = match['match']['name'] + ET.SubElement(doc_p, "category", lang="en").text = "sports" audio = ET.Element("audio") - doc.append(audio) + doc_p.append(audio) ET.SubElement(audio, "stereo").text = "stereo" - ET.SubElement(doc, "icon", src=f"{OUTPUT}/{lg}/{match['match']['img_location'].split('/')[-1]}") + ET.SubElement(doc_p, "icon", src=f"{OUTPUT}/{lg}/{match['match']['img_location'].split('/')[-1]}") tree = ET.ElementTree(root) outp = os.path.join(OUTPUT, f"docs") if not os.path.isdir(f"{OUTPUT}"): diff --git a/sportyfin/util/scraping.py b/sportyfin/util/scraping.py index e76b0d4..c9841f7 100644 --- a/sportyfin/util/scraping.py +++ b/sportyfin/util/scraping.py @@ -200,8 +200,18 @@ def make_match(api_res, hosts, lg) -> list: } } try: - match['match']['start'] = ''.join(g['formatedStartDate'].split('-')) + ''.join(g['startTime'].split(':')) + " GMT" - match['match']['stop'] = ''.join(g['formatedStartDate'].split('-')) + str(int(''.join(g['startTime'].split(':'))) + 300) + " GMT" + t = ''.join(g['startTime'].split(':')) + if len(t) > 4: + t = t[:(4-len(t))] + t_end = str(int(t) + 300) + if len(t_end) < 4: + t_end = "0" + t_end + try: + match['match']['start'] = ''.join(g['formatedStartDate'].split('-')) + t + " GMT" + match['match']['stop'] = ''.join(g['formatedStartDate'].split('-')) + t_end + " GMT" + except: + match['match']['start'] = ''.join(g['startDate'].split('-')) + t + " GMT" + match['match']['stop'] = ''.join(g['startDate'].split('-')) + t_end + " GMT" except: pass if match['match']['name'] == '':