ADD fps caching
This commit is contained in:
@@ -2,6 +2,7 @@ from pydantic import BaseModel, Field
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from functools import cached_property
|
||||
|
||||
from lib.fs import sanitize_filename
|
||||
|
||||
@@ -25,7 +26,7 @@ class VideoStream(BaseModel):
|
||||
disposition: Disposition
|
||||
tags: Tags
|
||||
|
||||
@property
|
||||
@cached_property
|
||||
def fps(self) -> float:
|
||||
frame_numbers = [int(x) for x in self.avg_frame_rate.split("/")]
|
||||
return frame_numbers[0] / frame_numbers[1]
|
||||
|
||||
Reference in New Issue
Block a user