Skip to content

Commit ba4f07e

Browse files
committed
fix: remove SceneExtractionConfig
1 parent 08b6d5f commit ba4f07e

File tree

2 files changed

+9
-39
lines changed

2 files changed

+9
-39
lines changed

videodb/scene.py

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,6 @@
55
from videodb.image import Frame
66

77

8-
class SceneExtractionConfig:
9-
def __init__(
10-
self,
11-
time: int = 5,
12-
threshold: int = 20,
13-
frame_count: int = 1,
14-
select_frame: str = "first",
15-
):
16-
self.time = time
17-
self.threshold = threshold
18-
self.frame_count = frame_count
19-
self.select_frame = select_frame
20-
21-
def __repr__(self) -> str:
22-
return (
23-
f"SceneExtractionConfig("
24-
f"time={self.time}, "
25-
f"threshold={self.threshold}, "
26-
f"frame_count={self.frame_count}, "
27-
f"select_frame={self.select_frame})"
28-
)
29-
30-
318
class Scene:
329
def __init__(
3310
self,
@@ -73,21 +50,21 @@ def __init__(
7350
_connection,
7451
id: str,
7552
video_id: str,
76-
config: SceneExtractionConfig,
53+
config: dict,
7754
scenes: List[Scene],
7855
) -> None:
7956
self._connection = _connection
8057
self.id = id
8158
self.video_id = video_id
82-
self.config: SceneExtractionConfig = config
59+
self.config: dict = config
8360
self.scenes: List[Scene] = scenes
8461

8562
def __repr__(self) -> str:
8663
return (
8764
f"SceneCollection("
8865
f"id={self.id}, "
8966
f"video_id={self.video_id}, "
90-
f"config={self.config.__dict__}, "
67+
f"config={self.config}, "
9168
f"scenes={self.scenes})"
9269
)
9370

videodb/video.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Workflows,
1010
)
1111
from videodb.image import Image, Frame
12-
from videodb.scene import SceneExtractionConfig, Scene, SceneCollection
12+
from videodb.scene import Scene, SceneCollection
1313
from videodb.search import SearchFactory, SearchResult
1414
from videodb.shot import Shot
1515

@@ -213,25 +213,18 @@ def _format_scene_collection(self, collection_data: dict) -> SceneCollection:
213213
)
214214
scenes.append(scene)
215215

216-
config = collection_data.get("config", {})
217-
218216
return SceneCollection(
219217
self._connection,
220218
collection_data.get("scenes_collection_id"),
221219
self.id,
222-
SceneExtractionConfig(
223-
config.get("time"),
224-
config.get("threshold"),
225-
config.get("frame_count"),
226-
config.get("select_frame"),
227-
),
220+
collection_data.get("config", {}),
228221
scenes,
229222
)
230223

231224
def extract_scenes(
232225
self,
233226
extraction_type: SceneExtractionType = SceneExtractionType.scene,
234-
extraction_config: SceneExtractionConfig = SceneExtractionConfig(),
227+
extraction_config: dict = {},
235228
force: bool = False,
236229
callback_url: str = None,
237230
):
@@ -240,7 +233,7 @@ def extract_scenes(
240233
data={
241234
"index_type": IndexType.scene,
242235
"extraction_type": extraction_type,
243-
"extraction_config": extraction_config.__dict__,
236+
"extraction_config": extraction_config,
244237
"force": force,
245238
"callback_url": callback_url,
246239
},
@@ -267,7 +260,7 @@ def delete_scene_collection(self, collection_id: str) -> None:
267260
def create_scene_index(
268261
self,
269262
extraction_type: SceneExtractionType = SceneExtractionType.scene,
270-
extraction_config: SceneExtractionConfig = SceneExtractionConfig(),
263+
extraction_config: dict = {},
271264
scenes: List[Scene] = [],
272265
force: bool = False,
273266
callback_url: str = None,
@@ -277,7 +270,7 @@ def create_scene_index(
277270
data={
278271
"scenes": [scene.to_json() for scene in scenes],
279272
"extraction_type": extraction_type,
280-
"extraction_config": extraction_config.__dict__,
273+
"extraction_config": extraction_config,
281274
"force": force,
282275
"callback_url": callback_url,
283276
},

0 commit comments

Comments
 (0)