backup
This commit is contained in:
Submodule src/AniWorld-Downloader updated: 94e332f37b...03f08a8633
@@ -9,13 +9,12 @@ import traceback
|
||||
from GlobalLogger import setupLogger, error_logger, noKeyFound_logger, noGerFound_logger
|
||||
from Exceptions import NoKeyFoundException, MatchNotFoundError
|
||||
import requests
|
||||
|
||||
from aniworld.common import get_season_episode_count
|
||||
|
||||
class FolderLookup:
|
||||
def __init__(self, basePath: str):
|
||||
self.directory = basePath
|
||||
self.folderDict = dict[str, list[Serie]]
|
||||
self.folderDict: dict[str, list[Serie]] = {} # Proper initialization
|
||||
logging.info(f"Initialized Loader with base path: {self.directory}")
|
||||
|
||||
self.__init()
|
||||
@@ -29,16 +28,18 @@ class FolderLookup:
|
||||
try:
|
||||
serie = self.__ReadDataFromFile(folder)
|
||||
if (serie != None and not self.is_null_or_whitespace(serie.key)):
|
||||
continue
|
||||
missings, site = self.__GetMissingEpisodesAndSeason(serie.key, mp4_files)
|
||||
serie.episodeDict = missings
|
||||
self.__SaveData(serie, folder)
|
||||
if folder not in self.folderDict:
|
||||
self.folderDict[folder] = []
|
||||
self.folderDict[folder].append(serie)
|
||||
noKeyFound_logger.info(f"Saved Serie: '{str(serie)}'")
|
||||
except NoKeyFoundException as nkfe:
|
||||
noKeyFound_logger.error(f"Error processing folder '{folder}': {nkfe}")
|
||||
except Exception as e:
|
||||
error_logger.error(f"Unexpected error processing folder '{folder}': {e} \n {traceback.format_exc()}")
|
||||
error_logger.error(f"Folder: '{folder}' - Unexpected error processing folder '{folder}': {e} \n {traceback.format_exc()}")
|
||||
continue
|
||||
|
||||
|
||||
@@ -104,7 +105,7 @@ class FolderLookup:
|
||||
folder_path = os.path.join(self.directory, folder_name)
|
||||
serie_file = os.path.join(folder_path, 'data')
|
||||
with open(serie_file, "w", encoding="utf-8") as file:
|
||||
json.dump(serie, file, indent=4)
|
||||
json.dump(serie.to_dict(), file, indent=4)
|
||||
|
||||
|
||||
def __GetEpisodeAndSeason(self, filename: str):
|
||||
@@ -146,15 +147,4 @@ class FolderLookup:
|
||||
|
||||
return episodes_dict, "aniworld.to"
|
||||
|
||||
#gg = FolderLookup("\\\\sshfs.r\\ubuntu@192.168.178.43\\media\\serien\\Serien")
|
||||
|
||||
base_url = f"https://aniworld.to/anime/stream/aico-incarnation"
|
||||
headers = {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
|
||||
"Accept": "*/*",
|
||||
"Referer": "https://www.example.com"
|
||||
}
|
||||
|
||||
session = requests.Session()
|
||||
response = requests.get(base_url, headers=headers, timeout=30)
|
||||
c = response.content;
|
||||
gg = FolderLookup("\\\\sshfs.r\\ubuntu@192.168.178.43\\media\\serien\\Serien")
|
||||
|
||||
13
src/Serie.py
13
src/Serie.py
@@ -6,6 +6,19 @@ class Serie:
|
||||
self._folder = folder
|
||||
self._episodeDict = dict[int, list[int]]
|
||||
|
||||
def __str__(self):
|
||||
"""String representation of Serie object"""
|
||||
return f"Serie(key='{self.key}', name='{self.name}', site='{self.site}', folder='{self.folder}', episodeDict={self.episodeDict})"
|
||||
|
||||
def to_dict(self):
|
||||
"""Convert Serie object to dictionary"""
|
||||
return {
|
||||
"key": self.key,
|
||||
"name": self.name,
|
||||
"site": self.site,
|
||||
"folder": self.folder,
|
||||
"episodeDict": {str(k): v for k, v in self._episodeDict.items()} # Convert int keys to str
|
||||
}
|
||||
@property
|
||||
def key(self) -> str:
|
||||
return self._key
|
||||
|
||||
BIN
src/__pycache__/Exceptions.cpython-310.pyc
Normal file
BIN
src/__pycache__/Exceptions.cpython-310.pyc
Normal file
Binary file not shown.
BIN
src/__pycache__/GlobalLogger.cpython-310.pyc
Normal file
BIN
src/__pycache__/GlobalLogger.cpython-310.pyc
Normal file
Binary file not shown.
BIN
src/__pycache__/Serie.cpython-310.pyc
Normal file
BIN
src/__pycache__/Serie.cpython-310.pyc
Normal file
Binary file not shown.
Reference in New Issue
Block a user