mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-06 19:45:24 +00:00
Add loiggin load module.
This commit is contained in:
parent
f41490fa33
commit
4791de098d
@ -11,6 +11,7 @@ from .film import download_film
|
||||
|
||||
# Variable
|
||||
indice = 2
|
||||
_deprecate = False
|
||||
|
||||
|
||||
def search():
|
||||
|
@ -11,7 +11,7 @@ from .anime import donwload_film, donwload_series
|
||||
|
||||
# Variable
|
||||
indice = 1
|
||||
|
||||
_deprecate = False
|
||||
|
||||
def search():
|
||||
|
||||
|
@ -15,6 +15,7 @@ from .series import download_thread
|
||||
|
||||
# Variable
|
||||
indice = 3
|
||||
_deprecate = False
|
||||
|
||||
|
||||
def search():
|
||||
|
@ -11,6 +11,7 @@ from .series import download_series
|
||||
|
||||
# Variable
|
||||
indice = 4
|
||||
_deprecate = False
|
||||
|
||||
|
||||
def search():
|
||||
|
@ -17,6 +17,7 @@ from .series import download_series
|
||||
|
||||
# Variable
|
||||
indice = 0
|
||||
_deprecate = False
|
||||
|
||||
|
||||
def search():
|
||||
|
@ -1,4 +1,6 @@
|
||||
httpx
|
||||
urllib3
|
||||
certifi
|
||||
httpx
|
||||
bs4
|
||||
rich
|
||||
tqdm
|
||||
|
21
run.py
21
run.py
@ -3,6 +3,7 @@
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import logging
|
||||
import platform
|
||||
import argparse
|
||||
import importlib
|
||||
@ -47,20 +48,29 @@ def load_search_functions():
|
||||
# Traverse the Api directory
|
||||
api_dir = os.path.join(os.path.dirname(__file__), 'Src', 'Api')
|
||||
init_files = glob.glob(os.path.join(api_dir, '*', '__init__.py'))
|
||||
|
||||
logging.info(f"Base folder path: {api_dir}")
|
||||
logging.info(f"Api module path: {init_files}")
|
||||
|
||||
|
||||
# Retrieve modules and their indices
|
||||
for init_file in init_files:
|
||||
module_name = os.path.basename(os.path.dirname(init_file)) # Get folder name as module name
|
||||
|
||||
# Get folder name as module name
|
||||
module_name = os.path.basename(os.path.dirname(init_file))
|
||||
logging.info(f"Load module name: {module_name}")
|
||||
|
||||
try:
|
||||
# Dynamically import the module
|
||||
mod = importlib.import_module(f'Src.Api.{module_name}')
|
||||
|
||||
# Get 'indice' from the module
|
||||
indice = getattr(mod, 'indice', 0) # If 'indice' is not defined, default to 0
|
||||
indice = getattr(mod, 'indice', 0)
|
||||
is_deprecate = bool(getattr(mod, '_deprecate', True))
|
||||
|
||||
# Add module and indice to the list
|
||||
modules.append((module_name, indice))
|
||||
if not is_deprecate:
|
||||
modules.append((module_name, indice))
|
||||
|
||||
except Exception as e:
|
||||
console.print(f"[red]Failed to import module {module_name}: {str(e)}")
|
||||
@ -70,7 +80,10 @@ def load_search_functions():
|
||||
|
||||
# Load search functions in the sorted order
|
||||
for module_name, _ in modules:
|
||||
module_alias = f'{module_name}_search' # Construct a unique alias for the module
|
||||
|
||||
# Construct a unique alias for the module
|
||||
module_alias = f'{module_name}_search'
|
||||
logging.info(f"Module alias: {module_alias}")
|
||||
|
||||
try:
|
||||
# Dynamically import the module
|
||||
|
Loading…
x
Reference in New Issue
Block a user