refactor: use explicit system config getter

This commit is contained in:
jxxghp
2026-08-24 04:04:35 +08:00
parent 4dd2d7fed2
commit 8555d0da3e
28 changed files with 111 additions and 76 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ from typing import Tuple, List
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.configuration import get_configured_system_config as SystemConfigOper
from app.application.configuration import get_configured_system_config
from app.runtime.log import logger
from app.schemas.types import MediaType
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
@@ -62,7 +62,7 @@ class HaiDanSpider:
return None
def __init__(self, indexer: dict):
self.systemconfig = SystemConfigOper()
self.systemconfig = get_configured_system_config()
if indexer:
self._indexerid = indexer.get('id')
self._url = indexer.get('domain')
+2 -2
View File
@@ -3,7 +3,7 @@ from typing import Tuple, List, Optional
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.configuration import get_configured_system_config as SystemConfigOper
from app.application.configuration import get_configured_system_config
from app.runtime.log import logger
from app.schemas.types import MediaType
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
@@ -69,7 +69,7 @@ class HddolbySpider:
return cls._size
def __init__(self, indexer: dict):
self.systemconfig = SystemConfigOper()
self.systemconfig = get_configured_system_config()
if indexer:
self._indexerid = indexer.get('id')
self._domain = indexer.get('domain')
+2 -2
View File
@@ -7,7 +7,7 @@ from urllib.parse import urlparse
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.configuration import get_configured_system_config as SystemConfigOper
from app.application.configuration import get_configured_system_config
from app.runtime.log import logger
from app.schemas.types import MediaType
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
@@ -67,7 +67,7 @@ class MTorrentSpider:
return cls._size
def __init__(self, indexer: dict):
self.systemconfig = SystemConfigOper()
self.systemconfig = get_configured_system_config()
if indexer:
self._indexerid = indexer.get('id')
self._url = indexer.get('domain')
+2 -2
View File
@@ -5,7 +5,7 @@ from typing import List, Optional, Tuple
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.configuration import get_configured_system_config as SystemConfigOper
from app.application.configuration import get_configured_system_config
from app.runtime.log import logger
from app.schemas.types import MediaType
from app.adapters.network.http import RequestUtils, AsyncRequestUtils
@@ -51,7 +51,7 @@ class RousiSpider:
return cls._size
def __init__(self, indexer: dict):
self.systemconfig = SystemConfigOper()
self.systemconfig = get_configured_system_config()
if indexer:
self._indexerid = indexer.get('id')
self._url = indexer.get('domain')
+3 -3
View File
@@ -12,7 +12,7 @@ from app.schemas.mediaserver import MediaServerLibrary as _SchemaMediaServerLibr
from app.schemas.mediaserver import MediaServerPlayItem as _SchemaMediaServerPlayItem
from app.schemas.mediaserver import RefreshMediaItem as _SchemaRefreshMediaItem
from app.schemas.mediaserver import WebhookEventInfo as _SchemaWebhookEventInfo
from app.application.configuration import get_configured_system_config as SystemConfigOper
from app.application.configuration import get_configured_system_config
from app.application.mediaserver import MediaServerIdentityHelper, MusicMediaServerHelper
from app.runtime.log import logger
from app.modules.ugreen.api import Api
@@ -116,12 +116,12 @@ class Ugreen:
@staticmethod
def __load_all_session_cache() -> dict:
sessions = SystemConfigOper().get(SystemConfigKey.UgreenSessionCache)
sessions = get_configured_system_config().get(SystemConfigKey.UgreenSessionCache)
return sessions if isinstance(sessions, dict) else {}
@staticmethod
def __save_all_session_cache(sessions: dict):
SystemConfigOper().set(SystemConfigKey.UgreenSessionCache, sessions)
get_configured_system_config().set(SystemConfigKey.UgreenSessionCache, sessions)
def __remove_persisted_session(self):
cache_key = self.__session_cache_key()