From 817ba5006e94336988f51bb08fd0e6130ca96ccd Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Sun, 17 Sep 2023 19:25:03 +0800 Subject: [PATCH] local: fix duration format (#728) It should be an `int` according to `SongModel`'s spec, but not converted accordingly. Breaks pydantic validation: ``` pydantic_core._pydantic_core.ValidationError: 1 validation error for SongModel duration Input should be a valid integer, got a number with a fractional part [type=int_from_float, input_value=226533.87755102038, input_type=float] ``` --- feeluown/local/db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feeluown/local/db.py b/feeluown/local/db.py index 658228ac8d..7ba508b4b6 100644 --- a/feeluown/local/db.py +++ b/feeluown/local/db.py @@ -143,7 +143,7 @@ def read_audio_metadata(fpath, can_convert_chinese=False, lang='auto') -> Option metadata_dict['duration'] = 0 else: # milesecond - metadata_dict['duration'] = metadata.info.length * 1000 + metadata_dict['duration'] = int(metadata.info.length * 1000) # Convert simplified to traditional, or reverse. if can_convert_chinese: