mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-07-12 16:02:35 +08:00
Revert "refactor(helper): 将LLMHelper StorageHelper的相关方法改为静态方法,移除实例调用"
This reverts commit 9f381b3c73.
This commit is contained in:
@@ -20,23 +20,21 @@ class StorageHelper:
|
||||
return []
|
||||
return [schemas.StorageConf(**s) for s in storage_confs]
|
||||
|
||||
@staticmethod
|
||||
def get_storage(storage: str) -> Optional[schemas.StorageConf]:
|
||||
def get_storage(self, storage: str) -> Optional[schemas.StorageConf]:
|
||||
"""
|
||||
获取指定存储配置
|
||||
"""
|
||||
storagies = StorageHelper.get_storagies()
|
||||
storagies = self.get_storagies()
|
||||
for s in storagies:
|
||||
if s.type == storage:
|
||||
return s
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def set_storage(storage: str, conf: dict):
|
||||
def set_storage(self, storage: str, conf: dict):
|
||||
"""
|
||||
设置存储配置
|
||||
"""
|
||||
storagies = StorageHelper.get_storagies()
|
||||
storagies = self.get_storagies()
|
||||
if not storagies:
|
||||
storagies = [
|
||||
schemas.StorageConf(
|
||||
@@ -51,12 +49,11 @@ class StorageHelper:
|
||||
break
|
||||
SystemConfigOper().set(SystemConfigKey.Storages, [s.model_dump() for s in storagies])
|
||||
|
||||
@staticmethod
|
||||
def add_storage(storage: str, name: str, conf: dict):
|
||||
def add_storage(self, storage: str, name: str, conf: dict):
|
||||
"""
|
||||
添加存储配置
|
||||
"""
|
||||
storagies = StorageHelper.get_storagies()
|
||||
storagies = self.get_storagies()
|
||||
if not storagies:
|
||||
storagies = [
|
||||
schemas.StorageConf(
|
||||
@@ -73,12 +70,11 @@ class StorageHelper:
|
||||
))
|
||||
SystemConfigOper().set(SystemConfigKey.Storages, [s.model_dump() for s in storagies])
|
||||
|
||||
@staticmethod
|
||||
def reset_storage(storage: str):
|
||||
def reset_storage(self, storage: str):
|
||||
"""
|
||||
重置存储配置
|
||||
"""
|
||||
storagies = StorageHelper.get_storagies()
|
||||
storagies = self.get_storagies()
|
||||
for s in storagies:
|
||||
if s.type == storage:
|
||||
s.config = {}
|
||||
|
||||
Reference in New Issue
Block a user