Skip to content

Commit

Permalink
Merge pull request #99 from apivideo/add-transcript-feature
Browse files Browse the repository at this point in the history
Add transcript feature
  • Loading branch information
bot-api-video authored Oct 8, 2024
2 parents 041c955 + eff9a80 commit 696bdd2
Show file tree
Hide file tree
Showing 24 changed files with 155 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All changes to this project will be documented in this file.

## [1.4.4] - 2024-10-08
- Add transcript feature

## [1.4.3] - 2024-09-30
- Add /tags API endpoint

Expand Down
2 changes: 1 addition & 1 deletion apivideo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""


__version__ = "1.4.3"
__version__ = "1.4.4"

# import ApiVideoClient
from apivideo.auth_api_client import AuthenticatedApiClient
Expand Down
2 changes: 1 addition & 1 deletion apivideo/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
self.default_headers[header_name] = header_value
self.cookie = cookie

self.default_headers['AV-Origin-Client'] = "python:1.4.3"
self.default_headers['AV-Origin-Client'] = "python:1.4.4"

def __enter__(self):
return self
Expand Down
2 changes: 1 addition & 1 deletion apivideo/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def to_debug_report(self):
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 1\n"\
"SDK Package Version: 1.4.3".\
"SDK Package Version: 1.4.4".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
11 changes: 11 additions & 0 deletions apivideo/model/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ class Video(ModelNormal):
"""

allowed_values = {
('language_origin',): {
'None': None,
'API': "api",
'AUTO': "auto",
},
}

validations = {
Expand Down Expand Up @@ -89,6 +94,8 @@ def openapi_types():
'discarded_at': (datetime, none_type,), # noqa: E501
'deletes_at': (datetime, none_type,), # noqa: E501
'discarded': (bool,), # noqa: E501
'language': (str,), # noqa: E501
'language_origin': (str, none_type,), # noqa: E501
'tags': ([str],), # noqa: E501
'metadata': ([Metadata],), # noqa: E501
'source': (VideoSource,), # noqa: E501
Expand All @@ -114,6 +121,8 @@ def discriminator():
'discarded_at': 'discardedAt', # noqa: E501
'deletes_at': 'deletesAt', # noqa: E501
'discarded': 'discarded', # noqa: E501
'language': 'language', # noqa: E501
'language_origin': 'languageOrigin', # noqa: E501
'tags': 'tags', # noqa: E501
'metadata': 'metadata', # noqa: E501
'source': 'source', # noqa: E501
Expand Down Expand Up @@ -181,6 +190,8 @@ def __init__(self, video_id, *args, **kwargs): # noqa: E501
discarded_at (datetime, none_type): The date and time the video was discarded. The API populates this field only if you have the Video Restore feature enabled and discard a video. Date and time are provided using ATOM UTC format.. [optional] # noqa: E501
deletes_at (datetime, none_type): The date and time the video will be permanently deleted. The API populates this field only if you have the Video Restore feature enabled and discard a video. Discarded videos are pemanently deleted after 90 days. Date and time are provided using ATOM UTC format.. [optional] # noqa: E501
discarded (bool): Returns `true` for videos you discarded when you have the Video Restore feature enabled. Returns `false` for every other video.. [optional] # noqa: E501
language (str): Returns the language of a video in [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. You can set the language during video creation via the API, otherwise it is detected automatically.. [optional] # noqa: E501
language_origin (str, none_type): Returns the origin of the last update on the video's `language` attribute. - `api` means that the last update was requested from the API. - `auto` means that the last update was done automatically by the API.. [optional] # noqa: E501
tags ([str]): One array of tags (each tag is a string) in order to categorize a video. Tags may include spaces. . [optional] # noqa: E501
metadata ([Metadata]): Metadata you can use to categorise and filter videos. Metadata is a list of dictionaries, where each dictionary represents a key value pair for categorising a video. . [optional] # noqa: E501
source (VideoSource): [optional] # noqa: E501
Expand Down
41 changes: 41 additions & 0 deletions apivideo/model/video_creation_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,41 @@ class VideoCreationPayload(ModelNormal):
"""

