Skip to content

Commit cb44425

Browse files
committed
fix: 修复 Alist2StrmMode.from_str 方法无法返回正确枚举值的问题
1 parent 245018a commit cb44425

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

app/modules/alist2strm/mode.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
from enum import Enum
22

3+
34
class Alist2StrmMode(Enum):
45
"""
56
模块 alist2strm 的运行模式
67
"""
8+
79
AlistURL = "AlistURL"
810
RawURL = "RawURL"
911
AlistPath = "AlistPath"
@@ -17,4 +19,7 @@ def from_str(cls, mode_str: str) -> "Alist2StrmMode":
1719
:return: Alist2StrmMode 枚举值
1820
例如,"alisturl" 将返回 Alist2StrmMode.AlistURL
1921
"""
20-
return cls[mode_str.upper()] if mode_str.upper() in cls.__members__ else cls.AlistURL
22+
for member_name, member_value in cls.__members__.items():
23+
if member_name.lower() == mode_str.lower():
24+
return member_value
25+
return cls.AlistURL

0 commit comments

Comments
 (0)