From 8f5e38c850a0fcab2e07856b0f915ad4ad62088c Mon Sep 17 00:00:00 2001 From: fire-hawk-86 Date: Tue, 4 Oct 2022 17:31:58 +0200 Subject: [PATCH] Update common.py (#244) Local file support for 'tvg-logo' attribute in '.m3u8' files. Example: `tvg-logo="file:///home/username/Video/Movies/Movie Name (1986)-landscape.jpg"` --- usr/lib/hypnotix/common.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/usr/lib/hypnotix/common.py b/usr/lib/hypnotix/common.py index d337926..af3e0e0 100755 --- a/usr/lib/hypnotix/common.py +++ b/usr/lib/hypnotix/common.py @@ -107,14 +107,17 @@ def __init__(self, provider, info): if self.name == None and "," in info: self.name = info.split(",")[-1].strip() if self.logo != None: - ext = None - for known_ext in [".png", ".jpg", ".gif", ".jpeg"]: - if self.logo.lower().endswith(known_ext): - ext = known_ext - break - if ext == ".jpeg": - ext = ".jpg" - self.logo_path = os.path.join(PROVIDERS_PATH, "%s-%s%s" % (slugify(provider.name), slugify(self.name), ext)) + if self.logo.startswith("file://"): + self.logo_path = self.logo[7:] + else: + ext = None + for known_ext in [".png", ".jpg", ".gif", ".jpeg"]: + if self.logo.lower().endswith(known_ext): + ext = known_ext + break + if ext == ".jpeg": + ext = ".jpg" + self.logo_path = os.path.join(PROVIDERS_PATH, "%s-%s%s" % (slugify(provider.name), slugify(self.name), ext)) class Manager():