allowed_values = {
('language',): {
'AR': "ar",
'CA': "ca",
'CS': "cs",
'DA': "da",
'DE': "de",
'EL': "el",
'EN': "en",
'ES': "es",
'FA': "fa",
'FI': "fi",
'FR': "fr",
'HE': "he",
'HI': "hi",
'HR': "hr",
'HU': "hu",
'IT': "it",
'JA': "ja",
'KO': "ko",
'ML': "ml",
'NL': "nl",
'NN': "nn",
'FALSE': "false",
'PL': "pl",
'PT': "pt",
'RU': "ru",
'SK': "sk",
'SL': "sl",
'TE': "te",
'TR': "tr",
'UK': "uk",
'UR': "ur",
'VI': "vi",
'ZH': "zh",
},
}

validations = {
Expand Down Expand Up @@ -91,6 +126,8 @@ def openapi_types():
'metadata': ([Metadata],), # noqa: E501
'clip': (VideoClip,), # noqa: E501
'watermark': (VideoWatermark,), # noqa: E501
'language': (str,), # noqa: E501
'transcript': (bool,), # noqa: E501
}

@cached_property
Expand All @@ -110,6 +147,8 @@ def discriminator():
'metadata': 'metadata', # noqa: E501
'clip': 'clip', # noqa: E501
'watermark': 'watermark', # noqa: E501
'language': 'language', # noqa: E501
'transcript': 'transcript', # noqa: E501
}

