Skip to content

Commit 092100d

Browse files
committed
docs: add docstrings
1 parent 2c3d152 commit 092100d

File tree

3 files changed

+18
-668
lines changed

3 files changed

+18
-668
lines changed

videodb/_constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class Status:
9191

9292
class HttpClientDefaultValues:
9393
max_retries = 1
94-
timeout = 59
94+
timeout = 30
9595
backoff_factor = 0.1
9696
status_forcelist = [502, 503, 504]
9797

videodb/editor.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,20 @@ class AssetType(str, Enum):
1515

1616

1717
class Fit(str, Enum):
18-
"""The fit mode to apply to the asset."""
18+
"""Set how the asset should be scaled to fit the viewport using one of the following options:
19+
crop (default) - scale the asset to fill the viewport while maintaining the aspect ratio. The asset will be cropped if it exceeds the bounds of the viewport.
20+
21+
cover - stretch the asset to fill the viewport without maintaining the aspect ratio.
22+
contain - fit the entire asset within the viewport while maintaining the original aspect ratio.
23+
none - preserves the original asset dimensions and does not apply any scaling."""
1924

2025
crop = "crop"
2126
cover = "cover"
2227
contain = "contain"
2328

2429

2530
class Position(str, Enum):
26-
"""The position of the asset on the timeline."""
31+
"""Place the asset in one of nine predefined positions of the viewport. This is most effective for when the asset is scaled and you want to position the element to a specific position."""
2732

2833
top = "top"
2934
bottom = "bottom"
@@ -607,6 +612,8 @@ def to_json(self):
607612

608613

609614
class TrackItem:
615+
"""Clip wrapper"""
616+
610617
def __init__(self, start: int, clip: Clip):
611618
self.start = start
612619
self.clip = clip
@@ -619,11 +626,15 @@ def to_json(self):
619626

620627

621628
class Track:
629+
"""A track contains an array of clips. Tracks are layered on top of each other in the order in the array. The top most track will render on top of those below it."""
630+
622631
def __init__(self, z_index: int = 0):
623632
self.clips: List[TrackItem] = []
624633
self.z_index: int = z_index
625634

626635
def add_clip(self, start: int, clip: Clip):
636+
"""Add a clip to the track."""
637+
627638
self.clips.append(TrackItem(start, clip))
628639

629640
def to_json(self):
@@ -633,7 +644,9 @@ def to_json(self):
633644
}
634645

635646

636-
class TimelineV2:
647+
class Timeline:
648+
"""A timeline represents the contents of a video edit over time, an audio edit over time, in seconds, or an image layout. A timeline consists of layers called tracks. Tracks are composed of titles, images, audio, html or video segments referred to as clips which are placed along the track at specific starting point and lasting for a specific amount of time."""
649+
637650
def __init__(self, connection):
638651
self.connection = connection
639652
self.background: str = "#000000"
@@ -667,7 +680,7 @@ def generate_stream(self):
667680

668681
def download_stream(self, stream_url: str):
669682
"""Download a stream from the timeline."""
670-
683+
671684
return self.connection.post(
672685
path=f"{ApiPath.editor}/{ApiPath.download}", data={"stream_url": stream_url}
673686
)

0 commit comments

Comments
 (0)