d
This commit is contained in:
20
config.py
20
config.py
@@ -339,6 +339,26 @@ def get_hydrus_url(config: Dict[str, Any], instance_name: str = "home") -> Optio
|
||||
return str(url).strip() if url else None
|
||||
|
||||
|
||||
def get_provider_block(config: Dict[str, Any], name: str) -> Dict[str, Any]:
|
||||
provider_cfg = config.get("provider")
|
||||
if not isinstance(provider_cfg, dict):
|
||||
return {}
|
||||
block = provider_cfg.get(str(name).strip().lower())
|
||||
return block if isinstance(block, dict) else {}
|
||||
|
||||
|
||||
def get_soulseek_username(config: Dict[str, Any]) -> Optional[str]:
|
||||
block = get_provider_block(config, "soulseek")
|
||||
val = block.get("username") or block.get("USERNAME")
|
||||
return str(val).strip() if val else None
|
||||
|
||||
|
||||
def get_soulseek_password(config: Dict[str, Any]) -> Optional[str]:
|
||||
block = get_provider_block(config, "soulseek")
|
||||
val = block.get("password") or block.get("PASSWORD")
|
||||
return str(val).strip() if val else None
|
||||
|
||||
|
||||
|
||||
def resolve_output_dir(config: Dict[str, Any]) -> Path:
|
||||
"""Resolve output directory from config with single source of truth.
|
||||
|
||||
Reference in New Issue
Block a user