jkjnkjkllkjjk

This commit is contained in:
nose
2025-11-30 11:39:04 -08:00
parent ed417c8200
commit 7a13af9a1f
15 changed files with 1150 additions and 363 deletions

76
CLI.py
View File

@@ -676,8 +676,8 @@ def _create_cmdlet_cli():
try:
from helper.hydrus import get_client
get_client(config) # Pre-acquire and cache session key
debug("✓ Hydrus session key acquired")
# get_client(config) # Pre-acquire and cache session key
# debug("✓ Hydrus session key acquired")
except RuntimeError as e:
# Hydrus is not available - this is expected and normal
# Don't show a message, just continue without it
@@ -697,6 +697,78 @@ def _create_cmdlet_cli():
initialize_hydrus_health_check(config)
initialize_matrix_health_check(config)
initialize_local_library_scan(config)
# --- Startup File Counts ---
# Count Local Files
try:
from helper.file_storage import LocalStorageBackend
from config import get_local_storage_path
storage_path = get_local_storage_path(config)
if storage_path:
# Use LocalStorageBackend to perform the search as requested
# Pass a large limit to get all files
storage = LocalStorageBackend(location=storage_path)
local_files = storage.search("*", limit=100000)
print(f"Local: {len(local_files)}")
except Exception as e:
debug(f"⚠ Could not count local files: {e}")
# Count Hydrus Files (if available)
from hydrus_health_check import is_hydrus_available
if is_hydrus_available():
try:
from helper.hydrus import get_client
client = get_client(config)
# Hydrus search for all files
# search_files returns IDs.
response = client.search_files(["system:everything"])
hydrus_ids = response.get("file_ids", [])
print(f"Hydrus: {len(hydrus_ids)}")
except Exception as e:
debug(f"⚠ Could not count Hydrus files: {e}")
# Count Debrid Magnets (if available)
try:
from config import get_api_key
from helper.alldebrid import AllDebridClient
api_key = get_api_key(config, "AllDebrid", "Debrid.All-debrid")
if api_key:
# Use AllDebridClient to get magnets
# We can use magnet_status with ID or just list active magnets if there's an endpoint
# The magnet/status endpoint without ID returns all magnets
# But helper/alldebrid.py magnet_status requires ID.
# Let's check if we can use the client directly to call magnet/status without ID
# Or if there is a method for it.
# Looking at alldebrid.py, magnet_status takes magnet_id.
# But the API docs say /magnet/status returns all magnets if no ID provided?
# Actually, usually /magnet/status requires ID or 'all' or something.
# Let's try to use the client's _request method if possible, or instantiate client.
# We'll instantiate client and try to list magnets.
# Since magnet_status in helper requires ID, we might need to bypass it or add a method.
# But wait, let's check if we can just use the raw request via client.
client = AllDebridClient(api_key)
# The helper class doesn't expose a "list all" method easily,
# but we can try calling _request directly if we access it, or add a method.
# Accessing protected member _request is okay for this CLI script.
# API: /magnet/status
resp = client._request('magnet/status')
if resp.get('status') == 'success':
data = resp.get('data', {})
magnets = data.get('magnets', [])
if isinstance(magnets, list):
print(f"Debrid: {len(magnets)}")
elif isinstance(magnets, dict):
# Sometimes it returns a dict if single item? Or dict of magnets?
print(f"Debrid: {len(magnets)}")
except Exception as e:
# Don't show error if just not configured or failed
# debug(f"⚠ Could not count Debrid magnets: {e}")
pass
except Exception as e:
debug(f"⚠ Could not check service availability: {e}")
except Exception: