From c4cf4521c0f0127066abb5b269872be265dbde68 Mon Sep 17 00:00:00 2001 From: Nicholas Cook Date: Thu, 24 Feb 2022 13:46:48 -0800 Subject: [PATCH] docs(samples): update samples to use mapping_ attribute of AudioStream (#142) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: revise samples with fix from #138 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../create_job_with_embedded_captions.py | 31 +++++-------------- .../create_job_with_standalone_captions.py | 31 +++++-------------- 2 files changed, 14 insertions(+), 48 deletions(-) diff --git a/video/transcoder/create_job_with_embedded_captions.py b/video/transcoder/create_job_with_embedded_captions.py index a81e66888181..c28a0668f01f 100644 --- a/video/transcoder/create_job_with_embedded_captions.py +++ b/video/transcoder/create_job_with_embedded_captions.py @@ -81,31 +81,14 @@ def create_job_with_embedded_captions( ), transcoder_v1.types.ElementaryStream( key="cea-stream0", - # The following doesn't work because "mapping" is a reserved - # argument name in GCP python client libraries (see - # https://github.com/googleapis/proto-plus-python/blob/main/proto/message.py#L447): - # - # text_stream=transcoder_v1.types.TextStream( - # codec="cea608", - # mapping=[ - # transcoder_v1.types.TextStream.TextMapping( - # atom_key="atom0", - # input_key="caption-input0", - # input_track=0, - # ), - # ], - # ), - # Use a python dictionary as a workaround: - text_stream={ - "codec": "cea608", - "mapping": [ - { - "atom_key": "atom0", - "input_key": "caption-input0", - "input_track": 0, - } + text_stream=transcoder_v1.types.TextStream( + codec="cea608", + mapping_=[ + transcoder_v1.types.TextStream.TextMapping( + atom_key="atom0", input_key="caption-input0", input_track=0, + ), ], - }, + ), ), ], mux_streams=[ diff --git a/video/transcoder/create_job_with_standalone_captions.py b/video/transcoder/create_job_with_standalone_captions.py index de32f49b176f..49ccfc8b23f4 100644 --- a/video/transcoder/create_job_with_standalone_captions.py +++ b/video/transcoder/create_job_with_standalone_captions.py @@ -82,31 +82,14 @@ def create_job_with_standalone_captions( ), transcoder_v1.types.ElementaryStream( key="vtt-stream0", - # The following doesn't work because "mapping" is a reserved - # argument name in GCP python client libraries (see - # https://github.com/googleapis/proto-plus-python/blob/main/proto/message.py#L447): - # - # text_stream=transcoder_v1.types.TextStream( - # codec="webvtt", - # mapping=[ - # transcoder_v1.types.TextStream.TextMapping( - # atom_key="atom0", - # input_key="caption-input0", - # input_track=0, - # ), - # ], - # ), - # Use a python dictionary as a workaround: - text_stream={ - "codec": "webvtt", - "mapping": [ - { - "atom_key": "atom0", - "input_key": "caption-input0", - "input_track": 0, - } + text_stream=transcoder_v1.types.TextStream( + codec="webvtt", + mapping_=[ + transcoder_v1.types.TextStream.TextMapping( + atom_key="atom0", input_key="caption-input0", input_track=0, + ), ], - }, + ), ), ], mux_streams=[