mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-08 00:46:57 +08:00
fix bug
This commit is contained in:
@@ -36,7 +36,7 @@ class PluginDataOper(DbOper):
|
|||||||
data = PluginData.get_plugin_data_by_key(self._db, plugin_id, key)
|
data = PluginData.get_plugin_data_by_key(self._db, plugin_id, key)
|
||||||
if not data:
|
if not data:
|
||||||
return None
|
return None
|
||||||
if ObjectUtils.is_obj(data.value):
|
if ObjectUtils.is_objstr(data.value):
|
||||||
return json.loads(data.value)
|
return json.loads(data.value)
|
||||||
return data.value
|
return data.value
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class SystemConfigOper(DbOper, metaclass=Singleton):
|
|||||||
"""
|
"""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
for item in SystemConfig.list(self._db):
|
for item in SystemConfig.list(self._db):
|
||||||
if ObjectUtils.is_obj(item.value):
|
if ObjectUtils.is_objstr(item.value):
|
||||||
self.__SYSTEMCONF[item.key] = json.loads(item.value)
|
self.__SYSTEMCONF[item.key] = json.loads(item.value)
|
||||||
else:
|
else:
|
||||||
self.__SYSTEMCONF[item.key] = item.value
|
self.__SYSTEMCONF[item.key] = item.value
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class UserConfigOper(DbOper, metaclass=Singleton):
|
|||||||
"""
|
"""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
for item in UserConfig.list(self._db):
|
for item in UserConfig.list(self._db):
|
||||||
value = json.loads(item.value) if ObjectUtils.is_obj(item.value) else item.value
|
value = json.loads(item.value) if ObjectUtils.is_objstr(item.value) else item.value
|
||||||
self.__set_config_cache(username=item.username, key=item.key, value=value)
|
self.__set_config_cache(username=item.username, key=item.key, value=value)
|
||||||
|
|
||||||
def set(self, username: str, key: Union[str, UserConfigKey], value: Any):
|
def set(self, username: str, key: Union[str, UserConfigKey], value: Any):
|
||||||
|
|||||||
+11
-4
@@ -14,11 +14,18 @@ class ObjectUtils:
|
|||||||
elif isinstance(obj, int) \
|
elif isinstance(obj, int) \
|
||||||
or isinstance(obj, float) \
|
or isinstance(obj, float) \
|
||||||
or isinstance(obj, bool) \
|
or isinstance(obj, bool) \
|
||||||
or isinstance(obj, bytes):
|
or isinstance(obj, bytes) \
|
||||||
|
or isinstance(obj, str):
|
||||||
return False
|
return False
|
||||||
else:
|
return True
|
||||||
return str(obj).startswith("{") \
|
|
||||||
or str(obj).startswith("[")
|
@staticmethod
|
||||||
|
def is_objstr(obj: Any):
|
||||||
|
if not isinstance(obj, str):
|
||||||
|
return False
|
||||||
|
return str(obj).startswith("{") \
|
||||||
|
or str(obj).startswith("[") \
|
||||||
|
or str(obj).startswith("(")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def arguments(func: Callable) -> int:
|
def arguments(func: Callable) -> int:
|
||||||
|
|||||||
Reference in New Issue
Block a user