fix(config): match per-service cdm keys case-insensitively

cdm lookups used the raw service key while decryption upper-cases its keys, so a case-mismatched cdm entry silently used the default. Add a shared ci_get helper, route cdm/decryption through resolvers, drop a redundant decryption mutation and dead downloader writes, and add a regression bench.
This commit is contained in:
imSp4rky
2026-06-22 16:50:59 -06:00
parent ce69e8a028
commit 6294566823
7 changed files with 114 additions and 29 deletions
+12
View File
@@ -8,6 +8,18 @@ from typing import Any, Optional
import yaml
from appdirs import AppDirs
from unshackle.core.utils.collections import ci_get
def resolve_decryption(decryption_map: dict, default: str, service: str) -> str:
"""Pick the decryption tool for a service (case-insensitive), falling back to default."""
return ci_get(decryption_map, service, default)
def resolve_cdm_name(cdm: dict, service: str, override: Any = None) -> Any:
"""Resolve a service's top-level CDM entry (case-insensitive), with default fallback."""
return override or ci_get(cdm, service) or ci_get(cdm, "default")
class Config:
class _Directories: