yta-video-frame-time 0.0.1__tar.gz → 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of yta-video-frame-time might be problematic. Click here for more details.
- {yta_video_frame_time-0.0.1 → yta_video_frame_time-0.0.3}/PKG-INFO +2 -1
- {yta_video_frame_time-0.0.1 → yta_video_frame_time-0.0.3}/pyproject.toml +2 -1
- {yta_video_frame_time-0.0.1 → yta_video_frame_time-0.0.3}/src/yta_video_frame_time/__init__.py +52 -2
- {yta_video_frame_time-0.0.1 → yta_video_frame_time-0.0.3}/LICENSE +0 -0
- {yta_video_frame_time-0.0.1 → yta_video_frame_time-0.0.3}/README.md +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: yta-video-frame-time
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: Youtube Autonomous Video Frame Time Module
|
|
5
5
|
Author: danialcala94
|
|
6
6
|
Author-email: danielalcalavalera@gmail.com
|
|
7
7
|
Requires-Python: ==3.9
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Requires-Dist: yta_general_utils (>=0.0.1,<1.0.0)
|
|
10
11
|
Requires-Dist: yta_validation (>=0.0.1,<1.0.0)
|
|
11
12
|
Description-Content-Type: text/markdown
|
|
12
13
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "yta-video-frame-time"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.3"
|
|
4
4
|
description = "Youtube Autonomous Video Frame Time Module"
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "danialcala94",email = "danielalcalavalera@gmail.com"}
|
|
@@ -9,6 +9,7 @@ readme = "README.md"
|
|
|
9
9
|
requires-python = "==3.9"
|
|
10
10
|
dependencies = [
|
|
11
11
|
"yta_validation (>=0.0.1,<1.0.0)",
|
|
12
|
+
"yta_general_utils (>=0.0.1,<1.0.0)"
|
|
12
13
|
]
|
|
13
14
|
|
|
14
15
|
[tool.poetry]
|
{yta_video_frame_time-0.0.1 → yta_video_frame_time-0.0.3}/src/yta_video_frame_time/__init__.py
RENAMED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Module to handle frame indexes and times.
|
|
3
3
|
"""
|
|
4
4
|
from yta_validation.parameter import ParameterValidator
|
|
5
|
+
from typing import Union
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
SMALL_AMOUNT_TO_FIX = 0.0000000001
|
|
@@ -36,11 +37,13 @@ class T:
|
|
|
36
37
|
ParameterValidator.validate_mandatory_positive_number('t', t, do_include_zero = True)
|
|
37
38
|
ParameterValidator.validate_mandatory_positive_number('fps', fps, do_include_zero = False)
|
|
38
39
|
|
|
39
|
-
return T.
|
|
40
|
-
|
|
40
|
+
return T.video_frame_time_to_video_frame_index(t, fps) / fps + SMALL_AMOUNT_TO_FIX
|
|
41
|
+
|
|
41
42
|
def get_frame_indexes(
|
|
42
43
|
duration: float,
|
|
43
44
|
fps: float,
|
|
45
|
+
start: Union[float, None] = None,
|
|
46
|
+
end: Union[float, None] = None,
|
|
44
47
|
do_invert_order: bool = False
|
|
45
48
|
):
|
|
46
49
|
"""
|
|
@@ -59,6 +62,28 @@ class T:
|
|
|
59
62
|
# If you remove 'list' you get a generator instead
|
|
60
63
|
frame_indexes = list(range(get_number_of_frames(duration, fps)))
|
|
61
64
|
|
|
65
|
+
# TODO: Maybe move this to a helper (?)
|
|
66
|
+
# Limit to ['start', 'end'] range
|
|
67
|
+
if (
|
|
68
|
+
start is not None or
|
|
69
|
+
end is not None
|
|
70
|
+
):
|
|
71
|
+
start = (
|
|
72
|
+
T.video_frame_time_to_video_frame_index(start, fps)
|
|
73
|
+
if start is not None else
|
|
74
|
+
0.0
|
|
75
|
+
)
|
|
76
|
+
end = (
|
|
77
|
+
T.video_frame_time_to_video_frame_index(end, fps)
|
|
78
|
+
if end is not None else
|
|
79
|
+
9999999999
|
|
80
|
+
)
|
|
81
|
+
frame_indexes = [
|
|
82
|
+
frame_index
|
|
83
|
+
for frame_index in frame_indexes
|
|
84
|
+
if start <= frame_index < end
|
|
85
|
+
]
|
|
86
|
+
|
|
62
87
|
return (
|
|
63
88
|
frame_indexes[::-1]
|
|
64
89
|
if do_invert_order else
|
|
@@ -286,6 +311,8 @@ class T:
|
|
|
286
311
|
def get_frame_time_moments(
|
|
287
312
|
duration: float,
|
|
288
313
|
fps: float,
|
|
314
|
+
start: Union[float, None] = None,
|
|
315
|
+
end: Union[float, None] = None,
|
|
289
316
|
do_invert_order: bool = False
|
|
290
317
|
):
|
|
291
318
|
"""
|
|
@@ -313,6 +340,28 @@ class T:
|
|
|
313
340
|
for i in range(get_number_of_frames(duration, fps) + 1)
|
|
314
341
|
][:-1]
|
|
315
342
|
|
|
343
|
+
# TODO: Maybe move this to a helper (?)
|
|
344
|
+
# Limit to ['start', 'end'] range
|
|
345
|
+
if (
|
|
346
|
+
start is not None or
|
|
347
|
+
end is not None
|
|
348
|
+
):
|
|
349
|
+
start = (
|
|
350
|
+
start
|
|
351
|
+
if start is not None else
|
|
352
|
+
0.0
|
|
353
|
+
)
|
|
354
|
+
end = (
|
|
355
|
+
end
|
|
356
|
+
if end is not None else
|
|
357
|
+
9999999999
|
|
358
|
+
)
|
|
359
|
+
frame_time_moments = [
|
|
360
|
+
frame_time_moment
|
|
361
|
+
for frame_time_moment in frame_time_moments
|
|
362
|
+
if start <= frame_time_moment < end
|
|
363
|
+
]
|
|
364
|
+
|
|
316
365
|
return (
|
|
317
366
|
frame_time_moments[::-1]
|
|
318
367
|
if do_invert_order else
|
|
@@ -409,6 +458,7 @@ class T:
|
|
|
409
458
|
ParameterValidator.validate_mandatory_positive_number('audio_fps', audio_fps, do_include_zero = False)
|
|
410
459
|
ParameterValidator.validate_mandatory_bool('do_invert_order', do_invert_order)
|
|
411
460
|
|
|
461
|
+
# TODO: This import is bringin many libraries...
|
|
412
462
|
from yta_general_utils.math.progression import Progression
|
|
413
463
|
|
|
414
464
|
audio_frames_per_video_frame = int(audio_fps / video_fps)
|
|
File without changes
|
|
File without changes
|