Skip to content

Commit

Permalink
fix: rename mapping attribute of AudioStream to mapping_ (#121)
Browse files Browse the repository at this point in the history
fix: resolve issue where mapping attribute of AudioStream could not be set
fix(deps): require proto-plus >= 1.20.1

* chore: use gapic-generator-python 0.58.4
committer: dovs
PiperOrigin-RevId: 419025932

Source-Link: googleapis/googleapis@73da669

Source-Link: googleapis/googleapis-gen@46df624
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDZkZjYyNGE1NGI5ZWQ0N2MxYTdlZWZiN2E0OTQxM2NmN2I4MmY5OCJ9

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix(deps): require proto-plus >= 1.20.1

* ensure proto-plus>=1.20.1 is used for testing

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Dov Shlachter <[email protected]>
Co-authored-by: Anthonios Partheniou <[email protected]>
  • Loading branch information
4 people authored Feb 15, 2022
1 parent f1c10f1 commit 5856799
Show file tree
Hide file tree
Showing 12 changed files with 115 additions and 198 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def __init__(
credentials, _ = google.auth.load_credentials_from_file(
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
)

elif credentials is None:
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ class AudioStream(proto.Message):
- ``sr`` - Side right channel
- ``fc`` - Front center channel
- ``lfe`` - Low frequency
mapping (Sequence[google.cloud.video.transcoder_v1.types.AudioStream.AudioMapping]):
mapping_ (Sequence[google.cloud.video.transcoder_v1.types.AudioStream.AudioMapping]):
The mapping for the ``Job.edit_list`` atoms with audio
``EditAtom.inputs``.
sample_rate_hertz (int):
Expand Down Expand Up @@ -1389,7 +1389,7 @@ class AudioMapping(proto.Message):
bitrate_bps = proto.Field(proto.INT32, number=2,)
channel_count = proto.Field(proto.INT32, number=3,)
channel_layout = proto.RepeatedField(proto.STRING, number=4,)
mapping = proto.RepeatedField(proto.MESSAGE, number=5, message=AudioMapping,)
mapping_ = proto.RepeatedField(proto.MESSAGE, number=5, message=AudioMapping,)
sample_rate_hertz = proto.Field(proto.INT32, number=6,)


Expand All @@ -1408,7 +1408,7 @@ class TextStream(proto.Message):
- ``cea608``
- ``cea708``
- ``webvtt``
mapping (Sequence[google.cloud.video.transcoder_v1.types.TextStream.TextMapping]):
mapping_ (Sequence[google.cloud.video.transcoder_v1.types.TextStream.TextMapping]):
The mapping for the ``Job.edit_list`` atoms with text
``EditAtom.inputs``.
"""
Expand All @@ -1433,7 +1433,7 @@ class TextMapping(proto.Message):
input_track = proto.Field(proto.INT32, number=3,)

codec = proto.Field(proto.STRING, number=1,)
mapping = proto.RepeatedField(proto.MESSAGE, number=3, message=TextMapping,)
mapping_ = proto.RepeatedField(proto.MESSAGE, number=3, message=TextMapping,)


class SegmentSettings(proto.Message):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def __init__(
credentials, _ = google.auth.load_credentials_from_file(
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
)

elif credentials is None:
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ class AudioStream(proto.Message):
- 'sr' - Side right channel
- 'fc' - Front center channel
- 'lfe' - Low frequency
mapping (Sequence[google.cloud.video.transcoder_v1beta1.types.AudioStream.AudioAtom]):
mapping_ (Sequence[google.cloud.video.transcoder_v1beta1.types.AudioStream.AudioAtom]):
The mapping for the ``Job.edit_list`` atoms with audio
``EditAtom.inputs``.
sample_rate_hertz (int):
Expand Down Expand Up @@ -1161,7 +1161,7 @@ class AudioChannelInput(proto.Message):
bitrate_bps = proto.Field(proto.INT32, number=2,)
channel_count = proto.Field(proto.INT32, number=3,)
channel_layout = proto.RepeatedField(proto.STRING, number=4,)
mapping = proto.RepeatedField(proto.MESSAGE, number=5, message=AudioAtom,)
mapping_ = proto.RepeatedField(proto.MESSAGE, number=5, message=AudioAtom,)
sample_rate_hertz = proto.Field(proto.INT32, number=6,)


Expand All @@ -1184,7 +1184,7 @@ class TextStream(proto.Message):
Required. The BCP-47 language code, such as ``"en-US"`` or
``"sr-Latn"``. For more information, see
https://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
mapping (Sequence[google.cloud.video.transcoder_v1beta1.types.TextStream.TextAtom]):
mapping_ (Sequence[google.cloud.video.transcoder_v1beta1.types.TextStream.TextAtom]):
The mapping for the ``Job.edit_list`` atoms with text
``EditAtom.inputs``.
"""
Expand Down Expand Up @@ -1223,7 +1223,7 @@ class TextInput(proto.Message):

codec = proto.Field(proto.STRING, number=1,)
language_code = proto.Field(proto.STRING, number=2,)
mapping = proto.RepeatedField(proto.MESSAGE, number=3, message=TextAtom,)
mapping_ = proto.RepeatedField(proto.MESSAGE, number=3, message=TextAtom,)


class SegmentSettings(proto.Message):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@


def create_job_with_embedded_captions(
project_id,
location,
input_video_uri,
input_captions_uri,
output_uri,
project_id, location, input_video_uri, input_captions_uri, output_uri,
):
"""Creates a job based on an ad-hoc job configuration that embeds captions in the output video.
Expand All @@ -57,19 +53,12 @@ def create_job_with_embedded_captions(
job.output_uri = output_uri
job.config = transcoder_v1.types.JobConfig(
inputs=[
transcoder_v1.types.Input(
key="input0",
uri=input_video_uri,
),
transcoder_v1.types.Input(
key="caption-input0",
uri=input_captions_uri,
),
transcoder_v1.types.Input(key="input0", uri=input_video_uri,),
transcoder_v1.types.Input(key="caption-input0", uri=input_captions_uri,),
],
edit_list=[
transcoder_v1.types.EditAtom(
key="atom0",
inputs=["input0", "caption-input0"],
key="atom0", inputs=["input0", "caption-input0"],
),
],
elementary_streams=[
Expand Down Expand Up @@ -131,9 +120,7 @@ def create_job_with_embedded_captions(
elementary_streams=["video-stream0", "audio-stream0"],
),
transcoder_v1.types.MuxStream(
key="sd-dash",
container="fmp4",
elementary_streams=["video-stream0"],
key="sd-dash", container="fmp4", elementary_streams=["video-stream0"],
),
transcoder_v1.types.MuxStream(
key="audio-dash",
Expand All @@ -143,9 +130,7 @@ def create_job_with_embedded_captions(
],
manifests=[
transcoder_v1.types.Manifest(
file_name="manifest.m3u8",
type_="HLS",
mux_streams=["sd-hls"],
file_name="manifest.m3u8", type_="HLS", mux_streams=["sd-hls"],
),
transcoder_v1.types.Manifest(
file_name="manifest.mpd",
Expand All @@ -165,9 +150,7 @@ def create_job_with_embedded_captions(
parser = argparse.ArgumentParser()
parser.add_argument("--project_id", help="Your Cloud project ID.", required=True)
parser.add_argument(
"--location",
help="The location to start this job in.",
default="us-central1",
"--location", help="The location to start this job in.", default="us-central1",
)
parser.add_argument(
"--input_video_uri",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@


def create_job_with_standalone_captions(
project_id,
location,
input_video_uri,
input_captions_uri,
output_uri,
project_id, location, input_video_uri, input_captions_uri, output_uri,
):
"""Creates a job based on an ad-hoc job configuration that can use captions from a standalone file.
Expand All @@ -58,19 +54,12 @@ def create_job_with_standalone_captions(
job.output_uri = output_uri
job.config = transcoder_v1.types.JobConfig(
inputs=[
transcoder_v1.types.Input(
key="input0",
uri=input_video_uri,
),
transcoder_v1.types.Input(
key="caption-input0",
uri=input_captions_uri,
),
transcoder_v1.types.Input(key="input0", uri=input_video_uri,),
transcoder_v1.types.Input(key="caption-input0", uri=input_captions_uri,),
],
edit_list=[
transcoder_v1.types.EditAtom(
key="atom0",
inputs=["input0", "caption-input0"],
key="atom0", inputs=["input0", "caption-input0"],
),
],
elementary_streams=[
Expand Down Expand Up @@ -136,9 +125,7 @@ def create_job_with_standalone_captions(
container="vtt",
elementary_streams=["vtt-stream0"],
segment_settings=transcoder_v1.types.SegmentSettings(
segment_duration=duration.Duration(
seconds=6,
),
segment_duration=duration.Duration(seconds=6,),
individual_segments=True,
),
),
Expand All @@ -162,9 +149,7 @@ def create_job_with_standalone_captions(
parser = argparse.ArgumentParser()
parser.add_argument("--project_id", help="Your Cloud project ID.", required=True)
parser.add_argument(
"--location",
help="The location to start this job in.",
default="us-central1",
"--location", help="The location to start this job in.", default="us-central1",
)
parser.add_argument(
"--input_video_uri",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@
output_uri_for_animated_overlay = (
f"gs://{output_bucket_name}/test-output-animated-overlay/"
)
output_uri_for_embedded_captions = f"gs://{output_bucket_name}/test-output-embedded-captions/"
output_uri_for_standalone_captions = f"gs://{output_bucket_name}/test-output-standalone-captions/"
output_uri_for_embedded_captions = (
f"gs://{output_bucket_name}/test-output-embedded-captions/"
)
output_uri_for_standalone_captions = (
f"gs://{output_bucket_name}/test-output-standalone-captions/"
)

small_spritesheet_file_prefix = "small-sprite-sheet"
large_spritesheet_file_prefix = "large-sprite-sheet"
Expand Down Expand Up @@ -267,10 +271,7 @@ def test_create_job_with_animated_overlay(capsys, test_bucket):

def test_create_job_with_set_number_spritesheet(capsys, test_bucket):
create_job_with_set_number_images_spritesheet.create_job_with_set_number_images_spritesheet(
project_id,
location,
input_uri,
output_uri_for_set_number_spritesheet,
project_id, location, input_uri, output_uri_for_set_number_spritesheet,
)
out, _ = capsys.readouterr()
job_name_prefix = f"projects/{project_number}/locations/{location}/jobs/"
Expand Down Expand Up @@ -318,10 +319,7 @@ def test_create_job_with_set_number_spritesheet(capsys, test_bucket):

def test_create_job_with_periodic_spritesheet(capsys, test_bucket):
create_job_with_periodic_images_spritesheet.create_job_with_periodic_images_spritesheet(
project_id,
location,
input_uri,
output_uri_for_periodic_spritesheet,
project_id, location, input_uri, output_uri_for_periodic_spritesheet,
)
out, _ = capsys.readouterr()
job_name_prefix = f"projects/{project_number}/locations/{location}/jobs/"
Expand Down Expand Up @@ -409,11 +407,7 @@ def test_create_job_with_concatenated_inputs(capsys, test_bucket):

def test_create_job_with_embedded_captions(capsys, test_bucket):
create_job_with_embedded_captions.create_job_with_embedded_captions(
project_id,
location,
input_uri,
captions_uri,
output_uri_for_embedded_captions,
project_id, location, input_uri, captions_uri, output_uri_for_embedded_captions,
)
out, _ = capsys.readouterr()
job_name_prefix = f"projects/{project_number}/locations/{location}/jobs/"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
backoff==1.11.1
google-cloud-storage==1.43.0
pytest==6.2.4
proto-plus>=1.20.1
6 changes: 5 additions & 1 deletion packages/google-cloud-video-transcoder/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@
# Until this issue is closed
# https://github.com/googleapis/google-cloud-python/issues/10566
"google-api-core[grpc] >= 1.28.0, <3.0.0dev",
"proto-plus >= 1.4.0",
# Require proto-plus >= 1.20.1 which includes
# a fix to mitigate collisions in field names, specifically
# the `mapping` term which is a reserved term in proto-plus.
# https://github.com/googleapis/proto-plus-python/pull/295
"proto-plus >= 1.20.1",
),
python_requires=">=3.6",
classifiers=[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev",
# Then this file should have foo==1.14.0
google-api-core==1.28.0
proto-plus==1.4.0
proto-plus==1.20.1
Loading

0 comments on commit 5856799

Please sign in to comment.