mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 12:05:35 +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
|
# Variable
|
||||||
indice = 2
|
indice = 2
|
||||||
|
_deprecate = False
|
||||||
|
|
||||||
|
|
||||||
def search():
|
def search():
|
||||||
|
@ -11,7 +11,7 @@ from .anime import donwload_film, donwload_series
|
|||||||
|
|
||||||
# Variable
|
# Variable
|
||||||
indice = 1
|
indice = 1
|
||||||
|
_deprecate = False
|
||||||
|
|
||||||
def search():
|
def search():
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ from .series import download_thread
|
|||||||
|
|
||||||
# Variable
|
# Variable
|
||||||
indice = 3
|
indice = 3
|
||||||
|
_deprecate = False
|
||||||
|
|
||||||
|
|
||||||
def search():
|
def search():
|
||||||
|
@ -11,6 +11,7 @@ from .series import download_series
|
|||||||
|
|
||||||
# Variable
|
# Variable
|
||||||
indice = 4
|
indice = 4
|
||||||
|
_deprecate = False
|
||||||
|
|
||||||
|
|
||||||
def search():
|
def search():
|
||||||
|
@ -17,6 +17,7 @@ from .series import download_series
|
|||||||
|
|
||||||
# Variable
|
# Variable
|
||||||
indice = 0
|
indice = 0
|
||||||
|
_deprecate = False
|
||||||
|
|
||||||
|
|
||||||
def search():
|
def search():
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
httpx
|
urllib3
|
||||||
|
certifi
|
||||||
|
httpx
|
||||||
bs4
|
bs4
|
||||||
rich
|
rich
|
||||||
tqdm
|
tqdm
|
||||||
|
21
run.py
21
run.py
@ -3,6 +3,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import glob
|
import glob
|
||||||
|
import logging
|
||||||
import platform
|
import platform
|
||||||
import argparse
|
import argparse
|
||||||
import importlib
|
import importlib
|
||||||
@ -47,20 +48,29 @@ def load_search_functions():
|
|||||||
# Traverse the Api directory
|
# Traverse the Api directory
|
||||||
api_dir = os.path.join(os.path.dirname(__file__), 'Src', 'Api')
|
api_dir = os.path.join(os.path.dirname(__file__), 'Src', 'Api')
|
||||||
init_files = glob.glob(os.path.join(api_dir, '*', '__init__.py'))
|
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
|
# Retrieve modules and their indices
|
||||||
for init_file in init_files:
|
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:
|
try:
|
||||||
# Dynamically import the module
|
# Dynamically import the module
|
||||||
mod = importlib.import_module(f'Src.Api.{module_name}')
|
mod = importlib.import_module(f'Src.Api.{module_name}')
|
||||||
|
|
||||||
# Get 'indice' from the module
|
# 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
|
# 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:
|
except Exception as e:
|
||||||
console.print(f"[red]Failed to import module {module_name}: {str(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
|
# Load search functions in the sorted order
|
||||||
for module_name, _ in modules:
|
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:
|
try:
|
||||||
# Dynamically import the module
|
# Dynamically import the module
|
||||||
|
Loading…
x
Reference in New Issue
Block a user