Skip to content

Commit

Permalink
chore(python): use black==22.3.0 (#167)
Browse files Browse the repository at this point in the history
Source-Link: googleapis/synthtool@6fab84a
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe
  • Loading branch information
gcf-owl-bot[bot] authored and parthea committed Jun 8, 2023
1 parent d92f541 commit 4c972fa
Show file tree
Hide file tree
Showing 12 changed files with 149 additions and 47 deletions.
9 changes: 7 additions & 2 deletions video/transcoder/create_job_from_ad_hoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ def create_job_from_ad_hoc(project_id, location, input_uri, output_uri):
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_uri",
Expand All @@ -114,5 +116,8 @@ def create_job_from_ad_hoc(project_id, location, input_uri, output_uri):
)
args = parser.parse_args()
create_job_from_ad_hoc(
args.project_id, args.location, args.input_uri, args.output_uri,
args.project_id,
args.location,
args.input_uri,
args.output_uri,
)
10 changes: 8 additions & 2 deletions video/transcoder/create_job_from_preset.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def create_job_from_preset(project_id, location, input_uri, output_uri, preset):
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_uri",
Expand All @@ -78,5 +80,9 @@ def create_job_from_preset(project_id, location, input_uri, output_uri, preset):
)
args = parser.parse_args()
create_job_from_preset(
args.project_id, args.location, args.input_uri, args.output_uri, args.preset,
args.project_id,
args.location,
args.input_uri,
args.output_uri,
args.preset,
)
4 changes: 3 additions & 1 deletion video/transcoder/create_job_from_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def create_job_from_template(project_id, location, input_uri, output_uri, templa
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_uri",
Expand Down
29 changes: 21 additions & 8 deletions video/transcoder/create_job_with_animated_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def create_job_with_animated_overlay(
image=transcoder_v1.types.Overlay.Image(
uri=overlay_image_uri,
resolution=transcoder_v1.types.Overlay.NormalizedCoordinate(
x=0, y=0,
x=0,
y=0,
),
alpha=1,
),
Expand All @@ -90,20 +91,30 @@ def create_job_with_animated_overlay(
animation_fade=transcoder_v1.types.Overlay.AnimationFade(
fade_type=transcoder_v1.types.Overlay.FadeType.FADE_IN,
xy=transcoder_v1.types.Overlay.NormalizedCoordinate(
x=0.5, y=0.5,
x=0.5,
y=0.5,
),
start_time_offset=duration.Duration(
seconds=5,
),
end_time_offset=duration.Duration(
seconds=10,
),
start_time_offset=duration.Duration(seconds=5,),
end_time_offset=duration.Duration(seconds=10,),
),
),
transcoder_v1.types.Overlay.Animation(
animation_fade=transcoder_v1.types.Overlay.AnimationFade(
fade_type=transcoder_v1.types.Overlay.FadeType.FADE_OUT,
xy=transcoder_v1.types.Overlay.NormalizedCoordinate(
x=0.5, y=0.5,
x=0.5,
y=0.5,
),
start_time_offset=duration.Duration(
seconds=12,
),
end_time_offset=duration.Duration(
seconds=15,
),
start_time_offset=duration.Duration(seconds=12,),
end_time_offset=duration.Duration(seconds=15,),
),
),
],
Expand All @@ -121,7 +132,9 @@ def create_job_with_animated_overlay(
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_uri",
Expand Down
14 changes: 11 additions & 3 deletions video/transcoder/create_job_with_concatenated_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,14 @@ def create_job_with_concatenated_inputs(
job.output_uri = output_uri
job.config = transcoder_v1.types.JobConfig(
inputs=[
transcoder_v1.types.Input(key="input1", uri=input1_uri,),
transcoder_v1.types.Input(key="input2", uri=input2_uri,),
transcoder_v1.types.Input(
key="input1",
uri=input1_uri,
),
transcoder_v1.types.Input(
key="input2",
uri=input2_uri,
),
],
edit_list=[
transcoder_v1.types.EditAtom(
Expand Down Expand Up @@ -135,7 +141,9 @@ def create_job_with_concatenated_inputs(
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(
"--input1_uri",
Expand Down
35 changes: 27 additions & 8 deletions video/transcoder/create_job_with_embedded_captions.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@


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 @@ -53,12 +57,19 @@ 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 All @@ -85,7 +96,9 @@ def create_job_with_embedded_captions(
codec="cea608",
mapping_=[
transcoder_v1.types.TextStream.TextMapping(
atom_key="atom0", input_key="caption-input0", input_track=0,
atom_key="atom0",
input_key="caption-input0",
input_track=0,
),
],
),
Expand All @@ -103,7 +116,9 @@ 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 @@ -113,7 +128,9 @@ 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 @@ -133,7 +150,9 @@ 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
17 changes: 13 additions & 4 deletions video/transcoder/create_job_with_periodic_images_spritesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,18 @@ def create_job_with_periodic_images_spritesheet(
file_prefix="small-sprite-sheet",
sprite_width_pixels=64,
sprite_height_pixels=32,
interval=duration.Duration(seconds=7,),
interval=duration.Duration(
seconds=7,
),
),
# Generate a sprite sheet with 128x72px images. An image is taken every 7 seconds from the video.
transcoder_v1.types.SpriteSheet(
file_prefix="large-sprite-sheet",
sprite_width_pixels=128,
sprite_height_pixels=72,
interval=duration.Duration(seconds=7,),
interval=duration.Duration(
seconds=7,
),
),
],
)
Expand All @@ -110,7 +114,9 @@ def create_job_with_periodic_images_spritesheet(
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_uri",
Expand All @@ -124,5 +130,8 @@ def create_job_with_periodic_images_spritesheet(
)
args = parser.parse_args()
create_job_with_periodic_images_spritesheet(
args.project_id, args.location, args.input_uri, args.output_uri,
args.project_id,
args.location,
args.input_uri,
args.output_uri,
)
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ def create_job_with_set_number_images_spritesheet(
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_uri",
Expand All @@ -127,5 +129,8 @@ def create_job_with_set_number_images_spritesheet(
)
args = parser.parse_args()
create_job_with_set_number_images_spritesheet(
args.project_id, args.location, args.input_uri, args.output_uri,
args.project_id,
args.location,
args.input_uri,
args.output_uri,
)
31 changes: 24 additions & 7 deletions video/transcoder/create_job_with_standalone_captions.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@


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 @@ -54,12 +58,19 @@ 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 All @@ -86,7 +97,9 @@ def create_job_with_standalone_captions(
codec="webvtt",
mapping_=[
transcoder_v1.types.TextStream.TextMapping(
atom_key="atom0", input_key="caption-input0", input_track=0,
atom_key="atom0",
input_key="caption-input0",
input_track=0,
),
],
),
Expand All @@ -108,7 +121,9 @@ 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 @@ -132,7 +147,9 @@ 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
18 changes: 13 additions & 5 deletions video/transcoder/create_job_with_static_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,28 @@ def create_job_with_static_overlay(
image=transcoder_v1.types.Overlay.Image(
uri=overlay_image_uri,
resolution=transcoder_v1.types.Overlay.NormalizedCoordinate(
x=1, y=0.5,
x=1,
y=0.5,
),
alpha=1,
),
animations=[
transcoder_v1.types.Overlay.Animation(
animation_static=transcoder_v1.types.Overlay.AnimationStatic(
xy=transcoder_v1.types.Overlay.NormalizedCoordinate(
x=0, y=0,
x=0,
y=0,
),
start_time_offset=duration.Duration(
seconds=0,
),
start_time_offset=duration.Duration(seconds=0,),
),
),
transcoder_v1.types.Overlay.Animation(
animation_end=transcoder_v1.types.Overlay.AnimationEnd(
start_time_offset=duration.Duration(seconds=10,),
start_time_offset=duration.Duration(
seconds=10,
),
),
),
],
Expand All @@ -114,7 +120,9 @@ def create_job_with_static_overlay(
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_uri",
Expand Down
Loading

0 comments on commit 4c972fa

Please sign in to comment.