Skip to content

Commit

Permalink
local: fix duration format (#728)
Browse files Browse the repository at this point in the history
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]
```
  • Loading branch information
felixonmars authored Sep 17, 2023
1 parent 190dc3f commit 817ba50
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion feeluown/local/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 817ba50

Please sign in to comment.