-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.py
54 lines (45 loc) · 1.48 KB
/
data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from pathlib import Path
from typing import Optional
class SetupData:
__slots__ = ('video_path', 'width', 'height', 'num_frames', 'fps', 'keyframe_file')
def __init__(
self,
video_path: Path,
width: int,
height: int,
num_frames: int,
fps: float,
keyframe_file: Optional[Path] = None,
) -> None:
self.video_path = video_path
self.width = width
self.height = height
self.num_frames = num_frames
self.fps = fps
self.keyframe_file = keyframe_file
class BaseData:
__slots__ = ('width', 'height', 'num_frames', 'fps', 'tempo', 'angle', 'transparency')
def __init__(
self, width: int, height: int, num_frames: int, fps: float, tempo: float, angle: float, transparency: int
) -> None:
self.width = width
self.height = height
self.num_frames = num_frames
self.fps = fps
self.tempo = tempo
self.angle = angle
self.transparency = transparency
class Data(BaseData):
__slots__ = ('frame_index', 'frame_path')
def __init__(self, base_data: BaseData, frame_index: int, frame_path: Path) -> None:
super().__init__(
base_data.width,
base_data.height,
base_data.num_frames,
base_data.fps,
base_data.tempo,
base_data.angle,
base_data.transparency,
)
self.frame_index = frame_index
self.frame_path = frame_path