This commit is contained in:
xyj 2023-12-02 19:51:55 +08:00
parent 09350f0357
commit 35508548ee
1 changed files with 2 additions and 2 deletions

View File

@ -31,7 +31,7 @@ def get_record(msg, client):
create_time_time_str = create_time.split(' ')[1] create_time_time_str = create_time.split(' ')[1]
create_time_ = datetime.datetime(int(create_time_date_str[:4]), int(create_time_date_str[5:7]), create_time_ = datetime.datetime(int(create_time_date_str[:4]), int(create_time_date_str[5:7]),
int(create_time_date_str[8:10]), int(create_time_time_str[:2]), int(create_time_date_str[8:10]), int(create_time_time_str[:2]),
int(create_time_time_str[3:5]), int(create_time_time_str[6:8])) int(create_time_time_str[3:5]))
file_name_ = '' file_name_ = ''
for filename in os.listdir('mp4'): for filename in os.listdir('mp4'):
# 检查文件名是否符合格式 %Y-%m-%d_%H-%M-%S # 检查文件名是否符合格式 %Y-%m-%d_%H-%M-%S
@ -43,7 +43,7 @@ def get_record(msg, client):
# 将日期和时间字符串转换为 datetime 对象 # 将日期和时间字符串转换为 datetime 对象
file_time = datetime.datetime(int(date_str[:4]), int(date_str[5:7]), file_time = datetime.datetime(int(date_str[:4]), int(date_str[5:7]),
int(date_str[8:10]), int(time_str[:2]), int(date_str[8:10]), int(time_str[:2]),
int(time_str[3:5]), int(time_str[6:8])) int(time_str[3:5]))
# 比较文件时间和创建时间 # 比较文件时间和创建时间
if file_time > create_time_: if file_time > create_time_:
file_name_ = filename file_name_ = filename