From 1ba1db3e14705e3242cb792e30ce659caa2a6b6d Mon Sep 17 00:00:00 2001 From: Lovi <62809003+Lovi-0@users.noreply.github.com> Date: Sun, 16 Jun 2024 18:08:11 +0200 Subject: [PATCH] Fix domain site api. --- Src/Api/4kTitle/__init__.py | 3 --- Src/Api/Animeunity/Core/Class/EpisodeType.py | 10 +++------- Src/Api/Animeunity/Core/Class/SearchType.py | 11 +++-------- Src/Api/Animeunity/Core/Player/vixcloud.py | 8 +++++--- Src/Api/Animeunity/site.py | 6 +----- Src/Api/Streamingcommunity/Core/Class/EpisodeType.py | 11 +++-------- Src/Api/Streamingcommunity/Core/Class/SearchType.py | 11 +++-------- Src/Api/Streamingcommunity/Core/Player/vixcloud.py | 7 +++++-- Src/Api/Streamingcommunity/site.py | 3 +-- config.json | 4 ++-- 10 files changed, 26 insertions(+), 48 deletions(-) diff --git a/Src/Api/4kTitle/__init__.py b/Src/Api/4kTitle/__init__.py index 7d2f70f..c9b2dfe 100644 --- a/Src/Api/4kTitle/__init__.py +++ b/Src/Api/4kTitle/__init__.py @@ -4,9 +4,6 @@ from Src.Util.console import console, msg -# Variable -indice = 5 - def search(): """ diff --git a/Src/Api/Animeunity/Core/Class/EpisodeType.py b/Src/Api/Animeunity/Core/Class/EpisodeType.py index 14b9694..4483274 100644 --- a/Src/Api/Animeunity/Core/Class/EpisodeType.py +++ b/Src/Api/Animeunity/Core/Class/EpisodeType.py @@ -3,14 +3,10 @@ from typing import Dict, Any, List -# Internal utilities -from Src.Util._jsonConfig import config_manager +# Variable +from ...costant import SITE_NAME, DOMAIN_NOW -# Config -AU_SITE_NAME = "animeunity" -AU_DOMAIN_NOW = config_manager.get('SITE', AU_SITE_NAME) - class Image: @@ -23,7 +19,7 @@ class Image: self.created_at: str = image_data.get('created_at', '') self.updated_at: str = image_data.get('updated_at', '') self.original_url_field: str = image_data.get('original_url_field', '') - self.url: str = f"https://cdn.{AU_SITE_NAME}.{AU_DOMAIN_NOW}/images/{self.filename}" + self.url: str = f"https://cdn.{SITE_NAME}.{DOMAIN_NOW}/images/{self.filename}" def __str__(self): return f"Image(id={self.id}, filename='{self.filename}', type='{self.type}', imageable_type='{self.imageable_type}', url='{self.url}')" diff --git a/Src/Api/Animeunity/Core/Class/SearchType.py b/Src/Api/Animeunity/Core/Class/SearchType.py index 6c492bf..1b7355f 100644 --- a/Src/Api/Animeunity/Core/Class/SearchType.py +++ b/Src/Api/Animeunity/Core/Class/SearchType.py @@ -3,13 +3,8 @@ from typing import List -# Internal utilities -from Src.Util._jsonConfig import config_manager - - -# Config -AU_SITE_NAME = "animeunity" -AU_DOMAIN_NOW = config_manager.get('SITE', AU_SITE_NAME) +# Variable +from ...costant import SITE_NAME, DOMAIN_NOW @@ -20,7 +15,7 @@ class Image: self.filename: str = data.get('filename') self.type: str = data.get('type') self.original_url_field: str = data.get('original_url_field') - self.url: str = f"https://cdn.{AU_SITE_NAME}.{AU_DOMAIN_NOW}/images/{self.filename}" + self.url: str = f"https://cdn.{SITE_NAME}.{DOMAIN_NOW}/images/{self.filename}" def __str__(self): return f"Image(imageable_id={self.imageable_id}, imageable_type='{self.imageable_type}', filename='{self.filename}', type='{self.type}', url='{self.url}')" diff --git a/Src/Api/Animeunity/Core/Player/vixcloud.py b/Src/Api/Animeunity/Core/Player/vixcloud.py index 2133d98..fad7472 100644 --- a/Src/Api/Animeunity/Core/Player/vixcloud.py +++ b/Src/Api/Animeunity/Core/Player/vixcloud.py @@ -12,17 +12,19 @@ from bs4 import BeautifulSoup # Internal utilities from Src.Util.headers import get_headers -from Src.Util.console import console from Src.Util._jsonConfig import config_manager # Logic class from ..Class.SeriesType import TitleManager from ..Class.EpisodeType import EpisodeManager, Episode -from ..Class.PreviewType import PreviewManager from ..Class.WindowType import WindowVideo, WindowParameter, DynamicJSONConverter +# Variable +from ...costant import SITE_NAME + + class VideoSource: def __init__(self): """ @@ -32,7 +34,7 @@ class VideoSource: 'user-agent': get_headers() } self.is_series = False - self.base_name = "animeunity" + self.base_name = SITE_NAME self.domain = config_manager.get('SITE', self.base_name) def setup(self, media_id: int = None, series_name: str = None): diff --git a/Src/Api/Animeunity/site.py b/Src/Api/Animeunity/site.py index 518870d..6744379 100644 --- a/Src/Api/Animeunity/site.py +++ b/Src/Api/Animeunity/site.py @@ -21,12 +21,8 @@ from .Core.Util import extract_domain from .Core.Class.SearchType import MediaManager, MediaItem -# Config -SITE_NAME = "animeunity" -DOMAIN_NOW = config_manager.get('SITE', SITE_NAME) - - # Variable +from .costant import SITE_NAME, DOMAIN_NOW media_search_manager = MediaManager() table_show_manager = TVShowManager() diff --git a/Src/Api/Streamingcommunity/Core/Class/EpisodeType.py b/Src/Api/Streamingcommunity/Core/Class/EpisodeType.py index 468e98b..e98fd62 100644 --- a/Src/Api/Streamingcommunity/Core/Class/EpisodeType.py +++ b/Src/Api/Streamingcommunity/Core/Class/EpisodeType.py @@ -3,13 +3,8 @@ from typing import Dict, Any, List -# Internal utilities -from Src.Util._jsonConfig import config_manager - - -# Config -SC_SITE_NAME = "streamingcommunity" -SC_DOMAIN_NOW = config_manager.get('SITE', SC_SITE_NAME) +# Variable +from ...costant import SITE_NAME, DOMAIN_NOW @@ -23,7 +18,7 @@ class Image: self.created_at: str = image_data.get('created_at', '') self.updated_at: str = image_data.get('updated_at', '') self.original_url_field: str = image_data.get('original_url_field', '') - self.url: str = f"https://cdn.{SC_SITE_NAME}.{SC_DOMAIN_NOW}/images/{self.filename}" + self.url: str = f"https://cdn.{SITE_NAME}.{DOMAIN_NOW}/images/{self.filename}" def __str__(self): return f"Image(id={self.id}, filename='{self.filename}', type='{self.type}', imageable_type='{self.imageable_type}', url='{self.url}')" diff --git a/Src/Api/Streamingcommunity/Core/Class/SearchType.py b/Src/Api/Streamingcommunity/Core/Class/SearchType.py index 115677d..1b7355f 100644 --- a/Src/Api/Streamingcommunity/Core/Class/SearchType.py +++ b/Src/Api/Streamingcommunity/Core/Class/SearchType.py @@ -3,13 +3,8 @@ from typing import List -# Internal utilities -from Src.Util._jsonConfig import config_manager - - -# Config -SC_SITE_NAME = "streamingcommunity" -SC_DOMAIN_NOW = config_manager.get('SITE', SC_SITE_NAME) +# Variable +from ...costant import SITE_NAME, DOMAIN_NOW @@ -20,7 +15,7 @@ class Image: self.filename: str = data.get('filename') self.type: str = data.get('type') self.original_url_field: str = data.get('original_url_field') - self.url: str = f"https://cdn.{SC_SITE_NAME}.{SC_DOMAIN_NOW}/images/{self.filename}" + self.url: str = f"https://cdn.{SITE_NAME}.{DOMAIN_NOW}/images/{self.filename}" def __str__(self): return f"Image(imageable_id={self.imageable_id}, imageable_type='{self.imageable_type}', filename='{self.filename}', type='{self.type}', url='{self.url}')" diff --git a/Src/Api/Streamingcommunity/Core/Player/vixcloud.py b/Src/Api/Streamingcommunity/Core/Player/vixcloud.py index f95c7b2..dfc3cc5 100644 --- a/Src/Api/Streamingcommunity/Core/Player/vixcloud.py +++ b/Src/Api/Streamingcommunity/Core/Player/vixcloud.py @@ -18,10 +18,13 @@ from Src.Util.console import console, Panel # Logic class from ..Class.SeriesType import TitleManager from ..Class.EpisodeType import EpisodeManager -from ..Class.PreviewType import PreviewManager from ..Class.WindowType import WindowVideo, WindowParameter, DynamicJSONConverter +# Variable +from ...costant import SITE_NAME + + class VideoSource: def __init__(self): """ @@ -31,7 +34,7 @@ class VideoSource: 'user-agent': get_headers() } self.is_series = False - self.base_name = "streamingcommunity" + self.base_name = SITE_NAME def setup(self, version: str = None, domain: str = None, media_id: int = None, series_name: str = None): """ diff --git a/Src/Api/Streamingcommunity/site.py b/Src/Api/Streamingcommunity/site.py index e1d44ba..6802459 100644 --- a/Src/Api/Streamingcommunity/site.py +++ b/Src/Api/Streamingcommunity/site.py @@ -26,8 +26,7 @@ from .Core.Class.SearchType import MediaManager, MediaItem # Config -SITE_NAME = "streamingcommunity" -DOMAIN_NOW = config_manager.get('SITE', SITE_NAME) +from .costant import SITE_NAME # Variable diff --git a/config.json b/config.json index 6018f7f..791da94 100644 --- a/config.json +++ b/config.json @@ -52,8 +52,8 @@ "force_resolution": -1 }, "SITE": { - "Streamingcommunity": "foo", - "Animeunity": "to", + "streamingcommunity": "foo", + "animeunity": "to", "Altadefinizione": "vodka", "Guardaserie": "ceo", "Ddlstreamitaly": "co",