mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 07:27:15 +08:00
fix 部分情况下Alist解析时间错误
This commit is contained in:
@@ -746,12 +746,15 @@ class Alist(StorageBase):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __parse_timestamp(time_str: str) -> float:
|
def __parse_timestamp(time_str: str) -> float:
|
||||||
try:
|
# try:
|
||||||
# 尝试解析带微秒的时间格式
|
# # 尝试解析带微秒的时间格式
|
||||||
dt = datetime.strptime(time_str[:26], '%Y-%m-%dT%H:%M:%S.%f')
|
# dt = datetime.strptime(time_str[:26], '%Y-%m-%dT%H:%M:%S.%f')
|
||||||
except ValueError:
|
# except ValueError:
|
||||||
# 如果失败,尝试解析不带微秒的时间格式
|
# # 如果失败,尝试解析不带微秒的时间格式
|
||||||
dt = datetime.strptime(time_str, '%Y-%m-%dT%H:%M:%SZ')
|
# dt = datetime.strptime(time_str, '%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
|
||||||
|
# 直接使用 ISO 8601 格式解析时间
|
||||||
|
dt = datetime.fromisoformat(time_str)
|
||||||
|
|
||||||
# 返回时间戳
|
# 返回时间戳
|
||||||
return dt.timestamp()
|
return dt.timestamp()
|
||||||
|
|||||||
Reference in New Issue
Block a user