mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-06 07:56:52 +08:00
refactor: use explicit system config getter
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user