_composed_schemas = {}
Expand Down Expand Up @@ -171,6 +210,8 @@ def __init__(self, title, *args, **kwargs): # noqa: E501
metadata ([Metadata]): A list of key value pairs that you use to provide metadata for your video.. [optional] # noqa: E501
clip (VideoClip): [optional] # noqa: E501
watermark (VideoWatermark): [optional] # noqa: E501
language (str): Use this parameter to set the language of the video. When this parameter is set, the API creates a transcript of the video using the language you specify. You must use the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. `language` is a permanent attribute of the video. You can update it to another language using the [`PATCH /videos/{videoId}`](https://docs.api.video/reference/api/Videos#update-a-video-object) operation. This triggers the API to generate a new transcript using a different language.. [optional] # noqa: E501
transcript (bool): Use this parameter to enable transcription. - When `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video.. [optional] # noqa: E501
"""

_check_type = kwargs.pop('_check_type', True)
Expand Down
41 changes: 41 additions & 0 deletions apivideo/model/video_update_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,41 @@ class VideoUpdatePayload(ModelNormal):
"""

allowed_values = {
('language',): {
'AR': "ar",
'CA': "ca",
'CS': "cs",
'DA': "da",
'DE': "de",
'EL': "el",
'EN': "en",
'ES': "es",
'FA': "fa",
'FI': "fi",
'FR': "fr",
'HE': "he",
'HI': "hi",
'HR': "hr",
'HU': "hu",
'IT': "it",
'JA': "ja",
'KO': "ko",
'ML': "ml",
'NL': "nl",
'NN': "nn",
'FALSE': "false",
'PL': "pl",
'PT': "pt",
'RU': "ru",
'SK': "sk",
'SL': "sl",
'TE': "te",
'TR': "tr",
'UK': "uk",
'UR': "ur",
'VI': "vi",
'ZH': "zh",
},
}

validations = {
Expand Down Expand Up @@ -84,6 +119,8 @@ def openapi_types():
'mp4_support': (bool,), # noqa: E501
'tags': ([str],), # noqa: E501
'metadata': ([Metadata],), # noqa: E501
'language': (str,), # noqa: E501
'transcript': (bool,), # noqa: E501
}

@cached_property
Expand All @@ -100,6 +137,8 @@ def discriminator():
'mp4_support': 'mp4Support', # noqa: E501
'tags': 'tags', # noqa: E501
'metadata': 'metadata', # noqa: E501
'language': 'language', # noqa: E501
'transcript': 'transcript', # noqa: E501
}

_composed_schemas = {}
Expand Down Expand Up @@ -156,6 +195,8 @@ def __init__(self, *args, **kwargs): # noqa: E501
mp4_support (bool): Whether the player supports the mp4 format.. [optional] # noqa: E501
tags ([str]): A list of terms or words you want to tag the video with. Make sure the list includes all the tags you want as whatever you send in this list will overwrite the existing list for the video.. [optional] # noqa: E501
metadata ([Metadata]): A list (array) of dictionaries where each dictionary contains a key value pair that describes the video. As with tags, you must send the complete list of metadata you want as whatever you send here will overwrite the existing metadata for the video.. [optional] # noqa: E501
language (str): Use this parameter to set the language of the video. When this parameter is set, the API creates a transcript of the video using the language you specify. You must use the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. `language` is a permanent attribute of the video. You can update it to another language using the [`PATCH /videos/{videoId}`](https://docs.api.video/reference/api/Videos#update-a-video-object) operation. This triggers the API to generate a new transcript using a different language.. [optional] # noqa: E501
transcript (bool): Use this parameter to enable transcription. - When `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video.. [optional] # noqa: E501
"""

_check_type = kwargs.pop('_check_type', True)
Expand Down
2 changes: 2 additions & 0 deletions docs/Video.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Name | Type | Description | Notes
**discarded_at** | **datetime, none_type** | The date and time the video was discarded. The API populates this field only if you have the Video Restore feature enabled and discard a video. Date and time are provided using ATOM UTC format. | [optional]
**deletes_at** | **datetime, none_type** | The date and time the video will be permanently deleted. The API populates this field only if you have the Video Restore feature enabled and discard a video. Discarded videos are pemanently deleted after 90 days. Date and time are provided using ATOM UTC format. | [optional]
**discarded** | **bool** | Returns `true` for videos you discarded when you have the Video Restore feature enabled. Returns `false` for every other video. | [optional]
**language** | **str** | Returns the language of a video in [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. You can set the language during video creation via the API, otherwise it is detected automatically. | [optional]
**language_origin** | **str, none_type** | Returns the origin of the last update on the video's `language` attribute. - `api` means that the last update was requested from the API. - `auto` means that the last update was done automatically by the API. | [optional]
**tags** | **[str]** | One array of tags (each tag is a string) in order to categorize a video. Tags may include spaces. | [optional]
**metadata** | [**[Metadata]**](Metadata.md) | Metadata you can use to categorise and filter videos. Metadata is a list of dictionaries, where each dictionary represents a key value pair for categorising a video. | [optional]
**source** | [**VideoSource**](VideoSource.md) | | [optional]
Expand Down
2 changes: 2 additions & 0 deletions docs/VideoCreationPayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Name | Type | Description | Notes
**metadata** | [**[Metadata]**](Metadata.md) | A list of key value pairs that you use to provide metadata for your video. | [optional]
**clip** | [**VideoClip**](VideoClip.md) | | [optional]
**watermark** | [**VideoWatermark**](VideoWatermark.md) | | [optional]
**language** | **str** | Use this parameter to set the language of the video. When this parameter is set, the API creates a transcript of the video using the language you specify. You must use the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. `language` is a permanent attribute of the video. You can update it to another language using the [`PATCH /videos/{videoId}`](https://docs.api.video/reference/api/Videos#update-a-video-object) operation. This triggers the API to generate a new transcript using a different language. | [optional]
**transcript** | **bool** | Use this parameter to enable transcription. - When `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video. | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
2 changes: 2 additions & 0 deletions docs/VideoUpdatePayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Name | Type | Description | Notes
**mp4_support** | **bool** | Whether the player supports the mp4 format. | [optional]
**tags** | **[str]** | A list of terms or words you want to tag the video with. Make sure the list includes all the tags you want as whatever you send in this list will overwrite the existing list for the video. | [optional]
**metadata** | [**[Metadata]**](Metadata.md) | A list (array) of dictionaries where each dictionary contains a key value pair that describes the video. As with tags, you must send the complete list of metadata you want as whatever you send here will overwrite the existing metadata for the video. | [optional]
**language** | **str** | Use this parameter to set the language of the video. When this parameter is set, the API creates a transcript of the video using the language you specify. You must use the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. `language` is a permanent attribute of the video. You can update it to another language using the [`PATCH /videos/{videoId}`](https://docs.api.video/reference/api/Videos#update-a-video-object) operation. This triggers the API to generate a new transcript using a different language. | [optional]
**transcript** | **bool** | Use this parameter to enable transcription. - When `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video. | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
4 changes: 4 additions & 0 deletions docs/VideosApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client:
height="initial",
opacity="70%",
),
language="fr",
transcript=True,
) # VideoCreationPayload | video to create

# example passing only required values which don't have defaults set
Expand Down Expand Up @@ -421,6 +423,8 @@ with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client:
value="Green",
),
],
language="fr",
transcript=True,
) # VideoUpdatePayload |

# example passing only required values which don't have defaults set
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from setuptools import setup, find_packages # noqa: H301

NAME = "api.video"
VERSION = "1.4.3"
VERSION = "1.4.4"
# To install the library, run the following
#
# python setup.py install
Expand Down
2 changes: 2 additions & 0 deletions test/payloads/videos/create/responses/201.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"videoId" : "vi4blUQJFrYWbaG44NChkH27",
"title" : "Maths video",
"description" : "An amazing video explaining the string theory",
"language" : "en",
"languageOrigin" : "api",
"public" : false,
"panoramic" : false,
"mp4Support" : true,
Expand Down
7 changes: 7 additions & 0 deletions test/payloads/videos/create/responses/400-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/invalid-attribute",
"title" : "An attribute is invalid.",
"status" : 400,
"detail" : "The \"language\" attribute must contain only letters and dashes (for example \"fr\", \"fr-BE\").",
"name" : "language"
}
7 changes: 7 additions & 0 deletions test/payloads/videos/create/responses/400-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/invalid-attribute",
"title" : "An attribute is invalid.",
"status" : 400,
"detail" : "The \"language\" attribute is not valid.",
"name" : "language"
}
2 changes: 2 additions & 0 deletions test/payloads/videos/get/responses/200.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"playerId" : "pl45KFKdlddgk654dspkze",
"title" : "Maths video",
"description" : "An amazing video explaining string theory",
"language" : "en",
"languageOrigin" : "api",
"public" : false,
"panoramic" : false,
"mp4Support" : true,
Expand Down
6 changes: 6 additions & 0 deletions test/payloads/videos/list/responses/200.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"playerId" : "pl45KFKdlddgk654dspkze",
"title" : "Maths video",
"description" : "An amazing video explaining the string theory",
"language" : "en",
"languageOrigin" : "api",
"public" : false,
"panoramic" : false,
"mp4Support" : true,
Expand Down Expand Up @@ -32,6 +34,8 @@
"videoId" : "vi4blUQJFrYWbaG44NChkH27",
"title" : "Video Title",
"description" : "A description for your video.",
"language" : "en",
"languageOrigin" : "api",
"public" : false,
"panoramic" : false,
"mp4Support" : true,
Expand Down Expand Up @@ -64,6 +68,8 @@
"playerId" : "pl45KFKdlddgk654dspkze",
"title" : "My Video Title",
"description" : "A brief description of the video.",
"language" : "fr",
"languageOrigin" : "api",
"public" : false,
"panoramic" : false,
"mp4Support" : true,
Expand Down
2 changes: 2 additions & 0 deletions test/payloads/videos/update/responses/200.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"playerId" : "pl45KFKdlddgk654dspkze",
"title" : "Maths video",
"description" : "An amazing video explaining the string theory",
"language" : "en",
"languageOrigin" : "api",
"public" : false,
"panoramic" : false,
"mp4Support" : true,
Expand Down
7 changes: 7 additions & 0 deletions test/payloads/videos/update/responses/400-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/invalid-attribute",
"title" : "An attribute is invalid.",
"status" : 400,
"detail" : "The \"language\" attribute must contain only letters and dashes (for example \"fr\", \"fr-BE\").",
"name" : "language"
}
7 changes: 7 additions & 0 deletions test/payloads/videos/update/responses/400-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/invalid-attribute",
"title" : "An attribute is invalid.",
"status" : 400,
"detail" : "The \"language\" attribute is not valid.",
"name" : "language"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"playerId" : "pl45KFKdlddgk654dspkze",
"title" : "Maths video",
"description" : "An amazing video explaining the string theory",
"language" : "en",
"public" : false,
"panoramic" : false,
"tags" : [ "maths", "string theory", "video" ],
Expand Down
4 changes: 4 additions & 0 deletions test/test_videos_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def test_create(self):
height="initial",
opacity="70%",
),
language="fr",
transcript=True,
),
}
url = '/videos'.format(**kwargs)
Expand Down Expand Up @@ -197,6 +199,8 @@ def test_update(self):
value="Green",
),
],
language="fr",
transcript=True,
),
}
url = '/videos/{video_id}'.format(**kwargs)
Expand Down

0 comments on commit 696bdd2

Please sign in to comment.