From b52162b0387e19d87320a7e45c0d342892574e08 Mon Sep 17 00:00:00 2001 From: Nicholas Cook Date: Thu, 26 May 2022 18:44:25 -0700 Subject: [PATCH 01/55] docs(samples): add code samples (#17) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs(samples): add code samples * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Rename *_ad_tag_details.py files for consistency * add commit to trigger gh actions * another commit to trigger samples tests * add tests for live session ad tag details - requires custom manifest * change slate URI to non-gcs uri * Use project ID rather than project number per DPE style * Change slate location for testing since we are going over the 3 slate quota limit * add noxfile_config.py; enforce type hints * add line break * use GOOGLE_CLOUD_PROJECT in noxfile_config.py * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix linter errors * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Anthonios Partheniou Co-authored-by: Owl Bot --- video/stitcher/cdn_key_test.py | 142 +++++++++++++++++++++ video/stitcher/create_cdn_key.py | 120 +++++++++++++++++ video/stitcher/create_live_session.py | 96 ++++++++++++++ video/stitcher/create_slate.py | 81 ++++++++++++ video/stitcher/create_vod_session.py | 85 ++++++++++++ video/stitcher/delete_cdn_key.py | 67 ++++++++++ video/stitcher/delete_slate.py | 67 ++++++++++ video/stitcher/get_cdn_key.py | 67 ++++++++++ video/stitcher/get_live_ad_tag_detail.py | 71 +++++++++++ video/stitcher/get_live_session.py | 60 +++++++++ video/stitcher/get_slate.py | 67 ++++++++++ video/stitcher/get_vod_ad_tag_detail.py | 69 ++++++++++ video/stitcher/get_vod_session.py | 61 +++++++++ video/stitcher/get_vod_stitch_detail.py | 71 +++++++++++ video/stitcher/list_cdn_keys.py | 62 +++++++++ video/stitcher/list_live_ad_tag_details.py | 63 +++++++++ video/stitcher/list_slates.py | 62 +++++++++ video/stitcher/list_vod_ad_tag_details.py | 63 +++++++++ video/stitcher/list_vod_stitch_details.py | 63 +++++++++ video/stitcher/live_session_test.py | 134 +++++++++++++++++++ video/stitcher/noxfile_config.py | 38 ++++++ video/stitcher/requirements-test.txt | 2 + video/stitcher/requirements.txt | 3 + video/stitcher/slate_test.py | 78 +++++++++++ video/stitcher/update_cdn_key.py | 122 ++++++++++++++++++ video/stitcher/update_slate.py | 82 ++++++++++++ video/stitcher/vod_session_test.py | 94 ++++++++++++++ 27 files changed, 1990 insertions(+) create mode 100644 video/stitcher/cdn_key_test.py create mode 100644 video/stitcher/create_cdn_key.py create mode 100644 video/stitcher/create_live_session.py create mode 100644 video/stitcher/create_slate.py create mode 100644 video/stitcher/create_vod_session.py create mode 100644 video/stitcher/delete_cdn_key.py create mode 100644 video/stitcher/delete_slate.py create mode 100644 video/stitcher/get_cdn_key.py create mode 100644 video/stitcher/get_live_ad_tag_detail.py create mode 100644 video/stitcher/get_live_session.py create mode 100644 video/stitcher/get_slate.py create mode 100644 video/stitcher/get_vod_ad_tag_detail.py create mode 100644 video/stitcher/get_vod_session.py create mode 100644 video/stitcher/get_vod_stitch_detail.py create mode 100644 video/stitcher/list_cdn_keys.py create mode 100644 video/stitcher/list_live_ad_tag_details.py create mode 100644 video/stitcher/list_slates.py create mode 100644 video/stitcher/list_vod_ad_tag_details.py create mode 100644 video/stitcher/list_vod_stitch_details.py create mode 100644 video/stitcher/live_session_test.py create mode 100644 video/stitcher/noxfile_config.py create mode 100644 video/stitcher/requirements-test.txt create mode 100644 video/stitcher/requirements.txt create mode 100644 video/stitcher/slate_test.py create mode 100644 video/stitcher/update_cdn_key.py create mode 100644 video/stitcher/update_slate.py create mode 100644 video/stitcher/vod_session_test.py diff --git a/video/stitcher/cdn_key_test.py b/video/stitcher/cdn_key_test.py new file mode 100644 index 00000000000..86de02b2d72 --- /dev/null +++ b/video/stitcher/cdn_key_test.py @@ -0,0 +1,142 @@ +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import uuid + +from google.api_core.exceptions import NotFound +import pytest + +import create_cdn_key +import delete_cdn_key +import get_cdn_key +import list_cdn_keys +import update_cdn_key + +location = "us-central1" +project_id = os.environ["GOOGLE_CLOUD_PROJECT"] +gcdn_cdn_key_id = f"my-python-test-cdn-key-{uuid.uuid4()}" +akamai_cdn_key_id = f"my-python-test-cdn-key-{uuid.uuid4()}" + +hostname = "cdn.example.com" +updated_hostname = "updated.example.com" + +gcdn_key_name = "gcdn-key" +gcdn_private_key = "VGhpcyBpcyBhIHRlc3Qgc3RyaW5nLg==" +updated_gcdn_private_key = "VGhpcyBpcyBhbiB1cGRhdGVkIHRlc3Qgc3RyaW5nLg==" +akamai_key = gcdn_private_key +updated_akamai_key = updated_gcdn_private_key + + +def test_cdn_key_operations(capsys: pytest.fixture) -> None: + + try: + delete_cdn_key.delete_cdn_key(project_id, location, gcdn_cdn_key_id) + except NotFound as e: + print(f"Ignoring NotFound, details: {e}") + out, _ = capsys.readouterr() + + try: + delete_cdn_key.delete_cdn_key(project_id, location, akamai_cdn_key_id) + except NotFound as e: + print(f"Ignoring NotFound, details: {e}") + out, _ = capsys.readouterr() + + # GCDN CDN key tests + + create_cdn_key.create_cdn_key( + project_id, + location, + gcdn_cdn_key_id, + hostname, + gcdn_key_name, + gcdn_private_key, + ) + out, _ = capsys.readouterr() + assert gcdn_cdn_key_id in out + + list_cdn_keys.list_cdn_keys(project_id, location) + out, _ = capsys.readouterr() + assert gcdn_cdn_key_id in out + + # Update the hostname only + response = update_cdn_key.update_cdn_key( + project_id, location, gcdn_cdn_key_id, updated_hostname + ) + out, _ = capsys.readouterr() + assert gcdn_cdn_key_id in out + assert updated_hostname in response.hostname + + # Update the private key; the private key value is not returned by the client + response = update_cdn_key.update_cdn_key( + project_id, + location, + gcdn_cdn_key_id, + hostname, + gcdn_key_name, + updated_gcdn_private_key, + ) + out, _ = capsys.readouterr() + assert gcdn_cdn_key_id in out + + get_cdn_key.get_cdn_key(project_id, location, gcdn_cdn_key_id) + out, _ = capsys.readouterr() + assert gcdn_cdn_key_id in out + + delete_cdn_key.delete_cdn_key(project_id, location, gcdn_cdn_key_id) + out, _ = capsys.readouterr() + assert "Deleted CDN key" in out + + # Akamai CDN key tests + + create_cdn_key.create_cdn_key( + project_id, + location, + akamai_cdn_key_id, + hostname, + akamai_token_key=akamai_key, + ) + out, _ = capsys.readouterr() + assert akamai_cdn_key_id in out + + list_cdn_keys.list_cdn_keys(project_id, location) + out, _ = capsys.readouterr() + assert akamai_cdn_key_id in out + + # Update the hostname only + response = update_cdn_key.update_cdn_key( + project_id, location, akamai_cdn_key_id, updated_hostname + ) + out, _ = capsys.readouterr() + assert akamai_cdn_key_id in out + assert updated_hostname in response.hostname + + # Update the private key; the private key value is not returned by the client + response = update_cdn_key.update_cdn_key( + project_id, + location, + akamai_cdn_key_id, + hostname, + akamai_token_key=updated_akamai_key, + ) + out, _ = capsys.readouterr() + assert akamai_cdn_key_id in out + + get_cdn_key.get_cdn_key(project_id, location, akamai_cdn_key_id) + out, _ = capsys.readouterr() + assert akamai_cdn_key_id in out + + delete_cdn_key.delete_cdn_key(project_id, location, akamai_cdn_key_id) + out, _ = capsys.readouterr() + assert "Deleted CDN key" in out diff --git a/video/stitcher/create_cdn_key.py b/video/stitcher/create_cdn_key.py new file mode 100644 index 00000000000..b50c607d093 --- /dev/null +++ b/video/stitcher/create_cdn_key.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for creating a CDN key. A CDN key is used +to retrieve protected media. +Example usage: + python create_cdn_key.py --project_id --location --cdn_key_id \ + --hostname [--gcdn_keyname --gcdn_private_key | --akamai_token_key ] +""" + +# [START video_stitcher_create_cdn_key] + +import argparse + +from google.cloud.video import stitcher_v1 +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def create_cdn_key( + project_id: str, + location: str, + cdn_key_id: str, + hostname: str, + gcdn_keyname: str = None, + gcdn_private_key: str = None, + akamai_token_key: str = None, +) -> str: + """Creates a Google Cloud or Akamai CDN key. + Args: + project_id: The GCP project ID. + location: The location in which to create the CDN key. + cdn_key_id: The user-defined CDN key ID. + hostname: The hostname to which this CDN key applies. + gcdn_keyname: Applies to a Google Cloud CDN key. A base64-encoded string secret. + gcdn_private_key: Applies to a Google Cloud CDN key. Public name of the key. + akamai_token_key: Applies to an Akamai CDN key. A base64-encoded string token key.""" + + client = VideoStitcherServiceClient() + + parent = f"projects/{project_id}/locations/{location}" + + cdn_key = stitcher_v1.types.CdnKey( + name=cdn_key_id, + hostname=hostname, + ) + + if akamai_token_key is not None: + cdn_key.akamai_cdn_key = stitcher_v1.types.AkamaiCdnKey( + token_key=akamai_token_key, + ) + elif gcdn_keyname is not None: + cdn_key.google_cdn_key = stitcher_v1.types.GoogleCdnKey( + key_name=gcdn_keyname, + private_key=gcdn_private_key, + ) + + response = client.create_cdn_key( + parent=parent, cdn_key_id=cdn_key_id, cdn_key=cdn_key + ) + print(f"CDN key: {response.name}") + return response + + +# [END video_stitcher_create_cdn_key] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location in which to create the CDN key.", + default="us-central1", + ) + parser.add_argument( + "--cdn_key_id", + help="The user-defined CDN key ID.", + required=True, + ) + parser.add_argument( + "--hostname", + help="The hostname to which this CDN key applies.", + required=True, + ) + parser.add_argument( + "--gcdn_keyname", + help="Applies to a Google Cloud CDN key. The base64-encoded string secret.", + ) + parser.add_argument( + "--gcdn_private_key", + help="Applies to a Google Cloud CDN key. Public name of the key.", + ) + parser.add_argument( + "--akamai_token_key", + help="Applies to an Akamai CDN key. The base64-encoded string token key.", + ) + args = parser.parse_args() + create_cdn_key( + args.project_id, + args.location, + args.cdn_key_id, + args.hostname, + args.gcdn_keyname, + args.gcdn_private_key, + args.akamai_token_key, + ) diff --git a/video/stitcher/create_live_session.py b/video/stitcher/create_live_session.py new file mode 100644 index 00000000000..1cbf30453ef --- /dev/null +++ b/video/stitcher/create_live_session.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for creating a live stream session in +which to insert ads. +Example usage: + python create_live_session.py --project_id \ + --location --live_stream_uri --ad_tag_uri \ + --slate_id +""" + +# [START video_stitcher_create_live_session] + +import argparse + +from google.cloud.video import stitcher_v1 +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def create_live_session( + project_id: str, location: str, live_stream_uri: str, ad_tag_uri: str, slate_id: str +) -> str: + """Creates a live session. Live sessions are ephemeral resources that expire + after a few minutes. + Args: + project_id: The GCP project ID. + location: The location in which to create the session. + live_stream_uri: Uri of the livestream to stitch; this URI must reference either an MPEG-DASH + manifest (.mpd) file or an M3U playlist manifest (.m3u8) file. + ad_tag_uri: Uri of the ad tag. + slate_id: The user-defined slate ID of the default slate to use when no slates are specified in an ad break's message.""" + + client = VideoStitcherServiceClient() + + parent = f"projects/{project_id}/locations/{location}" + + # Create dictionaries and pass them to the LiveSession constructor + ad_tag_map = {"default": stitcher_v1.AdTag(uri=ad_tag_uri)} + + live_session = stitcher_v1.types.LiveSession( + source_uri=live_stream_uri, ad_tag_map=ad_tag_map, default_slate_id=slate_id + ) + + response = client.create_live_session(parent=parent, live_session=live_session) + print(f"Live session: {response.name}") + return response + + +# [END video_stitcher_create_live_session] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location in which to create the live session.", + default="us-central1", + ) + parser.add_argument( + "--live_stream_uri", + help="The Uri of the livestream to stitch (.mpd or .m3u8 file) in double quotes.", + required=True, + ) + parser.add_argument( + "--ad_tag_uri", + help="Uri of the ad tag in double quotes.", + required=True, + ) + parser.add_argument( + "--slate_id", + help="The user-defined slate ID of the default slate.", + required=True, + ) + args = parser.parse_args() + create_live_session( + args.project_id, + args.location, + args.live_stream_uri, + args.ad_tag_uri, + args.slate_id, + ) diff --git a/video/stitcher/create_slate.py b/video/stitcher/create_slate.py new file mode 100644 index 00000000000..87b7f00b8d6 --- /dev/null +++ b/video/stitcher/create_slate.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for creating a slate. A slate is displayed +when ads are not available. +Example usage: + python create_slate.py --project_id --location \ + --slate_id --slate_uri +""" + +# [START video_stitcher_create_slate] + +import argparse + +from google.cloud.video import stitcher_v1 +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def create_slate(project_id: str, location: str, slate_id: str, slate_uri: str) -> str: + """Creates a slate. + Args: + project_id: The GCP project ID. + location: The location in which to create the slate. + slate_id: The user-defined slate ID. + slate_uri: Uri of the video slate; must be an MP4 video with at least one audio track.""" + + client = VideoStitcherServiceClient() + + parent = f"projects/{project_id}/locations/{location}" + + slate = stitcher_v1.types.Slate( + uri=slate_uri, + ) + + response = client.create_slate(parent=parent, slate_id=slate_id, slate=slate) + print(f"Slate: {response.name}") + return response + + +# [END video_stitcher_create_slate] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location in which to create the slate.", + default="us-central1", + ) + parser.add_argument( + "--slate_id", + help="The user-defined slate ID.", + required=True, + ) + parser.add_argument( + "--slate_uri", + help="Uri of the video slate; must be an MP4 video with at least one audio track.", + required=True, + ) + args = parser.parse_args() + create_slate( + args.project_id, + args.location, + args.slate_id, + args.slate_uri, + ) diff --git a/video/stitcher/create_vod_session.py b/video/stitcher/create_vod_session.py new file mode 100644 index 00000000000..7806d88aaf8 --- /dev/null +++ b/video/stitcher/create_vod_session.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for creating a video on demand (VOD) +session in which to insert ads. +Example usage: + python create_vod_session.py --project_id \ + --location --source_uri --ad_tag_uri +""" + +# [START video_stitcher_create_vod_session] + +import argparse + +from google.cloud.video import stitcher_v1 +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def create_vod_session( + project_id: str, location: str, source_uri: str, ad_tag_uri: str +) -> str: + """Creates a VOD session. VOD sessions are ephemeral resources that expire + after a few hours. + Args: + project_id: The GCP project ID. + location: The location in which to create the session. + source_uri: Uri of the media to stitch; this URI must reference either an MPEG-DASH + manifest (.mpd) file or an M3U playlist manifest (.m3u8) file. + ad_tag_uri: Uri of the ad tag.""" + + client = VideoStitcherServiceClient() + + parent = f"projects/{project_id}/locations/{location}" + + vod_session = stitcher_v1.types.VodSession( + source_uri=source_uri, ad_tag_uri=ad_tag_uri + ) + + response = client.create_vod_session(parent=parent, vod_session=vod_session) + print(f"VOD session: {response.name}") + return response + + +# [END video_stitcher_create_vod_session] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location in which to create the VOD session.", + default="us-central1", + ) + parser.add_argument( + "--source_uri", + help="The Uri of the media to stitch (.mpd or .m3u8 file) in double quotes.", + required=True, + ) + parser.add_argument( + "--ad_tag_uri", + help="Uri of the ad tag in double quotes.", + required=True, + ) + args = parser.parse_args() + create_vod_session( + args.project_id, + args.location, + args.source_uri, + args.ad_tag_uri, + ) diff --git a/video/stitcher/delete_cdn_key.py b/video/stitcher/delete_cdn_key.py new file mode 100644 index 00000000000..4ad11417ab0 --- /dev/null +++ b/video/stitcher/delete_cdn_key.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for deleting a CDN key. +Example usage: + python delete_cdn_key.py --project_id --location \ + --cdn_key_id +""" + +# [START video_stitcher_delete_cdn_key] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def delete_cdn_key(project_id: str, location: str, cdn_key_id: str) -> str: + """Deletes a CDN key. + Args: + project_id: The GCP project ID. + location: The location of the CDN key. + cdn_key_id: The user-defined CDN key ID.""" + + client = VideoStitcherServiceClient() + + name = f"projects/{project_id}/locations/{location}/cdnKeys/{cdn_key_id}" + response = client.delete_cdn_key(name=name) + print("Deleted CDN key") + return response + + +# [END video_stitcher_delete_cdn_key] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location of the CDN key.", + required=True, + ) + parser.add_argument( + "--cdn_key_id", + help="The user-defined CDN key ID.", + required=True, + ) + args = parser.parse_args() + delete_cdn_key( + args.project_id, + args.location, + args.cdn_key_id, + ) diff --git a/video/stitcher/delete_slate.py b/video/stitcher/delete_slate.py new file mode 100644 index 00000000000..95a36df82b2 --- /dev/null +++ b/video/stitcher/delete_slate.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for deleting a slate. +Example usage: + python delete_slate.py --project_id --location \ + --slate_id +""" + +# [START video_stitcher_delete_slate] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def delete_slate(project_id: str, location: str, slate_id: str) -> str: + """Deletes a slate. + Args: + project_id: The GCP project ID. + location: The location of the slate. + slate_id: The user-defined slate ID.""" + + client = VideoStitcherServiceClient() + + name = f"projects/{project_id}/locations/{location}/slates/{slate_id}" + response = client.delete_slate(name=name) + print("Deleted slate") + return response + + +# [END video_stitcher_delete_slate] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location of the slate.", + required=True, + ) + parser.add_argument( + "--slate_id", + help="The user-defined slate ID.", + required=True, + ) + args = parser.parse_args() + delete_slate( + args.project_id, + args.location, + args.slate_id, + ) diff --git a/video/stitcher/get_cdn_key.py b/video/stitcher/get_cdn_key.py new file mode 100644 index 00000000000..fc10ddb9cdf --- /dev/null +++ b/video/stitcher/get_cdn_key.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for getting a CDN key. +Example usage: + python get_cdn_key.py --project_id --location \ + --cdn_key_id +""" + +# [START video_stitcher_get_cdn_key] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def get_cdn_key(project_id: str, location: str, cdn_key_id: str) -> str: + """Gets a CDN key. + Args: + project_id: The GCP project ID. + location: The location of the CDN key. + cdn_key_id: The user-defined CDN key ID.""" + + client = VideoStitcherServiceClient() + + name = f"projects/{project_id}/locations/{location}/cdnKeys/{cdn_key_id}" + response = client.get_cdn_key(name=name) + print(f"CDN key: {response.name}") + return response + + +# [END video_stitcher_get_cdn_key] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location of the CDN key.", + required=True, + ) + parser.add_argument( + "--cdn_key_id", + help="The user-defined CDN key ID.", + required=True, + ) + args = parser.parse_args() + get_cdn_key( + args.project_id, + args.location, + args.cdn_key_id, + ) diff --git a/video/stitcher/get_live_ad_tag_detail.py b/video/stitcher/get_live_ad_tag_detail.py new file mode 100644 index 00000000000..4c5d82841b8 --- /dev/null +++ b/video/stitcher/get_live_ad_tag_detail.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for getting the specified ad tag detail +for a live stream session. +Example usage: + python get_live_ad_tag_detail.py --project_id \ + --location --session_id \ + --ad_tag_details_id +""" + +# [START video_stitcher_get_live_ad_tag_detail] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def get_live_ad_tag_detail( + project_id: str, location: str, session_id: str, ad_tag_detail_id: str +) -> str: + """Gets the specified ad tag detail for a live session. + Args: + project_id: The GCP project ID. + location: The location of the session. + session_id: The ID of the live session. + ad_tag_detail_id: The ID of the ad tag details.""" + + client = VideoStitcherServiceClient() + + name = client.live_ad_tag_detail_path( + project_id, location, session_id, ad_tag_detail_id + ) + response = client.get_live_ad_tag_detail(name=name) + print(f"Live ad tag detail: {response.name}") + return response + + +# [END video_stitcher_get_live_ad_tag_detail] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", help="The location of the live session.", required=True + ) + parser.add_argument( + "--session_id", help="The ID of the live session.", required=True + ) + parser.add_argument( + "--ad_tag_detail_id", help="The ID of the ad tag details.", required=True + ) + args = parser.parse_args() + get_live_ad_tag_detail( + args.project_id, args.location, args.session_id, args.ad_tag_detail_id + ) diff --git a/video/stitcher/get_live_session.py b/video/stitcher/get_live_session.py new file mode 100644 index 00000000000..c848dddee13 --- /dev/null +++ b/video/stitcher/get_live_session.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for getting a live stream session. +Example usage: + python get_live_session.py --project_id --location \ + --session_id +""" + +# [START video_stitcher_get_live_session] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def get_live_session(project_id: str, location: str, session_id: str) -> str: + """Gets a live session. Live sessions are ephemeral resources that expire + after a few minutes. + Args: + project_id: The GCP project ID. + location: The location of the session. + session_id: The ID of the live session.""" + + client = VideoStitcherServiceClient() + + name = client.live_session_path(project_id, location, session_id) + response = client.get_live_session(name=name) + print(f"Live session: {response.name}") + return response + + +# [END video_stitcher_get_live_session] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", help="The location of the live session.", required=True + ) + parser.add_argument( + "--session_id", help="The ID of the live session.", required=True + ) + args = parser.parse_args() + get_live_session(args.project_id, args.location, args.session_id) diff --git a/video/stitcher/get_slate.py b/video/stitcher/get_slate.py new file mode 100644 index 00000000000..7e2b909e3ba --- /dev/null +++ b/video/stitcher/get_slate.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for getting a slate. +Example usage: + python get_slate.py --project_id --location \ + --slate_id +""" + +# [START video_stitcher_get_slate] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def get_slate(project_id: str, location: str, slate_id: str) -> str: + """Gets a slate. + Args: + project_id: The GCP project ID. + location: The location of the slate. + slate_id: The user-defined slate ID.""" + + client = VideoStitcherServiceClient() + + name = f"projects/{project_id}/locations/{location}/slates/{slate_id}" + response = client.get_slate(name=name) + print(f"Slate: {response.name}") + return response + + +# [END video_stitcher_get_slate] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location of the slate.", + required=True, + ) + parser.add_argument( + "--slate_id", + help="The user-defined slate ID.", + required=True, + ) + args = parser.parse_args() + get_slate( + args.project_id, + args.location, + args.slate_id, + ) diff --git a/video/stitcher/get_vod_ad_tag_detail.py b/video/stitcher/get_vod_ad_tag_detail.py new file mode 100644 index 00000000000..a8b82129e2c --- /dev/null +++ b/video/stitcher/get_vod_ad_tag_detail.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for getting the specified ad tag detail +for a video on demand (VOD) session. +Example usage: + python get_vod_ad_tag_detail.py --project_id --location --session_id --ad_tag_details_id +""" + +# [START video_stitcher_get_vod_ad_tag_detail] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def get_vod_ad_tag_detail( + project_id: str, location: str, session_id: str, ad_tag_detail_id: str +) -> str: + """Gets the specified ad tag detail for a VOD session. + Args: + project_id: The GCP project ID. + location: The location of the session. + session_id: The ID of the VOD session. + ad_tag_detail_id: The ID of the ad tag details.""" + + client = VideoStitcherServiceClient() + + name = client.vod_ad_tag_detail_path( + project_id, location, session_id, ad_tag_detail_id + ) + response = client.get_vod_ad_tag_detail(name=name) + print(f"VOD ad tag detail: {response.name}") + return response + + +# [END video_stitcher_get_vod_ad_tag_detail] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", help="The location of the VOD session.", required=True + ) + parser.add_argument( + "--session_id", help="The ID of the VOD session.", required=True + ) + parser.add_argument( + "--ad_tag_detail_id", help="The ID of the ad tag details.", required=True + ) + args = parser.parse_args() + get_vod_ad_tag_detail( + args.project_id, args.location, args.session_id, args.ad_tag_detail_id + ) diff --git a/video/stitcher/get_vod_session.py b/video/stitcher/get_vod_session.py new file mode 100644 index 00000000000..a27cda07781 --- /dev/null +++ b/video/stitcher/get_vod_session.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for getting a video on demand (VOD) +session. +Example usage: + python get_vod_session.py --project_id --location \ + --session_id +""" + +# [START video_stitcher_get_vod_session] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def get_vod_session(project_id: str, location: str, session_id: str) -> str: + """Gets a VOD session. VOD sessions are ephemeral resources that expire + after a few hours. + Args: + project_id: The GCP project ID. + location: The location of the session. + session_id: The ID of the VOD session.""" + + client = VideoStitcherServiceClient() + + name = client.vod_session_path(project_id, location, session_id) + response = client.get_vod_session(name=name) + print(f"VOD session: {response.name}") + return response + + +# [END video_stitcher_get_vod_session] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", help="The location of the VOD session.", required=True + ) + parser.add_argument( + "--session_id", help="The ID of the VOD session.", required=True + ) + args = parser.parse_args() + get_vod_session(args.project_id, args.location, args.session_id) diff --git a/video/stitcher/get_vod_stitch_detail.py b/video/stitcher/get_vod_stitch_detail.py new file mode 100644 index 00000000000..92bb6a9f3d7 --- /dev/null +++ b/video/stitcher/get_vod_stitch_detail.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for getting the specified stitch detail +for a video on demand (VOD) session. +Example usage: + python get_vod_stitch_detail.py --project_id \ + --location --session_id \ + --stitch_details_id +""" + +# [START video_stitcher_get_vod_stitch_detail] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def get_vod_stitch_detail( + project_id: str, location: str, session_id: str, stitch_detail_id: str +) -> str: + """Gets the specified stitch detail for a VOD session. + Args: + project_id: The GCP project ID. + location: The location of the session. + session_id: The ID of the VOD session. + stitch_detail_id: The ID of the stitch details.""" + + client = VideoStitcherServiceClient() + + name = client.vod_stitch_detail_path( + project_id, location, session_id, stitch_detail_id + ) + response = client.get_vod_stitch_detail(name=name) + print(f"VOD stitch detail: {response.name}") + return response + + +# [END video_stitcher_get_vod_stitch_detail] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", help="The location of the VOD session.", required=True + ) + parser.add_argument( + "--session_id", help="The ID of the VOD session.", required=True + ) + parser.add_argument( + "--stitch_detail_id", help="The ID of the stitch details.", required=True + ) + args = parser.parse_args() + get_vod_stitch_detail( + args.project_id, args.location, args.session_id, args.stitch_detail_id + ) diff --git a/video/stitcher/list_cdn_keys.py b/video/stitcher/list_cdn_keys.py new file mode 100644 index 00000000000..4db22f204da --- /dev/null +++ b/video/stitcher/list_cdn_keys.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for listing all CDN keys in a location. +Example usage: + python list_cdn_keys.py --project_id --location +""" + +# [START video_stitcher_list_cdn_keys] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def list_cdn_keys(project_id: str, location: str) -> str: + """Lists all CDN keys in a location. + Args: + project_id: The GCP project ID. + location: The location of the CDN keys.""" + + client = VideoStitcherServiceClient() + + parent = f"projects/{project_id}/locations/{location}" + response = client.list_cdn_keys(parent=parent) + print("CDN keys:") + for cdn_key in response.cdn_keys: + print({cdn_key.name}) + + return response + + +# [END video_stitcher_list_cdn_keys] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location of the CDN keys.", + required=True, + ) + args = parser.parse_args() + list_cdn_keys( + args.project_id, + args.location, + ) diff --git a/video/stitcher/list_live_ad_tag_details.py b/video/stitcher/list_live_ad_tag_details.py new file mode 100644 index 00000000000..769a7890797 --- /dev/null +++ b/video/stitcher/list_live_ad_tag_details.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for listing the ad tag details for a +live session. +Example usage: + python list_live_ad_tag_details.py --project_id \ + --location --session_id +""" + +# [START video_stitcher_list_live_ad_tag_details] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def list_live_ad_tag_details(project_id: str, location: str, session_id: str) -> str: + """Lists the ad tag details for the specified live session. + Args: + project_id: The GCP project ID. + location: The location of the session. + session_id: The ID of the live session.""" + + client = VideoStitcherServiceClient() + + parent = client.live_session_path(project_id, location, session_id) + page_result = client.list_live_ad_tag_details(parent=parent) + print("Live ad tag details:") + for response in page_result: + print(response) + + return page_result + + +# [END video_stitcher_list_live_ad_tag_details] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", help="The location of the live session.", required=True + ) + parser.add_argument( + "--session_id", help="The ID of the live session.", required=True + ) + args = parser.parse_args() + list_live_ad_tag_details(args.project_id, args.location, args.session_id) diff --git a/video/stitcher/list_slates.py b/video/stitcher/list_slates.py new file mode 100644 index 00000000000..c4a0f6df85e --- /dev/null +++ b/video/stitcher/list_slates.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for listing all slates in a location. +Example usage: + python list_slates.py --project_id --location +""" + +# [START video_stitcher_list_slates] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def list_slates(project_id: str, location: str) -> str: + """Lists all slates in a location. + Args: + project_id: The GCP project ID. + location: The location of the slates.""" + + client = VideoStitcherServiceClient() + + parent = f"projects/{project_id}/locations/{location}" + response = client.list_slates(parent=parent) + print("Slates:") + for slate in response.slates: + print({slate.name}) + + return response + + +# [END video_stitcher_list_slates] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location of the slates.", + required=True, + ) + args = parser.parse_args() + list_slates( + args.project_id, + args.location, + ) diff --git a/video/stitcher/list_vod_ad_tag_details.py b/video/stitcher/list_vod_ad_tag_details.py new file mode 100644 index 00000000000..f92a923f1b0 --- /dev/null +++ b/video/stitcher/list_vod_ad_tag_details.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for listing the ad tag details for a video +on demand (VOD) session. +Example usage: + python list_vod_ad_tag_details.py --project_id \ + --location --session_id +""" + +# [START video_stitcher_list_vod_ad_tag_details] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def list_vod_ad_tag_details(project_id: str, location: str, session_id: str) -> str: + """Lists the ad tag details for the specified VOD session. + Args: + project_id: The GCP project ID. + location: The location of the session. + session_id: The ID of the VOD session.""" + + client = VideoStitcherServiceClient() + + parent = client.vod_session_path(project_id, location, session_id) + page_result = client.list_vod_ad_tag_details(parent=parent) + print("VOD ad tag details:") + for response in page_result: + print(response) + + return response + + +# [END video_stitcher_list_vod_ad_tag_details] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", help="The location of the VOD session.", required=True + ) + parser.add_argument( + "--session_id", help="The ID of the VOD session.", required=True + ) + args = parser.parse_args() + list_vod_ad_tag_details(args.project_id, args.location, args.session_id) diff --git a/video/stitcher/list_vod_stitch_details.py b/video/stitcher/list_vod_stitch_details.py new file mode 100644 index 00000000000..7bfc17992f4 --- /dev/null +++ b/video/stitcher/list_vod_stitch_details.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for listing the stitch details for a +video on demand (VOD) session. +Example usage: + python list_vod_stitch_details.py --project_id \ + --location --session_id +""" + +# [START video_stitcher_list_vod_stitch_details] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def list_vod_stitch_details(project_id: str, location: str, session_id: str) -> str: + """Lists the stitch details for the specified VOD session. + Args: + project_id: The GCP project ID. + location: The location of the session. + session_id: The ID of the VOD session.""" + + client = VideoStitcherServiceClient() + + parent = client.vod_session_path(project_id, location, session_id) + page_result = client.list_vod_stitch_details(parent=parent) + print("VOD stitch details:") + for response in page_result: + print(response) + + return response + + +# [END video_stitcher_list_vod_stitch_details] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", help="The location of the VOD session.", required=True + ) + parser.add_argument( + "--session_id", help="The ID of the VOD session.", required=True + ) + args = parser.parse_args() + list_vod_stitch_details(args.project_id, args.location, args.session_id) diff --git a/video/stitcher/live_session_test.py b/video/stitcher/live_session_test.py new file mode 100644 index 00000000000..54c8d0e63b8 --- /dev/null +++ b/video/stitcher/live_session_test.py @@ -0,0 +1,134 @@ +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import re +import uuid + +from google.api_core.exceptions import NotFound +import pytest +import requests + +import create_live_session +import create_slate +import delete_slate +import get_live_ad_tag_detail +import get_live_session +import list_live_ad_tag_details + +project_id = os.environ["GOOGLE_CLOUD_PROJECT"] +project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"] +location = "us-central1" +input_bucket_name = "cloud-samples-data/media/" +input_video_file_name = "hls-live/manifest.m3u8" +live_stream_uri = ( + f"https://storage.googleapis.com/{input_bucket_name}{input_video_file_name}" +) +# Single Inline Linear (https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags) +ad_tag_uri = "https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=" +slate_id = f"my-python-test-slate-{uuid.uuid4()}" +slate_video_file_name = "ForBiggerJoyrides.mp4" +slate_uri = f"https://storage.googleapis.com/{input_bucket_name}{slate_video_file_name}" + + +def test_live_session_operations(capsys: pytest.fixture) -> None: + + # Test setup + + slate_name = f"projects/{project_number}/locations/{location}/slates/{slate_id}" + + try: + delete_slate.delete_slate(project_id, location, slate_id) + except NotFound as e: + print(f"Ignoring NotFound, details: {e}") + out, _ = capsys.readouterr() + + create_slate.create_slate(project_id, location, slate_id, slate_uri) + out, _ = capsys.readouterr() + assert slate_name in out + + # Tests + + create_live_session_response = create_live_session.create_live_session( + project_id, location, live_stream_uri, ad_tag_uri, slate_id + ) + out, _ = capsys.readouterr() + session_name_prefix = ( + f"projects/{project_number}/locations/{location}/liveSessions/" + ) + assert session_name_prefix in out + + str_slice = out.split("/") + session_id = str_slice[len(str_slice) - 1].rstrip("\n") + session_name = ( + f"projects/{project_number}/locations/{location}/liveSessions/{session_id}" + ) + assert session_name in out + + get_live_session.get_live_session(project_id, location, session_id) + out, _ = capsys.readouterr() + assert session_name in out + + # Clean up slate as it is no longer needed + + delete_slate.delete_slate(project_id, location, slate_id) + out, _ = capsys.readouterr() + assert "Deleted slate" in out + + # No list or delete methods for live sessions + + # Ad tag details + + # To get ad tag details, you need to curl the main manifest and + # a rendition first. This supplies media player information to the API. + # + # Curl the play_uri first. The last line of the response will contain a + # renditions location. Curl the live session name with the rendition + # location appended. + + r = requests.get(create_live_session_response.play_uri) + match = re.search("renditions/.*", r.text) + assert match + renditions = match.group() + assert "renditions/" in renditions + + # create_live_session_response.play_uri will be in the following format: + # /projects/{project}/locations/{location}/liveSessions/{session-id}/manifest.m3u8?signature=... + # Replace manifest.m3u8?signature=... with the renditions location. + arr = create_live_session_response.play_uri.split("/") + arr.pop() + tmp = "/".join(arr) + renditions_uri = f"{tmp}/{renditions}" + r = requests.get(renditions_uri) + + list_live_ad_tag_details_response = ( + list_live_ad_tag_details.list_live_ad_tag_details( + project_id, location, session_id + ) + ) + out, _ = capsys.readouterr() + ad_tag_details_name_prefix = f"projects/{project_number}/locations/{location}/liveSessions/{session_id}/liveAdTagDetails/" + assert ad_tag_details_name_prefix in out + + str_slice = list_live_ad_tag_details_response.live_ad_tag_details[0].name.split("/") + ad_tag_details_id = str_slice[len(str_slice) - 1].rstrip("\n") + ad_tag_details_name = f"projects/{project_number}/locations/{location}/liveSessions/{session_id}/liveAdTagDetails/{ad_tag_details_id}" + assert ad_tag_details_name in out + + # b/231626944 for projectNumber below + get_live_ad_tag_detail.get_live_ad_tag_detail( + project_number, location, session_id, ad_tag_details_id + ) + out, _ = capsys.readouterr() + assert ad_tag_details_name in out diff --git a/video/stitcher/noxfile_config.py b/video/stitcher/noxfile_config.py new file mode 100644 index 00000000000..706b3f3a0be --- /dev/null +++ b/video/stitcher/noxfile_config.py @@ -0,0 +1,38 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Default TEST_CONFIG_OVERRIDE for python repos. + +# You can copy this file into your directory, then it will be inported from +# the noxfile.py. + +# The source of truth: +# https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/noxfile_config.py + +TEST_CONFIG_OVERRIDE = { + # You can opt out from the test for specific Python versions. + "ignored_versions": [], + # Old samples are opted out of enforcing Python type hints + # All new samples should feature them + "enforce_type_hints": True, + # An envvar key for determining the project id to use. Change it + # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a + # build specific Cloud project. You can also use your own string + # to use your own Cloud project. + # "gcloud_project_env": "GOOGLE_CLOUD_PROJECT", + "gcloud_project_env": "GOOGLE_CLOUD_PROJECT", + # A dictionary you want to inject into your test. Don't put any + # secrets here. These values will override predefined values. + "envs": {}, +} diff --git a/video/stitcher/requirements-test.txt b/video/stitcher/requirements-test.txt new file mode 100644 index 00000000000..8514f922691 --- /dev/null +++ b/video/stitcher/requirements-test.txt @@ -0,0 +1,2 @@ +pytest==7.0.1 +requests==2.26.0 \ No newline at end of file diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt new file mode 100644 index 00000000000..439a120ab83 --- /dev/null +++ b/video/stitcher/requirements.txt @@ -0,0 +1,3 @@ +google-api-python-client==2.39.0 +grpcio==1.44.0 +google-cloud-video-stitcher==0.1.1 \ No newline at end of file diff --git a/video/stitcher/slate_test.py b/video/stitcher/slate_test.py new file mode 100644 index 00000000000..86079c5cfa9 --- /dev/null +++ b/video/stitcher/slate_test.py @@ -0,0 +1,78 @@ +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import uuid + +from google.api_core.exceptions import NotFound +import pytest + +import create_slate +import delete_slate +import get_slate +import list_slates +import update_slate + +location = "us-west1" +project_id = os.environ["GOOGLE_CLOUD_PROJECT"] +project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"] +slate_id = f"my-python-test-slate-{uuid.uuid4()}" + +input_bucket_name = "cloud-samples-data/media/" +slate_video_file_name = "ForBiggerEscapes.mp4" +updated_slate_video_file_name = "ForBiggerJoyrides.mp4" + +slate_uri = f"https://storage.googleapis.com/{input_bucket_name}{slate_video_file_name}" +updated_slate_uri = ( + f"https://storage.googleapis.com/{input_bucket_name}{updated_slate_video_file_name}" +) + + +def test_slate_operations(capsys: pytest.fixture) -> None: + + slate_name_project_number = ( + f"projects/{project_number}/locations/{location}/slates/{slate_id}" + ) + slate_name_project_id = ( + f"projects/{project_id}/locations/{location}/slates/{slate_id}" + ) + + try: + delete_slate.delete_slate(project_id, location, slate_id) + except NotFound as e: + print(f"Ignoring NotFound, details: {e}") + out, _ = capsys.readouterr() + + create_slate.create_slate(project_id, location, slate_id, slate_uri) + out, _ = capsys.readouterr() + assert slate_name_project_number in out + + list_slates.list_slates(project_id, location) + out, _ = capsys.readouterr() + assert slate_name_project_id in out + + response = update_slate.update_slate( + project_id, location, slate_id, updated_slate_uri + ) + out, _ = capsys.readouterr() + assert slate_name_project_id in out + assert updated_slate_uri in response.uri + + get_slate.get_slate(project_id, location, slate_id) + out, _ = capsys.readouterr() + assert slate_name_project_id in out + + delete_slate.delete_slate(project_id, location, slate_id) + out, _ = capsys.readouterr() + assert "Deleted slate" in out diff --git a/video/stitcher/update_cdn_key.py b/video/stitcher/update_cdn_key.py new file mode 100644 index 00000000000..b56ca0e67d5 --- /dev/null +++ b/video/stitcher/update_cdn_key.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for updating a CDN key. +Example usage: + python update_cdn_key.py --project_id --location \ + --cdn_key_id --hostname \ + [--gcdn_keyname --gcdn_private_key | --akamai_token_key ] +""" + +# [START video_stitcher_update_cdn_key] + +import argparse + +from google.cloud.video import stitcher_v1 +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) +from google.protobuf import field_mask_pb2 as field_mask + + +def update_cdn_key( + project_id: str, + location: str, + cdn_key_id: str, + hostname: str, + gcdn_keyname: str = None, + gcdn_private_key: str = None, + akamai_token_key: str = None, +) -> str: + """Updates a Google Cloud or Akamai CDN key. + Args: + project_id: The GCP project ID. + location: The location of the CDN key. + cdn_key_id: The user-defined CDN key ID. + hostname: The hostname to which this CDN key applies. + gcdn_keyname: Applies to a Google Cloud CDN key. A base64-encoded string secret. + gcdn_private_key: Applies to a Google Cloud CDN key. Public name of the key. + akamai_token_key: Applies to an Akamai CDN key. A base64-encoded string token key.""" + + client = VideoStitcherServiceClient() + + name = f"projects/{project_id}/locations/{location}/cdnKeys/{cdn_key_id}" + + cdn_key = stitcher_v1.types.CdnKey( + name=name, + hostname=hostname, + ) + + if akamai_token_key is not None: + cdn_key.akamai_cdn_key = stitcher_v1.types.AkamaiCdnKey( + token_key=akamai_token_key, + ) + update_mask = field_mask.FieldMask(paths=["hostname", "akamai_cdn_key"]) + elif gcdn_keyname is not None: + cdn_key.google_cdn_key = stitcher_v1.types.GoogleCdnKey( + key_name=gcdn_keyname, + private_key=gcdn_private_key, + ) + update_mask = field_mask.FieldMask(paths=["hostname", "google_cdn_key"]) + else: + update_mask = field_mask.FieldMask(paths=["hostname"]) + + response = client.update_cdn_key(cdn_key=cdn_key, update_mask=update_mask) + print(f"Updated CDN key: {response.name}") + return response + + +# [END video_stitcher_update_cdn_key] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location of the CDN key.", + ) + parser.add_argument( + "--cdn_key_id", + help="The user-defined CDN key ID.", + required=True, + ) + parser.add_argument( + "--hostname", + help="The hostname to which this CDN key applies.", + required=True, + ) + parser.add_argument( + "--gcdn_keyname", + help="Applies to a Google Cloud CDN key. The base64-encoded string secret.", + ) + parser.add_argument( + "--gcdn_private_key", + help="Applies to a Google Cloud CDN key. Public name of the key.", + ) + parser.add_argument( + "--akamai_token_key", + help="Applies to an Akamai CDN key. The base64-encoded string token key.", + ) + args = parser.parse_args() + update_cdn_key( + args.project_id, + args.location, + args.cdn_key_id, + args.hostname, + args.gcdn_keyname, + args.gcdn_private_key, + args.akamai_token_key, + ) diff --git a/video/stitcher/update_slate.py b/video/stitcher/update_slate.py new file mode 100644 index 00000000000..d796f855bce --- /dev/null +++ b/video/stitcher/update_slate.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for updating a slate. +Example usage: + python update_slate.py --project_id --location \ + --slate_id --slate_uri +""" + +# [START video_stitcher_update_slate] + +import argparse + +from google.cloud.video import stitcher_v1 +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) +from google.protobuf import field_mask_pb2 as field_mask + + +def update_slate(project_id: str, location: str, slate_id: str, slate_uri: str) -> str: + """Updates a slate. + Args: + project_id: The GCP project ID. + location: The location of the slate. + slate_id: The existing slate's ID. + slate_uri: Updated uri of the video slate; must be an MP4 video with at least one audio track.""" + + client = VideoStitcherServiceClient() + + name = f"projects/{project_id}/locations/{location}/slates/{slate_id}" + slate = stitcher_v1.types.Slate( + name=name, + uri=slate_uri, + ) + update_mask = field_mask.FieldMask(paths=["uri"]) + + response = client.update_slate(slate=slate, update_mask=update_mask) + print(f"Updated slate: {response.name}") + return response + + +# [END video_stitcher_update_slate] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location of the slate.", + required=True, + ) + parser.add_argument( + "--slate_id", + help="The existing slate's ID.", + required=True, + ) + parser.add_argument( + "--slate_uri", + help="Updated uri of the video slate; must be an MP4 video with at least one audio track.", + required=True, + ) + args = parser.parse_args() + update_slate( + args.project_id, + args.location, + args.slate_id, + args.slate_uri, + ) diff --git a/video/stitcher/vod_session_test.py b/video/stitcher/vod_session_test.py new file mode 100644 index 00000000000..187b1612d4d --- /dev/null +++ b/video/stitcher/vod_session_test.py @@ -0,0 +1,94 @@ +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +import pytest + +import create_vod_session +import get_vod_ad_tag_detail +import get_vod_session +import get_vod_stitch_detail +import list_vod_ad_tag_details +import list_vod_stitch_details + +project_id = os.environ["GOOGLE_CLOUD_PROJECT"] +project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"] +location = "us-central1" +input_bucket_name = "cloud-samples-data/media/" +input_video_file_name = "hls-vod/manifest.m3u8" +vod_uri = f"https://storage.googleapis.com/{input_bucket_name}{input_video_file_name}" +# VMAP Pre-roll (https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags) +ad_tag_uri = "https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpreonly&ciu_szs=300x250%2C728x90&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=" + + +def test_vod_session_operations(capsys: pytest.fixture) -> None: + + create_vod_session.create_vod_session(project_id, location, vod_uri, ad_tag_uri) + out, _ = capsys.readouterr() + session_name_prefix = f"projects/{project_number}/locations/{location}/vodSessions/" + assert session_name_prefix in out + + str_slice = out.split("/") + session_id = str_slice[len(str_slice) - 1].rstrip("\n") + session_name = ( + f"projects/{project_number}/locations/{location}/vodSessions/{session_id}" + ) + assert session_name in out + + get_vod_session.get_vod_session(project_id, location, session_id) + out, _ = capsys.readouterr() + assert session_name in out + + # No list or delete methods for VOD sessions + + # Ad tag details + + response = list_vod_ad_tag_details.list_vod_ad_tag_details( + project_id, location, session_id + ) + out, _ = capsys.readouterr() + ad_tag_details_name_prefix = f"projects/{project_number}/locations/{location}/vodSessions/{session_id}/vodAdTagDetails/" + assert ad_tag_details_name_prefix in out + + str_slice = response.name.split("/") + ad_tag_details_id = str_slice[len(str_slice) - 1].rstrip("\n") + ad_tag_details_name = f"projects/{project_number}/locations/{location}/vodSessions/{session_id}/vodAdTagDetails/{ad_tag_details_id}" + assert ad_tag_details_name in out + + get_vod_ad_tag_detail.get_vod_ad_tag_detail( + project_id, location, session_id, ad_tag_details_id + ) + out, _ = capsys.readouterr() + assert ad_tag_details_name in out + + # Stitch details + + response = list_vod_stitch_details.list_vod_stitch_details( + project_id, location, session_id + ) + out, _ = capsys.readouterr() + stitch_details_name_prefix = f"projects/{project_number}/locations/{location}/vodSessions/{session_id}/vodStitchDetails/" + assert stitch_details_name_prefix in out + + str_slice = response.name.split("/") + stitch_details_id = str_slice[len(str_slice) - 1].rstrip("\n") + stitch_details_name = f"projects/{project_number}/locations/{location}/vodSessions/{session_id}/vodStitchDetails/{stitch_details_id}" + assert stitch_details_name in out + + get_vod_stitch_detail.get_vod_stitch_detail( + project_id, location, session_id, stitch_details_id + ) + out, _ = capsys.readouterr() + assert stitch_details_name in out From f0990ff04edeba6c2a7084a2674def40180c8d37 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 27 May 2022 19:58:57 +0200 Subject: [PATCH 02/55] chore(deps): update all dependencies (#33) --- video/stitcher/requirements-test.txt | 4 ++-- video/stitcher/requirements.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/video/stitcher/requirements-test.txt b/video/stitcher/requirements-test.txt index 8514f922691..42b284dfd97 100644 --- a/video/stitcher/requirements-test.txt +++ b/video/stitcher/requirements-test.txt @@ -1,2 +1,2 @@ -pytest==7.0.1 -requests==2.26.0 \ No newline at end of file +pytest==7.1.2 +requests==2.27.1 \ No newline at end of file diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 439a120ab83..a004ef95394 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.39.0 -grpcio==1.44.0 +google-api-python-client==2.49.0 +grpcio==1.46.3 google-cloud-video-stitcher==0.1.1 \ No newline at end of file From 48a5b5021306dceffa17c8d6f4a34919f4fd5322 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sat, 16 Jul 2022 20:39:57 +0200 Subject: [PATCH 03/55] chore(deps): update all dependencies (#38) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * revert Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- video/stitcher/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index a004ef95394..7b97e16700f 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.49.0 +google-api-python-client==2.50.0 grpcio==1.46.3 -google-cloud-video-stitcher==0.1.1 \ No newline at end of file +google-cloud-video-stitcher==0.1.2 \ No newline at end of file From 97351d0027278d450bb52f1d26d451766b963f2a Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 2 Aug 2022 15:48:23 +0200 Subject: [PATCH 04/55] chore(deps): update all dependencies (#49) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * revert Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- video/stitcher/requirements-test.txt | 2 +- video/stitcher/requirements.txt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/video/stitcher/requirements-test.txt b/video/stitcher/requirements-test.txt index 42b284dfd97..42c5e23220b 100644 --- a/video/stitcher/requirements-test.txt +++ b/video/stitcher/requirements-test.txt @@ -1,2 +1,2 @@ pytest==7.1.2 -requests==2.27.1 \ No newline at end of file +requests==2.28.1 \ No newline at end of file diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 7b97e16700f..78dd1bef90d 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.50.0 -grpcio==1.46.3 -google-cloud-video-stitcher==0.1.2 \ No newline at end of file +google-api-python-client==2.55.0 +grpcio==1.48.0 +google-cloud-video-stitcher==0.2.0 \ No newline at end of file From f7c23edd6e4fcc6aa4f693d4429e3817153876a9 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 9 Aug 2022 13:49:30 +0200 Subject: [PATCH 05/55] chore(deps): update all dependencies (#51) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(deps): update all dependencies * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * revert Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 78dd1bef90d..e7eee14b39c 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.55.0 +google-api-python-client==2.56.0 grpcio==1.48.0 google-cloud-video-stitcher==0.2.0 \ No newline at end of file From 19a6222367570472be124de4800c6df0bbd1008f Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 16 Aug 2022 16:39:36 +0200 Subject: [PATCH 06/55] chore(deps): update dependency google-cloud-video-stitcher to v0.2.1 (#56) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index e7eee14b39c..1d6e267fd9e 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ google-api-python-client==2.56.0 grpcio==1.48.0 -google-cloud-video-stitcher==0.2.0 \ No newline at end of file +google-cloud-video-stitcher==0.2.1 \ No newline at end of file From 7ed201be22ac9d7e772d61460687a6a4321a1272 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 16 Aug 2022 16:58:53 +0200 Subject: [PATCH 07/55] chore(deps): update dependency google-api-python-client to v2.57.0 (#57) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 1d6e267fd9e..3fef1794cd6 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.56.0 +google-api-python-client==2.57.0 grpcio==1.48.0 google-cloud-video-stitcher==0.2.1 \ No newline at end of file From 1e09c38c0aee47718a9f0eb4aa43ff0ca9ea1d75 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 23 Aug 2022 19:21:48 +0200 Subject: [PATCH 08/55] chore(deps): update dependency google-api-python-client to v2.58.0 (#58) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 3fef1794cd6..98e2286c24e 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.57.0 +google-api-python-client==2.58.0 grpcio==1.48.0 google-cloud-video-stitcher==0.2.1 \ No newline at end of file From 1e18ca5d7b147a6dff78b9b2270031fb56d4acbc Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 2 Sep 2022 13:15:07 +0200 Subject: [PATCH 09/55] chore(deps): update all dependencies (#64) * chore(deps): update all dependencies * revert Co-authored-by: Anthonios Partheniou --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 98e2286c24e..5d376c0ef27 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ google-api-python-client==2.58.0 -grpcio==1.48.0 +grpcio==1.48.1 google-cloud-video-stitcher==0.2.1 \ No newline at end of file From 62abf4d3079e14c0bf9aa8dd9bdae3e586d9b952 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 6 Sep 2022 16:17:21 +0200 Subject: [PATCH 10/55] chore(deps): update dependency pytest to v7.1.3 (#68) * chore(deps): update all dependencies * revert Co-authored-by: Anthonios Partheniou --- video/stitcher/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements-test.txt b/video/stitcher/requirements-test.txt index 42c5e23220b..29e59aa8d8f 100644 --- a/video/stitcher/requirements-test.txt +++ b/video/stitcher/requirements-test.txt @@ -1,2 +1,2 @@ -pytest==7.1.2 +pytest==7.1.3 requests==2.28.1 \ No newline at end of file From 2025b8d2437a05a52e2c9448bf388d1ac5995751 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 6 Sep 2022 21:07:06 +0200 Subject: [PATCH 11/55] chore(deps): update dependency google-api-python-client to v2.60.0 (#69) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 5d376c0ef27..4a8389b6a17 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.58.0 +google-api-python-client==2.60.0 grpcio==1.48.1 google-cloud-video-stitcher==0.2.1 \ No newline at end of file From 9617a960eaab932cead9644cc30a341d034944dc Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 14 Sep 2022 15:53:31 +0200 Subject: [PATCH 12/55] chore(deps): update dependency google-api-python-client to v2.61.0 (#74) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 4a8389b6a17..2c1d283a768 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.60.0 +google-api-python-client==2.61.0 grpcio==1.48.1 google-cloud-video-stitcher==0.2.1 \ No newline at end of file From b3745646f6f0ea83b787a6937a1f3be620182e38 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 16 Sep 2022 19:04:14 +0200 Subject: [PATCH 13/55] chore(deps): update dependency grpcio to v1.49.0 (#76) Co-authored-by: Anthonios Partheniou --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 2c1d283a768..ab968f2a5d3 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ google-api-python-client==2.61.0 -grpcio==1.48.1 +grpcio==1.49.0 google-cloud-video-stitcher==0.2.1 \ No newline at end of file From b6f6d81c1cd00b1fb84086521ae075a653169516 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 20 Sep 2022 03:44:17 +0200 Subject: [PATCH 14/55] chore(deps): update dependency google-cloud-video-stitcher to v0.3.0 (#78) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index ab968f2a5d3..b75e8e3533f 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ google-api-python-client==2.61.0 grpcio==1.49.0 -google-cloud-video-stitcher==0.2.1 \ No newline at end of file +google-cloud-video-stitcher==0.3.0 \ No newline at end of file From 266c99b1d40a6b9017d5334cee56c6ee1f2befa6 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 20 Sep 2022 13:06:26 +0200 Subject: [PATCH 15/55] chore(deps): update dependency google-api-python-client to v2.62.0 (#80) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index b75e8e3533f..50bfb7aad59 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.61.0 +google-api-python-client==2.62.0 grpcio==1.49.0 google-cloud-video-stitcher==0.3.0 \ No newline at end of file From b7887a7c3563f434fdb19ebc37c4ffdf50556ea8 Mon Sep 17 00:00:00 2001 From: Nicholas Cook Date: Mon, 3 Oct 2022 13:11:33 -0700 Subject: [PATCH 16/55] docs(samples): Fix Video Stitcher region tag prefix (#86) Co-authored-by: Anthonios Partheniou --- video/stitcher/create_cdn_key.py | 4 ++-- video/stitcher/create_live_session.py | 4 ++-- video/stitcher/create_slate.py | 4 ++-- video/stitcher/create_vod_session.py | 4 ++-- video/stitcher/delete_cdn_key.py | 4 ++-- video/stitcher/delete_slate.py | 4 ++-- video/stitcher/get_cdn_key.py | 4 ++-- video/stitcher/get_live_ad_tag_detail.py | 4 ++-- video/stitcher/get_live_session.py | 4 ++-- video/stitcher/get_slate.py | 4 ++-- video/stitcher/get_vod_ad_tag_detail.py | 4 ++-- video/stitcher/get_vod_session.py | 4 ++-- video/stitcher/get_vod_stitch_detail.py | 4 ++-- video/stitcher/list_cdn_keys.py | 4 ++-- video/stitcher/list_live_ad_tag_details.py | 4 ++-- video/stitcher/list_slates.py | 4 ++-- video/stitcher/list_vod_ad_tag_details.py | 4 ++-- video/stitcher/list_vod_stitch_details.py | 4 ++-- video/stitcher/update_cdn_key.py | 4 ++-- video/stitcher/update_slate.py | 4 ++-- 20 files changed, 40 insertions(+), 40 deletions(-) diff --git a/video/stitcher/create_cdn_key.py b/video/stitcher/create_cdn_key.py index b50c607d093..d764253a18c 100644 --- a/video/stitcher/create_cdn_key.py +++ b/video/stitcher/create_cdn_key.py @@ -21,7 +21,7 @@ --hostname [--gcdn_keyname --gcdn_private_key | --akamai_token_key ] """ -# [START video_stitcher_create_cdn_key] +# [START videostitcher_create_cdn_key] import argparse @@ -76,7 +76,7 @@ def create_cdn_key( return response -# [END video_stitcher_create_cdn_key] +# [END videostitcher_create_cdn_key] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/create_live_session.py b/video/stitcher/create_live_session.py index 1cbf30453ef..1f37e3329ce 100644 --- a/video/stitcher/create_live_session.py +++ b/video/stitcher/create_live_session.py @@ -22,7 +22,7 @@ --slate_id """ -# [START video_stitcher_create_live_session] +# [START videostitcher_create_live_session] import argparse @@ -61,7 +61,7 @@ def create_live_session( return response -# [END video_stitcher_create_live_session] +# [END videostitcher_create_live_session] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/create_slate.py b/video/stitcher/create_slate.py index 87b7f00b8d6..1211e9ae77b 100644 --- a/video/stitcher/create_slate.py +++ b/video/stitcher/create_slate.py @@ -21,7 +21,7 @@ --slate_id --slate_uri """ -# [START video_stitcher_create_slate] +# [START videostitcher_create_slate] import argparse @@ -52,7 +52,7 @@ def create_slate(project_id: str, location: str, slate_id: str, slate_uri: str) return response -# [END video_stitcher_create_slate] +# [END videostitcher_create_slate] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/create_vod_session.py b/video/stitcher/create_vod_session.py index 7806d88aaf8..37bb77ff92a 100644 --- a/video/stitcher/create_vod_session.py +++ b/video/stitcher/create_vod_session.py @@ -21,7 +21,7 @@ --location --source_uri --ad_tag_uri """ -# [START video_stitcher_create_vod_session] +# [START videostitcher_create_vod_session] import argparse @@ -56,7 +56,7 @@ def create_vod_session( return response -# [END video_stitcher_create_vod_session] +# [END videostitcher_create_vod_session] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/delete_cdn_key.py b/video/stitcher/delete_cdn_key.py index 4ad11417ab0..30d538c5831 100644 --- a/video/stitcher/delete_cdn_key.py +++ b/video/stitcher/delete_cdn_key.py @@ -20,7 +20,7 @@ --cdn_key_id """ -# [START video_stitcher_delete_cdn_key] +# [START videostitcher_delete_cdn_key] import argparse @@ -44,7 +44,7 @@ def delete_cdn_key(project_id: str, location: str, cdn_key_id: str) -> str: return response -# [END video_stitcher_delete_cdn_key] +# [END videostitcher_delete_cdn_key] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/delete_slate.py b/video/stitcher/delete_slate.py index 95a36df82b2..49979d858f3 100644 --- a/video/stitcher/delete_slate.py +++ b/video/stitcher/delete_slate.py @@ -20,7 +20,7 @@ --slate_id """ -# [START video_stitcher_delete_slate] +# [START videostitcher_delete_slate] import argparse @@ -44,7 +44,7 @@ def delete_slate(project_id: str, location: str, slate_id: str) -> str: return response -# [END video_stitcher_delete_slate] +# [END videostitcher_delete_slate] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/get_cdn_key.py b/video/stitcher/get_cdn_key.py index fc10ddb9cdf..8a4a249753b 100644 --- a/video/stitcher/get_cdn_key.py +++ b/video/stitcher/get_cdn_key.py @@ -20,7 +20,7 @@ --cdn_key_id """ -# [START video_stitcher_get_cdn_key] +# [START videostitcher_get_cdn_key] import argparse @@ -44,7 +44,7 @@ def get_cdn_key(project_id: str, location: str, cdn_key_id: str) -> str: return response -# [END video_stitcher_get_cdn_key] +# [END videostitcher_get_cdn_key] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/get_live_ad_tag_detail.py b/video/stitcher/get_live_ad_tag_detail.py index 4c5d82841b8..5a872bc771a 100644 --- a/video/stitcher/get_live_ad_tag_detail.py +++ b/video/stitcher/get_live_ad_tag_detail.py @@ -22,7 +22,7 @@ --ad_tag_details_id """ -# [START video_stitcher_get_live_ad_tag_detail] +# [START videostitcher_get_live_ad_tag_detail] import argparse @@ -51,7 +51,7 @@ def get_live_ad_tag_detail( return response -# [END video_stitcher_get_live_ad_tag_detail] +# [END videostitcher_get_live_ad_tag_detail] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/get_live_session.py b/video/stitcher/get_live_session.py index c848dddee13..21648a988ff 100644 --- a/video/stitcher/get_live_session.py +++ b/video/stitcher/get_live_session.py @@ -20,7 +20,7 @@ --session_id """ -# [START video_stitcher_get_live_session] +# [START videostitcher_get_live_session] import argparse @@ -45,7 +45,7 @@ def get_live_session(project_id: str, location: str, session_id: str) -> str: return response -# [END video_stitcher_get_live_session] +# [END videostitcher_get_live_session] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/get_slate.py b/video/stitcher/get_slate.py index 7e2b909e3ba..80aa8a8fcf5 100644 --- a/video/stitcher/get_slate.py +++ b/video/stitcher/get_slate.py @@ -20,7 +20,7 @@ --slate_id """ -# [START video_stitcher_get_slate] +# [START videostitcher_get_slate] import argparse @@ -44,7 +44,7 @@ def get_slate(project_id: str, location: str, slate_id: str) -> str: return response -# [END video_stitcher_get_slate] +# [END videostitcher_get_slate] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/get_vod_ad_tag_detail.py b/video/stitcher/get_vod_ad_tag_detail.py index a8b82129e2c..86314e10014 100644 --- a/video/stitcher/get_vod_ad_tag_detail.py +++ b/video/stitcher/get_vod_ad_tag_detail.py @@ -20,7 +20,7 @@ python get_vod_ad_tag_detail.py --project_id --location --session_id --ad_tag_details_id """ -# [START video_stitcher_get_vod_ad_tag_detail] +# [START videostitcher_get_vod_ad_tag_detail] import argparse @@ -49,7 +49,7 @@ def get_vod_ad_tag_detail( return response -# [END video_stitcher_get_vod_ad_tag_detail] +# [END videostitcher_get_vod_ad_tag_detail] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/get_vod_session.py b/video/stitcher/get_vod_session.py index a27cda07781..b55d0da13ea 100644 --- a/video/stitcher/get_vod_session.py +++ b/video/stitcher/get_vod_session.py @@ -21,7 +21,7 @@ --session_id """ -# [START video_stitcher_get_vod_session] +# [START videostitcher_get_vod_session] import argparse @@ -46,7 +46,7 @@ def get_vod_session(project_id: str, location: str, session_id: str) -> str: return response -# [END video_stitcher_get_vod_session] +# [END videostitcher_get_vod_session] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/get_vod_stitch_detail.py b/video/stitcher/get_vod_stitch_detail.py index 92bb6a9f3d7..86a5da8a7ec 100644 --- a/video/stitcher/get_vod_stitch_detail.py +++ b/video/stitcher/get_vod_stitch_detail.py @@ -22,7 +22,7 @@ --stitch_details_id """ -# [START video_stitcher_get_vod_stitch_detail] +# [START videostitcher_get_vod_stitch_detail] import argparse @@ -51,7 +51,7 @@ def get_vod_stitch_detail( return response -# [END video_stitcher_get_vod_stitch_detail] +# [END videostitcher_get_vod_stitch_detail] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/list_cdn_keys.py b/video/stitcher/list_cdn_keys.py index 4db22f204da..33059912121 100644 --- a/video/stitcher/list_cdn_keys.py +++ b/video/stitcher/list_cdn_keys.py @@ -19,7 +19,7 @@ python list_cdn_keys.py --project_id --location """ -# [START video_stitcher_list_cdn_keys] +# [START videostitcher_list_cdn_keys] import argparse @@ -45,7 +45,7 @@ def list_cdn_keys(project_id: str, location: str) -> str: return response -# [END video_stitcher_list_cdn_keys] +# [END videostitcher_list_cdn_keys] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/list_live_ad_tag_details.py b/video/stitcher/list_live_ad_tag_details.py index 769a7890797..c0181668237 100644 --- a/video/stitcher/list_live_ad_tag_details.py +++ b/video/stitcher/list_live_ad_tag_details.py @@ -21,7 +21,7 @@ --location --session_id """ -# [START video_stitcher_list_live_ad_tag_details] +# [START videostitcher_list_live_ad_tag_details] import argparse @@ -48,7 +48,7 @@ def list_live_ad_tag_details(project_id: str, location: str, session_id: str) -> return page_result -# [END video_stitcher_list_live_ad_tag_details] +# [END videostitcher_list_live_ad_tag_details] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/list_slates.py b/video/stitcher/list_slates.py index c4a0f6df85e..46389bdb7fe 100644 --- a/video/stitcher/list_slates.py +++ b/video/stitcher/list_slates.py @@ -19,7 +19,7 @@ python list_slates.py --project_id --location """ -# [START video_stitcher_list_slates] +# [START videostitcher_list_slates] import argparse @@ -45,7 +45,7 @@ def list_slates(project_id: str, location: str) -> str: return response -# [END video_stitcher_list_slates] +# [END videostitcher_list_slates] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/list_vod_ad_tag_details.py b/video/stitcher/list_vod_ad_tag_details.py index f92a923f1b0..3c8c1bdfb06 100644 --- a/video/stitcher/list_vod_ad_tag_details.py +++ b/video/stitcher/list_vod_ad_tag_details.py @@ -21,7 +21,7 @@ --location --session_id """ -# [START video_stitcher_list_vod_ad_tag_details] +# [START videostitcher_list_vod_ad_tag_details] import argparse @@ -48,7 +48,7 @@ def list_vod_ad_tag_details(project_id: str, location: str, session_id: str) -> return response -# [END video_stitcher_list_vod_ad_tag_details] +# [END videostitcher_list_vod_ad_tag_details] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/list_vod_stitch_details.py b/video/stitcher/list_vod_stitch_details.py index 7bfc17992f4..7d25d5b8382 100644 --- a/video/stitcher/list_vod_stitch_details.py +++ b/video/stitcher/list_vod_stitch_details.py @@ -21,7 +21,7 @@ --location --session_id """ -# [START video_stitcher_list_vod_stitch_details] +# [START videostitcher_list_vod_stitch_details] import argparse @@ -48,7 +48,7 @@ def list_vod_stitch_details(project_id: str, location: str, session_id: str) -> return response -# [END video_stitcher_list_vod_stitch_details] +# [END videostitcher_list_vod_stitch_details] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/update_cdn_key.py b/video/stitcher/update_cdn_key.py index b56ca0e67d5..5c06e057fdb 100644 --- a/video/stitcher/update_cdn_key.py +++ b/video/stitcher/update_cdn_key.py @@ -21,7 +21,7 @@ [--gcdn_keyname --gcdn_private_key | --akamai_token_key ] """ -# [START video_stitcher_update_cdn_key] +# [START videostitcher_update_cdn_key] import argparse @@ -79,7 +79,7 @@ def update_cdn_key( return response -# [END video_stitcher_update_cdn_key] +# [END videostitcher_update_cdn_key] if __name__ == "__main__": parser = argparse.ArgumentParser() diff --git a/video/stitcher/update_slate.py b/video/stitcher/update_slate.py index d796f855bce..c239a060154 100644 --- a/video/stitcher/update_slate.py +++ b/video/stitcher/update_slate.py @@ -20,7 +20,7 @@ --slate_id --slate_uri """ -# [START video_stitcher_update_slate] +# [START videostitcher_update_slate] import argparse @@ -53,7 +53,7 @@ def update_slate(project_id: str, location: str, slate_id: str, slate_uri: str) return response -# [END video_stitcher_update_slate] +# [END videostitcher_update_slate] if __name__ == "__main__": parser = argparse.ArgumentParser() From 974e427b6c702a27b40a9afd062d95401713fbef Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 4 Oct 2022 02:59:20 +0200 Subject: [PATCH 17/55] chore(deps): update dependency grpcio to v1.49.1 (#82) Co-authored-by: Anthonios Partheniou --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 50bfb7aad59..27033393c60 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ google-api-python-client==2.62.0 -grpcio==1.49.0 +grpcio==1.49.1 google-cloud-video-stitcher==0.3.0 \ No newline at end of file From df405bb72ea08ac8e5ffeb68ec38a81f20f61b04 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 4 Oct 2022 03:07:42 +0200 Subject: [PATCH 18/55] chore(deps): update all dependencies (#89) --- video/stitcher/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 27033393c60..43beb3a1e37 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.62.0 +google-api-python-client==2.63.0 grpcio==1.49.1 -google-cloud-video-stitcher==0.3.0 \ No newline at end of file +google-cloud-video-stitcher==0.3.1 \ No newline at end of file From 8d7c83e512b46539b8938a0687575da9e5c3b474 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 4 Oct 2022 18:54:35 +0200 Subject: [PATCH 19/55] chore(deps): update dependency google-api-python-client to v2.64.0 (#90) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 43beb3a1e37..9ddc22d36b6 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.63.0 +google-api-python-client==2.64.0 grpcio==1.49.1 google-cloud-video-stitcher==0.3.1 \ No newline at end of file From c0365e7c3a6e891b308112cef57ec065841e145c Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 18 Oct 2022 15:23:59 +0200 Subject: [PATCH 20/55] chore(deps): update dependency google-cloud-video-stitcher to v0.3.2 (#93) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 9ddc22d36b6..df1ba41701d 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ google-api-python-client==2.64.0 grpcio==1.49.1 -google-cloud-video-stitcher==0.3.1 \ No newline at end of file +google-cloud-video-stitcher==0.3.2 \ No newline at end of file From 5917d06a75a914e04fd8ca05e80fcf9565ec4ee8 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 19 Oct 2022 16:04:31 +0200 Subject: [PATCH 21/55] chore(deps): update all dependencies (#95) --- video/stitcher/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index df1ba41701d..e86c5ed5c86 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.64.0 -grpcio==1.49.1 +google-api-python-client==2.65.0 +grpcio==1.50.0 google-cloud-video-stitcher==0.3.2 \ No newline at end of file From f0fb761e2b39cabe8eb567085bf192c3d669a44d Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 26 Oct 2022 12:45:41 +0200 Subject: [PATCH 22/55] chore(deps): update dependency pytest to v7.2.0 (#97) --- video/stitcher/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements-test.txt b/video/stitcher/requirements-test.txt index 29e59aa8d8f..d1178106ac5 100644 --- a/video/stitcher/requirements-test.txt +++ b/video/stitcher/requirements-test.txt @@ -1,2 +1,2 @@ -pytest==7.1.3 +pytest==7.2.0 requests==2.28.1 \ No newline at end of file From c9940d7625a1cd199b81183403104f3dd8d35532 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 28 Oct 2022 14:21:41 +0200 Subject: [PATCH 23/55] chore(deps): update dependency google-cloud-video-stitcher to v0.4.0 (#100) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index e86c5ed5c86..047a3b6b06b 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ google-api-python-client==2.65.0 grpcio==1.50.0 -google-cloud-video-stitcher==0.3.2 \ No newline at end of file +google-cloud-video-stitcher==0.4.0 \ No newline at end of file From 529677cc8ab72f5f3bf4e4159c84dfd3563b6114 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Sat, 26 Nov 2022 13:25:26 +0100 Subject: [PATCH 24/55] chore(deps): update all dependencies (#105) Co-authored-by: Anthonios Partheniou --- video/stitcher/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 047a3b6b06b..ec9b1f977a4 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.65.0 -grpcio==1.50.0 +google-api-python-client==2.66.0 +grpcio==1.51.0 google-cloud-video-stitcher==0.4.0 \ No newline at end of file From 76b27efc425326ba08dbad16bf087e8e0eacb6ff Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Fri, 16 Dec 2022 00:06:50 +0100 Subject: [PATCH 25/55] chore(deps): update all dependencies (#108) Co-authored-by: Anthonios Partheniou --- video/stitcher/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index ec9b1f977a4..864f169666e 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.66.0 -grpcio==1.51.0 +google-api-python-client==2.70.0 +grpcio==1.51.1 google-cloud-video-stitcher==0.4.0 \ No newline at end of file From 8904a369c5c8fc4b1ff7f7a4ea8a6560f2776e26 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Fri, 16 Dec 2022 03:25:32 +0100 Subject: [PATCH 26/55] chore(deps): update dependency google-cloud-video-stitcher to v0.5.0 (#111) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 864f169666e..26f3a3f941e 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ google-api-python-client==2.70.0 grpcio==1.51.1 -google-cloud-video-stitcher==0.4.0 \ No newline at end of file +google-cloud-video-stitcher==0.5.0 \ No newline at end of file From ba23150a2d9299cd41c086beb5549e746d373381 Mon Sep 17 00:00:00 2001 From: Nicholas Cook Date: Thu, 5 Jan 2023 07:11:54 -0800 Subject: [PATCH 27/55] docs(samples): Add Media CDN samples. Move Akamai sample to its own file. (#112) --- video/stitcher/cdn_key_test.py | 134 +++++++++++++++--------- video/stitcher/create_cdn_key.py | 68 +++++++----- video/stitcher/create_cdn_key_akamai.py | 100 ++++++++++++++++++ video/stitcher/slate_test.py | 16 +-- video/stitcher/update_cdn_key.py | 68 +++++++----- video/stitcher/update_cdn_key_akamai.py | 100 ++++++++++++++++++ video/stitcher/utils.py | 48 +++++++++ 7 files changed, 421 insertions(+), 113 deletions(-) create mode 100644 video/stitcher/create_cdn_key_akamai.py create mode 100644 video/stitcher/update_cdn_key_akamai.py create mode 100644 video/stitcher/utils.py diff --git a/video/stitcher/cdn_key_test.py b/video/stitcher/cdn_key_test.py index 86de02b2d72..7e25aeb15ac 100644 --- a/video/stitcher/cdn_key_test.py +++ b/video/stitcher/cdn_key_test.py @@ -15,97 +15,135 @@ import os import uuid -from google.api_core.exceptions import NotFound +from google.protobuf import timestamp_pb2 import pytest import create_cdn_key +import create_cdn_key_akamai import delete_cdn_key import get_cdn_key import list_cdn_keys import update_cdn_key +import update_cdn_key_akamai +import utils location = "us-central1" project_id = os.environ["GOOGLE_CLOUD_PROJECT"] -gcdn_cdn_key_id = f"my-python-test-cdn-key-{uuid.uuid4()}" -akamai_cdn_key_id = f"my-python-test-cdn-key-{uuid.uuid4()}" +now = timestamp_pb2.Timestamp() +now.GetCurrentTime() + +media_cdn_key_id = f"python-test-media-key-{uuid.uuid4().hex[:5]}-{now.seconds}" +cloud_cdn_key_id = f"python-test-cloud-key-{uuid.uuid4().hex[:5]}-{now.seconds}" +akamai_cdn_key_id = f"python-test-akamai-key-{uuid.uuid4().hex[:5]}-{now.seconds}" hostname = "cdn.example.com" updated_hostname = "updated.example.com" +key_name = "my-key" -gcdn_key_name = "gcdn-key" -gcdn_private_key = "VGhpcyBpcyBhIHRlc3Qgc3RyaW5nLg==" -updated_gcdn_private_key = "VGhpcyBpcyBhbiB1cGRhdGVkIHRlc3Qgc3RyaW5nLg==" -akamai_key = gcdn_private_key -updated_akamai_key = updated_gcdn_private_key +media_cdn_private_key = "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNA" +updated_media_cdn_private_key = ( + "ZZZzNDU2Nzg5MDEyMzQ1Njc4OTAxzg5MDEyMzQ1Njc4OTAxMjM0NTY3DkwMTIZZZ" +) +cloud_cdn_private_key = "VGhpcyBpcyBhIHRlc3Qgc3RyaW5nLg==" +updated_cloud_cdn_private_key = "VGhpcyBpcyBhbiB1cGRhdGVkIHRlc3Qgc3RyaW5nLg==" +akamai_key = cloud_cdn_private_key +updated_akamai_key = updated_cloud_cdn_private_key def test_cdn_key_operations(capsys: pytest.fixture) -> None: - try: - delete_cdn_key.delete_cdn_key(project_id, location, gcdn_cdn_key_id) - except NotFound as e: - print(f"Ignoring NotFound, details: {e}") - out, _ = capsys.readouterr() + utils.delete_stale_cdn_keys(project_id, location) - try: - delete_cdn_key.delete_cdn_key(project_id, location, akamai_cdn_key_id) - except NotFound as e: - print(f"Ignoring NotFound, details: {e}") - out, _ = capsys.readouterr() - - # GCDN CDN key tests + # Media CDN key tests create_cdn_key.create_cdn_key( project_id, location, - gcdn_cdn_key_id, + media_cdn_key_id, hostname, - gcdn_key_name, - gcdn_private_key, + key_name, + media_cdn_private_key, + False, ) out, _ = capsys.readouterr() - assert gcdn_cdn_key_id in out + assert media_cdn_key_id in out list_cdn_keys.list_cdn_keys(project_id, location) out, _ = capsys.readouterr() - assert gcdn_cdn_key_id in out + assert media_cdn_key_id in out - # Update the hostname only + # Update the hostname and private key; the private key value + # is not returned by the client response = update_cdn_key.update_cdn_key( - project_id, location, gcdn_cdn_key_id, updated_hostname + project_id, + location, + media_cdn_key_id, + updated_hostname, + key_name, + updated_media_cdn_private_key, + False, ) out, _ = capsys.readouterr() - assert gcdn_cdn_key_id in out + assert media_cdn_key_id in out assert updated_hostname in response.hostname - # Update the private key; the private key value is not returned by the client - response = update_cdn_key.update_cdn_key( + get_cdn_key.get_cdn_key(project_id, location, media_cdn_key_id) + out, _ = capsys.readouterr() + assert media_cdn_key_id in out + + delete_cdn_key.delete_cdn_key(project_id, location, media_cdn_key_id) + out, _ = capsys.readouterr() + assert "Deleted CDN key" in out + + # Cloud CDN key tests + + create_cdn_key.create_cdn_key( project_id, location, - gcdn_cdn_key_id, + cloud_cdn_key_id, hostname, - gcdn_key_name, - updated_gcdn_private_key, + key_name, + cloud_cdn_private_key, + True, + ) + out, _ = capsys.readouterr() + assert cloud_cdn_key_id in out + + list_cdn_keys.list_cdn_keys(project_id, location) + out, _ = capsys.readouterr() + assert cloud_cdn_key_id in out + + # Update the hostname and private key; the private key value + # is not returned by the client + response = update_cdn_key.update_cdn_key( + project_id, + location, + cloud_cdn_key_id, + updated_hostname, + key_name, + updated_cloud_cdn_private_key, + True, ) out, _ = capsys.readouterr() - assert gcdn_cdn_key_id in out + assert cloud_cdn_key_id in out + assert updated_hostname in response.hostname - get_cdn_key.get_cdn_key(project_id, location, gcdn_cdn_key_id) + get_cdn_key.get_cdn_key(project_id, location, cloud_cdn_key_id) out, _ = capsys.readouterr() - assert gcdn_cdn_key_id in out + assert cloud_cdn_key_id in out - delete_cdn_key.delete_cdn_key(project_id, location, gcdn_cdn_key_id) + delete_cdn_key.delete_cdn_key(project_id, location, cloud_cdn_key_id) out, _ = capsys.readouterr() assert "Deleted CDN key" in out # Akamai CDN key tests - create_cdn_key.create_cdn_key( + create_cdn_key_akamai.create_cdn_key_akamai( project_id, location, akamai_cdn_key_id, hostname, - akamai_token_key=akamai_key, + akamai_key, ) out, _ = capsys.readouterr() assert akamai_cdn_key_id in out @@ -114,24 +152,18 @@ def test_cdn_key_operations(capsys: pytest.fixture) -> None: out, _ = capsys.readouterr() assert akamai_cdn_key_id in out - # Update the hostname only - response = update_cdn_key.update_cdn_key( - project_id, location, akamai_cdn_key_id, updated_hostname - ) - out, _ = capsys.readouterr() - assert akamai_cdn_key_id in out - assert updated_hostname in response.hostname - - # Update the private key; the private key value is not returned by the client - response = update_cdn_key.update_cdn_key( + # Update the hostname and private key; the private key value + # is not returned by the client + response = update_cdn_key_akamai.update_cdn_key_akamai( project_id, location, akamai_cdn_key_id, - hostname, - akamai_token_key=updated_akamai_key, + updated_hostname, + updated_akamai_key, ) out, _ = capsys.readouterr() assert akamai_cdn_key_id in out + assert updated_hostname in response.hostname get_cdn_key.get_cdn_key(project_id, location, akamai_cdn_key_id) out, _ = capsys.readouterr() diff --git a/video/stitcher/create_cdn_key.py b/video/stitcher/create_cdn_key.py index d764253a18c..9d3c4492029 100644 --- a/video/stitcher/create_cdn_key.py +++ b/video/stitcher/create_cdn_key.py @@ -14,11 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Google Cloud Video Stitcher sample for creating a CDN key. A CDN key is used -to retrieve protected media. +"""Google Cloud Video Stitcher sample for creating a Media CDN key +or a Cloud CDN key. A CDN key is used to retrieve protected media. Example usage: - python create_cdn_key.py --project_id --location --cdn_key_id \ - --hostname [--gcdn_keyname --gcdn_private_key | --akamai_token_key ] + python create_cdn_key.py --project_id --location \ + --cdn_key_id --hostname \ + --key_name --private_key [--is_cloud_cdn] """ # [START videostitcher_create_cdn_key] @@ -36,19 +37,23 @@ def create_cdn_key( location: str, cdn_key_id: str, hostname: str, - gcdn_keyname: str = None, - gcdn_private_key: str = None, - akamai_token_key: str = None, + key_name: str, + private_key: str, + is_cloud_cdn: bool, ) -> str: - """Creates a Google Cloud or Akamai CDN key. + """Creates a Cloud CDN or Media CDN key. Args: project_id: The GCP project ID. location: The location in which to create the CDN key. cdn_key_id: The user-defined CDN key ID. hostname: The hostname to which this CDN key applies. - gcdn_keyname: Applies to a Google Cloud CDN key. A base64-encoded string secret. - gcdn_private_key: Applies to a Google Cloud CDN key. Public name of the key. - akamai_token_key: Applies to an Akamai CDN key. A base64-encoded string token key.""" + key_name: For a Media CDN key, this is the keyset name. + For a Cloud CDN key, this is the public name of the CDN key. + private_key: For a Media CDN key, this is a 64-byte Ed25519 private + key encoded as a base64-encoded string. + See https://cloud.google.com/video-stitcher/docs/how-to/managing-cdn-keys#create-private-key-media-cdn + for more information. For a Cloud CDN key, this is a base64-encoded string secret. + is_cloud_cdn: If true, create a Cloud CDN key. If false, create a Media CDN key.""" client = VideoStitcherServiceClient() @@ -59,14 +64,15 @@ def create_cdn_key( hostname=hostname, ) - if akamai_token_key is not None: - cdn_key.akamai_cdn_key = stitcher_v1.types.AkamaiCdnKey( - token_key=akamai_token_key, - ) - elif gcdn_keyname is not None: + if is_cloud_cdn: cdn_key.google_cdn_key = stitcher_v1.types.GoogleCdnKey( - key_name=gcdn_keyname, - private_key=gcdn_private_key, + key_name=key_name, + private_key=private_key, + ) + else: + cdn_key.media_cdn_key = stitcher_v1.types.MediaCdnKey( + key_name=key_name, + private_key=private_key, ) response = client.create_cdn_key( @@ -97,16 +103,24 @@ def create_cdn_key( required=True, ) parser.add_argument( - "--gcdn_keyname", - help="Applies to a Google Cloud CDN key. The base64-encoded string secret.", + "--key_name", + help="For a Media CDN key, this is the keyset name. For a Cloud CDN" + + " key, this is the public name of the CDN key.", + required=True, ) parser.add_argument( - "--gcdn_private_key", - help="Applies to a Google Cloud CDN key. Public name of the key.", + "--private_key", + help="For a Media CDN key, this is a 64-byte Ed25519 private key" + + "encoded as a base64-encoded string. See" + + " https://cloud.google.com/video-stitcher/docs/how-to/managing-cdn-keys#create-private-key-media-cdn" + + " for more information. For a Cloud CDN key, this is a" + + " base64-encoded string secret.", + required=True, ) parser.add_argument( - "--akamai_token_key", - help="Applies to an Akamai CDN key. The base64-encoded string token key.", + "--is_cloud_cdn", + action="store_true", + help="If included, create a Cloud CDN key. If absent, create a Media CDN key.", ) args = parser.parse_args() create_cdn_key( @@ -114,7 +128,7 @@ def create_cdn_key( args.location, args.cdn_key_id, args.hostname, - args.gcdn_keyname, - args.gcdn_private_key, - args.akamai_token_key, + args.key_name, + args.private_key, + args.is_cloud_cdn, ) diff --git a/video/stitcher/create_cdn_key_akamai.py b/video/stitcher/create_cdn_key_akamai.py new file mode 100644 index 00000000000..d71141e641a --- /dev/null +++ b/video/stitcher/create_cdn_key_akamai.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for creating an Akamai CDN key. A CDN key is used +to retrieve protected media. +Example usage: + python create_cdn_key_akamai.py --project_id --location --cdn_key_id \ + --hostname --akamai_token_key +""" + +# [START videostitcher_create_cdn_key_akamai] + +import argparse + +from google.cloud.video import stitcher_v1 +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def create_cdn_key_akamai( + project_id: str, + location: str, + cdn_key_id: str, + hostname: str, + akamai_token_key: str, +) -> str: + """Creates an Akamai CDN key. + Args: + project_id: The GCP project ID. + location: The location in which to create the CDN key. + cdn_key_id: The user-defined CDN key ID. + hostname: The hostname to which this CDN key applies. + akamai_token_key: A base64-encoded string token key.""" + + client = VideoStitcherServiceClient() + + parent = f"projects/{project_id}/locations/{location}" + + cdn_key = stitcher_v1.types.CdnKey( + name=cdn_key_id, + hostname=hostname, + akamai_cdn_key=stitcher_v1.types.AkamaiCdnKey( + token_key=akamai_token_key, + ), + ) + + response = client.create_cdn_key( + parent=parent, cdn_key_id=cdn_key_id, cdn_key=cdn_key + ) + print(f"CDN key: {response.name}") + return response + + +# [END videostitcher_create_cdn_key_akamai] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location in which to create the CDN key.", + default="us-central1", + ) + parser.add_argument( + "--cdn_key_id", + help="The user-defined CDN key ID.", + required=True, + ) + parser.add_argument( + "--hostname", + help="The hostname to which this CDN key applies.", + required=True, + ) + parser.add_argument( + "--akamai_token_key", + help="The base64-encoded string token key.", + required=True, + ) + args = parser.parse_args() + create_cdn_key_akamai( + args.project_id, + args.location, + args.cdn_key_id, + args.hostname, + args.akamai_token_key, + ) diff --git a/video/stitcher/slate_test.py b/video/stitcher/slate_test.py index 86079c5cfa9..6c186ae7175 100644 --- a/video/stitcher/slate_test.py +++ b/video/stitcher/slate_test.py @@ -15,7 +15,7 @@ import os import uuid -from google.api_core.exceptions import NotFound +from google.protobuf import timestamp_pb2 import pytest import create_slate @@ -23,11 +23,15 @@ import get_slate import list_slates import update_slate +import utils location = "us-west1" project_id = os.environ["GOOGLE_CLOUD_PROJECT"] project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"] -slate_id = f"my-python-test-slate-{uuid.uuid4()}" +now = timestamp_pb2.Timestamp() +now.GetCurrentTime() + +slate_id = f"python-test-slate-{uuid.uuid4().hex[:5]}-{now.seconds}" input_bucket_name = "cloud-samples-data/media/" slate_video_file_name = "ForBiggerEscapes.mp4" @@ -41,6 +45,8 @@ def test_slate_operations(capsys: pytest.fixture) -> None: + utils.delete_stale_slates(project_id, location) + slate_name_project_number = ( f"projects/{project_number}/locations/{location}/slates/{slate_id}" ) @@ -48,12 +54,6 @@ def test_slate_operations(capsys: pytest.fixture) -> None: f"projects/{project_id}/locations/{location}/slates/{slate_id}" ) - try: - delete_slate.delete_slate(project_id, location, slate_id) - except NotFound as e: - print(f"Ignoring NotFound, details: {e}") - out, _ = capsys.readouterr() - create_slate.create_slate(project_id, location, slate_id, slate_uri) out, _ = capsys.readouterr() assert slate_name_project_number in out diff --git a/video/stitcher/update_cdn_key.py b/video/stitcher/update_cdn_key.py index 5c06e057fdb..14144dbf03f 100644 --- a/video/stitcher/update_cdn_key.py +++ b/video/stitcher/update_cdn_key.py @@ -14,11 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Google Cloud Video Stitcher sample for updating a CDN key. +"""Google Cloud Video Stitcher sample for updating a Media CDN or +Cloud CDN key. Example usage: python update_cdn_key.py --project_id --location \ --cdn_key_id --hostname \ - [--gcdn_keyname --gcdn_private_key | --akamai_token_key ] + --key_name --private_key [--is_cloud_cdn] """ # [START videostitcher_update_cdn_key] @@ -37,19 +38,23 @@ def update_cdn_key( location: str, cdn_key_id: str, hostname: str, - gcdn_keyname: str = None, - gcdn_private_key: str = None, - akamai_token_key: str = None, + key_name: str, + private_key: str, + is_cloud_cdn: bool, ) -> str: - """Updates a Google Cloud or Akamai CDN key. + """Updates a Media CDN or Cloud CDN key. Args: project_id: The GCP project ID. location: The location of the CDN key. cdn_key_id: The user-defined CDN key ID. hostname: The hostname to which this CDN key applies. - gcdn_keyname: Applies to a Google Cloud CDN key. A base64-encoded string secret. - gcdn_private_key: Applies to a Google Cloud CDN key. Public name of the key. - akamai_token_key: Applies to an Akamai CDN key. A base64-encoded string token key.""" + key_name: For a Media CDN key, this is the keyset name. + For a Cloud CDN key, this is the public name of the CDN key. + private_key: For a Media CDN key, this is a 64-byte Ed25519 private + key encoded as a base64-encoded string. + See https://cloud.google.com/video-stitcher/docs/how-to/managing-cdn-keys#create-private-key-media-cdn + for more information. For a Cloud CDN key, this is a base64-encoded string secret. + is_cloud_cdn: If true, update a Cloud CDN key. If false, update a Media CDN key.""" client = VideoStitcherServiceClient() @@ -60,19 +65,18 @@ def update_cdn_key( hostname=hostname, ) - if akamai_token_key is not None: - cdn_key.akamai_cdn_key = stitcher_v1.types.AkamaiCdnKey( - token_key=akamai_token_key, - ) - update_mask = field_mask.FieldMask(paths=["hostname", "akamai_cdn_key"]) - elif gcdn_keyname is not None: + if is_cloud_cdn: cdn_key.google_cdn_key = stitcher_v1.types.GoogleCdnKey( - key_name=gcdn_keyname, - private_key=gcdn_private_key, + key_name=key_name, + private_key=private_key, ) update_mask = field_mask.FieldMask(paths=["hostname", "google_cdn_key"]) else: - update_mask = field_mask.FieldMask(paths=["hostname"]) + cdn_key.media_cdn_key = stitcher_v1.types.MediaCdnKey( + key_name=key_name, + private_key=private_key, + ) + update_mask = field_mask.FieldMask(paths=["hostname", "media_cdn_key"]) response = client.update_cdn_key(cdn_key=cdn_key, update_mask=update_mask) print(f"Updated CDN key: {response.name}") @@ -87,6 +91,7 @@ def update_cdn_key( parser.add_argument( "--location", help="The location of the CDN key.", + required=True, ) parser.add_argument( "--cdn_key_id", @@ -99,24 +104,33 @@ def update_cdn_key( required=True, ) parser.add_argument( - "--gcdn_keyname", - help="Applies to a Google Cloud CDN key. The base64-encoded string secret.", + "--key_name", + help="For a Media CDN key, this is the keyset name. For a Cloud CDN" + + " key, this is the public name of the CDN key.", + required=True, ) parser.add_argument( - "--gcdn_private_key", - help="Applies to a Google Cloud CDN key. Public name of the key.", + "--private_key", + help="For a Media CDN key, this is a 64-byte Ed25519 private key" + + "encoded as a base64-encoded string. See" + + " https://cloud.google.com/video-stitcher/docs/how-to/managing-cdn-keys#create-private-key-media-cdn" + + " for more information. For a Cloud CDN key, this is a" + + " base64-encoded string secret.", + required=True, ) parser.add_argument( - "--akamai_token_key", - help="Applies to an Akamai CDN key. The base64-encoded string token key.", + "--is_cloud_cdn", + action="store_true", + help="If included, create a Cloud CDN key. If absent, create a Media CDN key.", ) + args = parser.parse_args() update_cdn_key( args.project_id, args.location, args.cdn_key_id, args.hostname, - args.gcdn_keyname, - args.gcdn_private_key, - args.akamai_token_key, + args.key_name, + args.private_key, + args.is_cloud_cdn, ) diff --git a/video/stitcher/update_cdn_key_akamai.py b/video/stitcher/update_cdn_key_akamai.py new file mode 100644 index 00000000000..0c5ca09e635 --- /dev/null +++ b/video/stitcher/update_cdn_key_akamai.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python + +# Copyright 2022 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for updating an Akamai CDN key. +Example usage: + python update_cdn_key_akamai.py --project_id --location \ + --cdn_key_id --hostname \ + --akamai_token_key +""" + +# [START videostitcher_update_cdn_key_akamai] + +import argparse + +from google.cloud.video import stitcher_v1 +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) +from google.protobuf import field_mask_pb2 as field_mask + + +def update_cdn_key_akamai( + project_id: str, + location: str, + cdn_key_id: str, + hostname: str, + akamai_token_key: str, +) -> str: + """Updates an Akamai CDN key. + Args: + project_id: The GCP project ID. + location: The location of the CDN key. + cdn_key_id: The user-defined CDN key ID. + hostname: The hostname to which this CDN key applies. + akamai_token_key: A base64-encoded string token key.""" + + client = VideoStitcherServiceClient() + + name = f"projects/{project_id}/locations/{location}/cdnKeys/{cdn_key_id}" + + cdn_key = stitcher_v1.types.CdnKey( + name=name, + hostname=hostname, + akamai_cdn_key=stitcher_v1.types.AkamaiCdnKey( + token_key=akamai_token_key, + ), + ) + update_mask = field_mask.FieldMask(paths=["hostname", "akamai_cdn_key"]) + + response = client.update_cdn_key(cdn_key=cdn_key, update_mask=update_mask) + print(f"Updated CDN key: {response.name}") + return response + + +# [END videostitcher_update_cdn_key_akamai] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location of the CDN key.", + required=True, + ) + parser.add_argument( + "--cdn_key_id", + help="The user-defined CDN key ID.", + required=True, + ) + parser.add_argument( + "--hostname", + help="The hostname to which this CDN key applies.", + required=True, + ) + parser.add_argument( + "--akamai_token_key", + help="The base64-encoded string token key.", + required=True, + ) + args = parser.parse_args() + update_cdn_key_akamai( + args.project_id, + args.location, + args.cdn_key_id, + args.hostname, + args.akamai_token_key, + ) diff --git a/video/stitcher/utils.py b/video/stitcher/utils.py new file mode 100644 index 00000000000..6cd5683476e --- /dev/null +++ b/video/stitcher/utils.py @@ -0,0 +1,48 @@ +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) +from google.protobuf import timestamp_pb2 + +seconds_per_hour = 3600 + + +def delete_stale_slates(project_id: str, location: str) -> None: + """Lists all outdated slates in a location. + Args: + project_id: The GCP project ID. + location: The location of the slates.""" + + client = VideoStitcherServiceClient() + + parent = f"projects/{project_id}/locations/{location}" + response = client.list_slates(parent=parent) + + now = timestamp_pb2.Timestamp() + now.GetCurrentTime() + + for slate in response.slates: + tmp = slate.name.split("-") + creation_time_sec = int(tmp.pop()) + if (now.seconds - creation_time_sec) > (3 * seconds_per_hour): + response = client.delete_slate(name=slate.name) + + +def delete_stale_cdn_keys(project_id: str, location: str) -> None: + """Lists all outdated CDN keys in a location. + Args: + project_id: The GCP project ID. + location: The location of the CDN keys.""" + + client = VideoStitcherServiceClient() + + parent = f"projects/{project_id}/locations/{location}" + response = client.list_cdn_keys(parent=parent) + + now = timestamp_pb2.Timestamp() + now.GetCurrentTime() + + for cdn_key in response.cdn_keys: + tmp = cdn_key.name.split("-") + creation_time_sec = int(tmp.pop()) + if (now.seconds - creation_time_sec) > (3 * seconds_per_hour): + response = client.delete_cdn_key(name=cdn_key.name) From ab24b7ea8201c1cd830b792f3353b4ce052046c6 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 5 Jan 2023 17:54:54 +0100 Subject: [PATCH 28/55] chore(deps): update dependency google-api-python-client to v2.71.0 (#113) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 26f3a3f941e..5f11145b209 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.70.0 +google-api-python-client==2.71.0 grpcio==1.51.1 google-cloud-video-stitcher==0.5.0 \ No newline at end of file From 6108b9e58b7b1ccc7b9855b96695da561e31a1a2 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 5 Jan 2023 21:05:12 +0100 Subject: [PATCH 29/55] chore(deps): update dependency google-cloud-video-stitcher to v0.5.1 (#115) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 5f11145b209..0cef9887b0b 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ google-api-python-client==2.71.0 grpcio==1.51.1 -google-cloud-video-stitcher==0.5.0 \ No newline at end of file +google-cloud-video-stitcher==0.5.1 \ No newline at end of file From 837d37277603f44e4bd5a64b5de461c1bff9ae77 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 10 Jan 2023 17:52:01 +0000 Subject: [PATCH 30/55] chore(deps): update dependency google-api-python-client to v2.72.0 (#118) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 0cef9887b0b..98a0557d712 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.71.0 +google-api-python-client==2.72.0 grpcio==1.51.1 google-cloud-video-stitcher==0.5.1 \ No newline at end of file From 3ff4bfef89204c2754e8c4b7bce71f6ddf339a1a Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 12 Jan 2023 17:24:04 +0000 Subject: [PATCH 31/55] chore(deps): update dependency requests to v2.28.2 (#119) --- video/stitcher/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements-test.txt b/video/stitcher/requirements-test.txt index d1178106ac5..62672d44e32 100644 --- a/video/stitcher/requirements-test.txt +++ b/video/stitcher/requirements-test.txt @@ -1,2 +1,2 @@ pytest==7.2.0 -requests==2.28.1 \ No newline at end of file +requests==2.28.2 \ No newline at end of file From 242a4d7fa16df3ec3e1cd6a70d492b6d3f5157c4 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 12 Jan 2023 18:46:09 +0000 Subject: [PATCH 32/55] chore(deps): update dependency google-cloud-video-stitcher to v0.6.0 (#121) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 98a0557d712..02c5adc49d7 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ google-api-python-client==2.72.0 grpcio==1.51.1 -google-cloud-video-stitcher==0.5.1 \ No newline at end of file +google-cloud-video-stitcher==0.6.0 \ No newline at end of file From c3656314cddf7eae69412447141655ac9a4cfc3f Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Sat, 14 Jan 2023 18:11:43 +0000 Subject: [PATCH 33/55] chore(deps): update dependency pytest to v7.2.1 (#122) --- video/stitcher/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements-test.txt b/video/stitcher/requirements-test.txt index 62672d44e32..3dd25968889 100644 --- a/video/stitcher/requirements-test.txt +++ b/video/stitcher/requirements-test.txt @@ -1,2 +1,2 @@ -pytest==7.2.0 +pytest==7.2.1 requests==2.28.2 \ No newline at end of file From 02f214313d6a0252f23ada17d79d481535515f0a Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 17 Jan 2023 17:25:07 +0000 Subject: [PATCH 34/55] chore(deps): update dependency google-api-python-client to v2.73.0 (#123) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 02c5adc49d7..4adb8373182 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.72.0 +google-api-python-client==2.73.0 grpcio==1.51.1 google-cloud-video-stitcher==0.6.0 \ No newline at end of file From 0abc5aa0342878ee73193df3523f08230e0b754b Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Mon, 23 Jan 2023 16:28:55 +0000 Subject: [PATCH 35/55] chore(deps): update dependency google-cloud-video-stitcher to v0.6.1 (#126) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 4adb8373182..0a3fd28696f 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ google-api-python-client==2.73.0 grpcio==1.51.1 -google-cloud-video-stitcher==0.6.0 \ No newline at end of file +google-cloud-video-stitcher==0.6.1 \ No newline at end of file From 01250ce924372d4931917650e4f9f14168c6726e Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 25 Jan 2023 21:53:11 +0000 Subject: [PATCH 36/55] chore(deps): update dependency google-api-python-client to v2.74.0 (#127) Co-authored-by: Anthonios Partheniou --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 0a3fd28696f..b27c52687cd 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.73.0 +google-api-python-client==2.74.0 grpcio==1.51.1 google-cloud-video-stitcher==0.6.1 \ No newline at end of file From 0728d4a243a5c4af46c0053c3e90ddf42a490101 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 31 Jan 2023 17:43:39 +0000 Subject: [PATCH 37/55] chore(deps): update dependency google-api-python-client to v2.75.0 (#130) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index b27c52687cd..d5e859824cb 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.74.0 +google-api-python-client==2.75.0 grpcio==1.51.1 google-cloud-video-stitcher==0.6.1 \ No newline at end of file From 414bf6e4a4f76356749f0f7a076bda781fa78731 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Fri, 3 Feb 2023 11:17:14 +0000 Subject: [PATCH 38/55] chore(deps): update dependency google-api-python-client to v2.76.0 (#131) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index d5e859824cb..823e63c0c33 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.75.0 +google-api-python-client==2.76.0 grpcio==1.51.1 google-cloud-video-stitcher==0.6.1 \ No newline at end of file From 17dd3f4db677f098991f1d7f4ba87e37f196b43f Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 8 Feb 2023 20:16:47 +0000 Subject: [PATCH 39/55] chore(deps): update dependency google-api-python-client to v2.77.0 (#134) Co-authored-by: Anthonios Partheniou --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 823e63c0c33..8117a68753a 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.76.0 +google-api-python-client==2.77.0 grpcio==1.51.1 google-cloud-video-stitcher==0.6.1 \ No newline at end of file From a9007df2a7e5c5a275e0cda8bbbafb1110b7b6a7 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 15 Feb 2023 22:42:44 +0000 Subject: [PATCH 40/55] chore(deps): update dependency google-api-python-client to v2.78.0 (#135) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 8117a68753a..a631f2d8c1b 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.77.0 +google-api-python-client==2.78.0 grpcio==1.51.1 google-cloud-video-stitcher==0.6.1 \ No newline at end of file From 32480b66c6e57e4a1d3d592061e46b4a2e6357bc Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 1 Mar 2023 10:26:38 +0000 Subject: [PATCH 41/55] chore(deps): update all dependencies (#136) Co-authored-by: Anthonios Partheniou --- video/stitcher/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index a631f2d8c1b..73eabb51926 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.78.0 -grpcio==1.51.1 +google-api-python-client==2.79.0 +grpcio==1.51.3 google-cloud-video-stitcher==0.6.1 \ No newline at end of file From aa2387ce3edcbcc1a22916880591b9fd961ed1e3 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 1 Mar 2023 13:48:54 +0000 Subject: [PATCH 42/55] chore(deps): update dependency google-api-python-client to v2.80.0 (#139) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 73eabb51926..b78ceb6236a 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.79.0 +google-api-python-client==2.80.0 grpcio==1.51.3 google-cloud-video-stitcher==0.6.1 \ No newline at end of file From 25a60f3247be4ff1b546bd99bc1698bbbd14af04 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Sat, 4 Mar 2023 11:31:12 +0000 Subject: [PATCH 43/55] chore(deps): update dependency pytest to v7.2.2 (#140) --- video/stitcher/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements-test.txt b/video/stitcher/requirements-test.txt index 3dd25968889..f3de0834cda 100644 --- a/video/stitcher/requirements-test.txt +++ b/video/stitcher/requirements-test.txt @@ -1,2 +1,2 @@ -pytest==7.2.1 +pytest==7.2.2 requests==2.28.2 \ No newline at end of file From 84e2be8f2c8f196338b3845c514c54116b479842 Mon Sep 17 00:00:00 2001 From: Nicholas Cook Date: Thu, 13 Apr 2023 10:01:00 -0700 Subject: [PATCH 44/55] docs: skip testing temporarily (#146) --- video/stitcher/cdn_key_test.py | 1 + video/stitcher/live_session_test.py | 1 + video/stitcher/slate_test.py | 1 + video/stitcher/vod_session_test.py | 1 + 4 files changed, 4 insertions(+) diff --git a/video/stitcher/cdn_key_test.py b/video/stitcher/cdn_key_test.py index 7e25aeb15ac..7e6b6054475 100644 --- a/video/stitcher/cdn_key_test.py +++ b/video/stitcher/cdn_key_test.py @@ -50,6 +50,7 @@ updated_akamai_key = updated_cloud_cdn_private_key +@pytest.mark.skip() def test_cdn_key_operations(capsys: pytest.fixture) -> None: utils.delete_stale_cdn_keys(project_id, location) diff --git a/video/stitcher/live_session_test.py b/video/stitcher/live_session_test.py index 54c8d0e63b8..5bbbd456791 100644 --- a/video/stitcher/live_session_test.py +++ b/video/stitcher/live_session_test.py @@ -42,6 +42,7 @@ slate_uri = f"https://storage.googleapis.com/{input_bucket_name}{slate_video_file_name}" +@pytest.mark.skip() def test_live_session_operations(capsys: pytest.fixture) -> None: # Test setup diff --git a/video/stitcher/slate_test.py b/video/stitcher/slate_test.py index 6c186ae7175..0773a06db4b 100644 --- a/video/stitcher/slate_test.py +++ b/video/stitcher/slate_test.py @@ -43,6 +43,7 @@ ) +@pytest.mark.skip() def test_slate_operations(capsys: pytest.fixture) -> None: utils.delete_stale_slates(project_id, location) diff --git a/video/stitcher/vod_session_test.py b/video/stitcher/vod_session_test.py index 187b1612d4d..37ed74ed311 100644 --- a/video/stitcher/vod_session_test.py +++ b/video/stitcher/vod_session_test.py @@ -33,6 +33,7 @@ ad_tag_uri = "https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpreonly&ciu_szs=300x250%2C728x90&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=" +@pytest.mark.skip() def test_vod_session_operations(capsys: pytest.fixture) -> None: create_vod_session.create_vod_session(project_id, location, vod_uri, ad_tag_uri) From ae909e2cc2ba41ef81cf7edfe39e0ef15a8707cc Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 19 Apr 2023 15:44:18 +0200 Subject: [PATCH 45/55] chore(deps): update all dependencies (#141) --- video/stitcher/requirements-test.txt | 2 +- video/stitcher/requirements.txt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/video/stitcher/requirements-test.txt b/video/stitcher/requirements-test.txt index f3de0834cda..4f3b64cf82f 100644 --- a/video/stitcher/requirements-test.txt +++ b/video/stitcher/requirements-test.txt @@ -1,2 +1,2 @@ -pytest==7.2.2 +pytest==7.3.1 requests==2.28.2 \ No newline at end of file diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index b78ceb6236a..39fa8194535 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.80.0 -grpcio==1.51.3 -google-cloud-video-stitcher==0.6.1 \ No newline at end of file +google-api-python-client==2.86.0 +grpcio==1.54.0 +google-cloud-video-stitcher==0.7.0 \ No newline at end of file From 726eed850101c7602f83f57a4b09e82a7f2f8ea1 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Mon, 15 May 2023 22:25:09 +0200 Subject: [PATCH 46/55] chore(deps): update all dependencies (#149) --- video/stitcher/requirements-test.txt | 2 +- video/stitcher/requirements.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/video/stitcher/requirements-test.txt b/video/stitcher/requirements-test.txt index 4f3b64cf82f..ea1d94ae6d9 100644 --- a/video/stitcher/requirements-test.txt +++ b/video/stitcher/requirements-test.txt @@ -1,2 +1,2 @@ pytest==7.3.1 -requests==2.28.2 \ No newline at end of file +requests==2.30.0 \ No newline at end of file diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 39fa8194535..5aff127f173 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ google-api-python-client==2.86.0 -grpcio==1.54.0 -google-cloud-video-stitcher==0.7.0 \ No newline at end of file +grpcio==1.54.2 +google-cloud-video-stitcher==0.7.1 \ No newline at end of file From de6681f6b7fc577c2d9745f0d14f5f018d07c598 Mon Sep 17 00:00:00 2001 From: Nicholas Cook Date: Fri, 19 May 2023 11:54:57 -0700 Subject: [PATCH 47/55] docs(samples): Update slates and CDN keys to use LROs (#150) * docs(samples): Update slates and CDN keys to use LROs. Add samples and tests for live configs and update live session samples. * clear out old resources * add error checking to deleting resources * use default LRO timeouts --- video/stitcher/cdn_key_test.py | 1 - video/stitcher/create_cdn_key.py | 3 +- video/stitcher/create_cdn_key_akamai.py | 3 +- video/stitcher/create_live_config.py | 111 ++++++++++++++++++++++++ video/stitcher/create_live_session.py | 40 +++------ video/stitcher/create_slate.py | 3 +- video/stitcher/create_vod_session.py | 2 +- video/stitcher/delete_cdn_key.py | 3 +- video/stitcher/delete_live_config.py | 68 +++++++++++++++ video/stitcher/delete_slate.py | 3 +- video/stitcher/get_live_config.py | 67 ++++++++++++++ video/stitcher/list_live_configs.py | 62 +++++++++++++ video/stitcher/live_config_test.py | 89 +++++++++++++++++++ video/stitcher/live_session_test.py | 46 ++++++---- video/stitcher/slate_test.py | 13 +-- video/stitcher/update_cdn_key.py | 3 +- video/stitcher/update_cdn_key_akamai.py | 3 +- video/stitcher/update_slate.py | 3 +- video/stitcher/utils.py | 34 +++++++- video/stitcher/vod_session_test.py | 1 - 20 files changed, 488 insertions(+), 70 deletions(-) create mode 100644 video/stitcher/create_live_config.py create mode 100644 video/stitcher/delete_live_config.py create mode 100644 video/stitcher/get_live_config.py create mode 100644 video/stitcher/list_live_configs.py create mode 100644 video/stitcher/live_config_test.py diff --git a/video/stitcher/cdn_key_test.py b/video/stitcher/cdn_key_test.py index 7e6b6054475..7e25aeb15ac 100644 --- a/video/stitcher/cdn_key_test.py +++ b/video/stitcher/cdn_key_test.py @@ -50,7 +50,6 @@ updated_akamai_key = updated_cloud_cdn_private_key -@pytest.mark.skip() def test_cdn_key_operations(capsys: pytest.fixture) -> None: utils.delete_stale_cdn_keys(project_id, location) diff --git a/video/stitcher/create_cdn_key.py b/video/stitcher/create_cdn_key.py index 9d3c4492029..6a1eb2c6cc1 100644 --- a/video/stitcher/create_cdn_key.py +++ b/video/stitcher/create_cdn_key.py @@ -75,9 +75,10 @@ def create_cdn_key( private_key=private_key, ) - response = client.create_cdn_key( + operation = client.create_cdn_key( parent=parent, cdn_key_id=cdn_key_id, cdn_key=cdn_key ) + response = operation.result() print(f"CDN key: {response.name}") return response diff --git a/video/stitcher/create_cdn_key_akamai.py b/video/stitcher/create_cdn_key_akamai.py index d71141e641a..d6c9a3dbe77 100644 --- a/video/stitcher/create_cdn_key_akamai.py +++ b/video/stitcher/create_cdn_key_akamai.py @@ -58,9 +58,10 @@ def create_cdn_key_akamai( ), ) - response = client.create_cdn_key( + operation = client.create_cdn_key( parent=parent, cdn_key_id=cdn_key_id, cdn_key=cdn_key ) + response = operation.result() print(f"CDN key: {response.name}") return response diff --git a/video/stitcher/create_live_config.py b/video/stitcher/create_live_config.py new file mode 100644 index 00000000000..fbc1b69b7a0 --- /dev/null +++ b/video/stitcher/create_live_config.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python + +# Copyright 2023 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for creating a live config. Live +configs are used to configure live sessions. +Example usage: + python create_live_config.py --project_id --location \ + --live_config_id --live_stream_uri --ad_tag_uri \ + --slate_id +""" + +# [START videostitcher_create_live_config] + +import argparse + +from google.cloud.video import stitcher_v1 +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def create_live_config( + project_id: str, + location: str, + live_config_id: str, + live_stream_uri: str, + ad_tag_uri: str, + slate_id: str, +) -> str: + """Creates a live config. + Args: + project_id: The GCP project ID. + location: The location in which to create the live config. + live_config_id: The user-defined live config ID. + live_stream_uri: Uri of the livestream to stitch; this URI must reference either an MPEG-DASH + manifest (.mpd) file or an M3U playlist manifest (.m3u8) file. + ad_tag_uri: Uri of the ad tag. + slate_id: The user-defined slate ID of the default slate to use when no slates are specified in an ad break's message.""" + + client = VideoStitcherServiceClient() + + parent = f"projects/{project_id}/locations/{location}" + default_slate = f"projects/{project_id}/locations/{location}/slates/{slate_id}" + + live_config = stitcher_v1.types.LiveConfig( + source_uri=live_stream_uri, + ad_tag_uri=ad_tag_uri, + ad_tracking="SERVER", + default_slate=default_slate, + ) + + operation = client.create_live_config( + parent=parent, live_config_id=live_config_id, live_config=live_config + ) + response = operation.result() + print(f"Live config: {response.name}") + return response + + +# [END videostitcher_create_live_config] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location in which to create the live config.", + default="us-central1", + ) + parser.add_argument( + "--live_config_id", + help="The user-defined live config ID.", + required=True, + ) + parser.add_argument( + "--live_stream_uri", + help="The uri of the livestream to stitch (.mpd or .m3u8 file) in double quotes.", + required=True, + ) + parser.add_argument( + "--ad_tag_uri", + help="Uri of the ad tag in double quotes.", + required=True, + ) + parser.add_argument( + "--slate_id", + help="The user-defined slate ID of the default slate.", + required=True, + ) + args = parser.parse_args() + create_live_config( + args.project_id, + args.location, + args.live_config_id, + args.live_stream_uri, + args.ad_tag_uri, + args.slate_id, + ) diff --git a/video/stitcher/create_live_session.py b/video/stitcher/create_live_session.py index 1f37e3329ce..63ae01ba2e5 100644 --- a/video/stitcher/create_live_session.py +++ b/video/stitcher/create_live_session.py @@ -18,8 +18,7 @@ which to insert ads. Example usage: python create_live_session.py --project_id \ - --location --live_stream_uri --ad_tag_uri \ - --slate_id + --location --live_config_id """ # [START videostitcher_create_live_session] @@ -32,30 +31,23 @@ ) -def create_live_session( - project_id: str, location: str, live_stream_uri: str, ad_tag_uri: str, slate_id: str -) -> str: +def create_live_session(project_id: str, location: str, live_config_id: str) -> str: """Creates a live session. Live sessions are ephemeral resources that expire after a few minutes. Args: project_id: The GCP project ID. location: The location in which to create the session. - live_stream_uri: Uri of the livestream to stitch; this URI must reference either an MPEG-DASH - manifest (.mpd) file or an M3U playlist manifest (.m3u8) file. - ad_tag_uri: Uri of the ad tag. - slate_id: The user-defined slate ID of the default slate to use when no slates are specified in an ad break's message.""" + live_config_id: The user-defined live config ID.""" client = VideoStitcherServiceClient() parent = f"projects/{project_id}/locations/{location}" - - # Create dictionaries and pass them to the LiveSession constructor - ad_tag_map = {"default": stitcher_v1.AdTag(uri=ad_tag_uri)} - - live_session = stitcher_v1.types.LiveSession( - source_uri=live_stream_uri, ad_tag_map=ad_tag_map, default_slate_id=slate_id + live_config = ( + f"projects/{project_id}/locations/{location}/liveConfigs/{live_config_id}" ) + live_session = stitcher_v1.types.LiveSession(live_config=live_config) + response = client.create_live_session(parent=parent, live_session=live_session) print(f"Live session: {response.name}") return response @@ -72,25 +64,13 @@ def create_live_session( default="us-central1", ) parser.add_argument( - "--live_stream_uri", - help="The Uri of the livestream to stitch (.mpd or .m3u8 file) in double quotes.", - required=True, - ) - parser.add_argument( - "--ad_tag_uri", - help="Uri of the ad tag in double quotes.", - required=True, - ) - parser.add_argument( - "--slate_id", - help="The user-defined slate ID of the default slate.", + "--live_config_id", + help="The user-defined live config ID.", required=True, ) args = parser.parse_args() create_live_session( args.project_id, args.location, - args.live_stream_uri, - args.ad_tag_uri, - args.slate_id, + args.live_config_id, ) diff --git a/video/stitcher/create_slate.py b/video/stitcher/create_slate.py index 1211e9ae77b..dd8281f25cc 100644 --- a/video/stitcher/create_slate.py +++ b/video/stitcher/create_slate.py @@ -47,7 +47,8 @@ def create_slate(project_id: str, location: str, slate_id: str, slate_uri: str) uri=slate_uri, ) - response = client.create_slate(parent=parent, slate_id=slate_id, slate=slate) + operation = client.create_slate(parent=parent, slate_id=slate_id, slate=slate) + response = operation.result() print(f"Slate: {response.name}") return response diff --git a/video/stitcher/create_vod_session.py b/video/stitcher/create_vod_session.py index 37bb77ff92a..5c8149446f7 100644 --- a/video/stitcher/create_vod_session.py +++ b/video/stitcher/create_vod_session.py @@ -48,7 +48,7 @@ def create_vod_session( parent = f"projects/{project_id}/locations/{location}" vod_session = stitcher_v1.types.VodSession( - source_uri=source_uri, ad_tag_uri=ad_tag_uri + source_uri=source_uri, ad_tag_uri=ad_tag_uri, ad_tracking="SERVER" ) response = client.create_vod_session(parent=parent, vod_session=vod_session) diff --git a/video/stitcher/delete_cdn_key.py b/video/stitcher/delete_cdn_key.py index 30d538c5831..9cb3f64ae05 100644 --- a/video/stitcher/delete_cdn_key.py +++ b/video/stitcher/delete_cdn_key.py @@ -39,7 +39,8 @@ def delete_cdn_key(project_id: str, location: str, cdn_key_id: str) -> str: client = VideoStitcherServiceClient() name = f"projects/{project_id}/locations/{location}/cdnKeys/{cdn_key_id}" - response = client.delete_cdn_key(name=name) + operation = client.delete_cdn_key(name=name) + response = operation.result() print("Deleted CDN key") return response diff --git a/video/stitcher/delete_live_config.py b/video/stitcher/delete_live_config.py new file mode 100644 index 00000000000..309efb8dd0c --- /dev/null +++ b/video/stitcher/delete_live_config.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +# Copyright 2023 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for deleting a live config. +Example usage: + python delete_live_config.py --project_id --location \ + --live_config_id +""" + +# [START videostitcher_delete_live_config] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def delete_live_config(project_id: str, location: str, live_config_id: str) -> str: + """Deletes a live config. + Args: + project_id: The GCP project ID. + location: The location of the live config. + live_config_id: The user-defined live config ID.""" + + client = VideoStitcherServiceClient() + + name = f"projects/{project_id}/locations/{location}/liveConfigs/{live_config_id}" + operation = client.delete_live_config(name=name) + response = operation.result() + print("Deleted live config") + return response + + +# [END videostitcher_delete_live_config] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location of the live config.", + required=True, + ) + parser.add_argument( + "--live_config_id", + help="The user-defined live config ID.", + required=True, + ) + args = parser.parse_args() + delete_live_config( + args.project_id, + args.location, + args.live_config_id, + ) diff --git a/video/stitcher/delete_slate.py b/video/stitcher/delete_slate.py index 49979d858f3..7e4e0b8e7a4 100644 --- a/video/stitcher/delete_slate.py +++ b/video/stitcher/delete_slate.py @@ -39,7 +39,8 @@ def delete_slate(project_id: str, location: str, slate_id: str) -> str: client = VideoStitcherServiceClient() name = f"projects/{project_id}/locations/{location}/slates/{slate_id}" - response = client.delete_slate(name=name) + operation = client.delete_slate(name=name) + response = operation.result() print("Deleted slate") return response diff --git a/video/stitcher/get_live_config.py b/video/stitcher/get_live_config.py new file mode 100644 index 00000000000..27d81f7f342 --- /dev/null +++ b/video/stitcher/get_live_config.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python + +# Copyright 2023 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for getting a live config. +Example usage: + python get_live_config.py --project_id --location \ + --live_config_id +""" + +# [START videostitcher_get_live_config] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def get_live_config(project_id: str, location: str, live_config_id: str) -> str: + """Gets a live config. + Args: + project_id: The GCP project ID. + location: The location of the live config. + live_config_id: The user-defined live config ID.""" + + client = VideoStitcherServiceClient() + + name = f"projects/{project_id}/locations/{location}/liveConfigs/{live_config_id}" + response = client.get_live_config(name=name) + print(f"Live config: {response.name}") + return response + + +# [END videostitcher_get_live_config] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location of the live config.", + required=True, + ) + parser.add_argument( + "--live_config_id", + help="The user-defined live config ID.", + required=True, + ) + args = parser.parse_args() + get_live_config( + args.project_id, + args.location, + args.live_config_id, + ) diff --git a/video/stitcher/list_live_configs.py b/video/stitcher/list_live_configs.py new file mode 100644 index 00000000000..7056a01e7d6 --- /dev/null +++ b/video/stitcher/list_live_configs.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python + +# Copyright 2023 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Cloud Video Stitcher sample for listing all live configs in a location. +Example usage: + python list_live_configs.py --project_id --location +""" + +# [START videostitcher_list_live_configs] + +import argparse + +from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( + VideoStitcherServiceClient, +) + + +def list_live_configs(project_id: str, location: str) -> str: + """Lists all live configs in a location. + Args: + project_id: The GCP project ID. + location: The location of the live configs.""" + + client = VideoStitcherServiceClient() + + parent = f"projects/{project_id}/locations/{location}" + response = client.list_live_configs(parent=parent) + print("Live configs:") + for live_config in response.live_configs: + print({live_config.name}) + + return response + + +# [END videostitcher_list_live_configs] + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--project_id", help="Your Cloud project ID.", required=True) + parser.add_argument( + "--location", + help="The location of the live configs.", + required=True, + ) + args = parser.parse_args() + list_live_configs( + args.project_id, + args.location, + ) diff --git a/video/stitcher/live_config_test.py b/video/stitcher/live_config_test.py new file mode 100644 index 00000000000..a400b461b8e --- /dev/null +++ b/video/stitcher/live_config_test.py @@ -0,0 +1,89 @@ +# Copyright 2023 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import uuid + +from google.protobuf import timestamp_pb2 +import pytest + +import create_live_config +import create_slate +import delete_live_config +import delete_slate +import get_live_config +import list_live_configs +import utils + +project_id = os.environ["GOOGLE_CLOUD_PROJECT"] +location = "us-central1" +now = timestamp_pb2.Timestamp() +now.GetCurrentTime() + +live_config_id = f"python-test-live-config-{uuid.uuid4().hex[:5]}-{now.seconds}" + +input_bucket_name = "cloud-samples-data/media/" +input_video_file_name = "hls-live/manifest.m3u8" +live_stream_uri = ( + f"https://storage.googleapis.com/{input_bucket_name}{input_video_file_name}" +) +# Single Inline Linear (https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags) +ad_tag_uri = "https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=" +slate_id = f"python-test-slate-{uuid.uuid4().hex[:5]}-{now.seconds}" +slate_video_file_name = "ForBiggerJoyrides.mp4" +slate_uri = f"https://storage.googleapis.com/{input_bucket_name}{slate_video_file_name}" + + +def test_live_config_operations(capsys: pytest.fixture) -> None: + + utils.delete_stale_slates(project_id, location) + utils.delete_stale_live_configs(project_id, location) + + # Test setup + + slate_name = f"projects/{project_id}/locations/{location}/slates/{slate_id}" + + create_slate.create_slate(project_id, location, slate_id, slate_uri) + out, _ = capsys.readouterr() + assert slate_name in out + + live_config_name = ( + f"projects/{project_id}/locations/{location}/liveConfigs/{live_config_id}" + ) + + # Tests + + create_live_config.create_live_config( + project_id, location, live_config_id, live_stream_uri, ad_tag_uri, slate_id + ) + out, _ = capsys.readouterr() + assert live_config_name in out + + list_live_configs.list_live_configs(project_id, location) + out, _ = capsys.readouterr() + assert live_config_name in out + + get_live_config.get_live_config(project_id, location, live_config_id) + out, _ = capsys.readouterr() + assert live_config_name in out + + delete_live_config.delete_live_config(project_id, location, live_config_id) + out, _ = capsys.readouterr() + assert "Deleted live config" in out + + # Clean up slate as it is no longer needed + + delete_slate.delete_slate(project_id, location, slate_id) + out, _ = capsys.readouterr() + assert "Deleted slate" in out diff --git a/video/stitcher/live_session_test.py b/video/stitcher/live_session_test.py index 5bbbd456791..f8608ef07f1 100644 --- a/video/stitcher/live_session_test.py +++ b/video/stitcher/live_session_test.py @@ -16,12 +16,14 @@ import re import uuid -from google.api_core.exceptions import NotFound +from google.protobuf import timestamp_pb2 import pytest import requests +import create_live_config import create_live_session import create_slate +import delete_live_config import delete_slate import get_live_ad_tag_detail import get_live_session @@ -30,6 +32,10 @@ project_id = os.environ["GOOGLE_CLOUD_PROJECT"] project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"] location = "us-central1" +now = timestamp_pb2.Timestamp() +now.GetCurrentTime() + +live_config_id = f"python-test-live-config-{uuid.uuid4().hex[:5]}-{now.seconds}" input_bucket_name = "cloud-samples-data/media/" input_video_file_name = "hls-live/manifest.m3u8" live_stream_uri = ( @@ -37,32 +43,35 @@ ) # Single Inline Linear (https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags) ad_tag_uri = "https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=" -slate_id = f"my-python-test-slate-{uuid.uuid4()}" +slate_id = f"python-test-slate-{uuid.uuid4().hex[:5]}-{now.seconds}" slate_video_file_name = "ForBiggerJoyrides.mp4" slate_uri = f"https://storage.googleapis.com/{input_bucket_name}{slate_video_file_name}" -@pytest.mark.skip() def test_live_session_operations(capsys: pytest.fixture) -> None: # Test setup - slate_name = f"projects/{project_number}/locations/{location}/slates/{slate_id}" - - try: - delete_slate.delete_slate(project_id, location, slate_id) - except NotFound as e: - print(f"Ignoring NotFound, details: {e}") - out, _ = capsys.readouterr() + slate_name = f"projects/{project_id}/locations/{location}/slates/{slate_id}" create_slate.create_slate(project_id, location, slate_id, slate_uri) out, _ = capsys.readouterr() assert slate_name in out + live_config_name = ( + f"projects/{project_id}/locations/{location}/liveConfigs/{live_config_id}" + ) + + create_live_config.create_live_config( + project_id, location, live_config_id, live_stream_uri, ad_tag_uri, slate_id + ) + out, _ = capsys.readouterr() + assert live_config_name in out + # Tests create_live_session_response = create_live_session.create_live_session( - project_id, location, live_stream_uri, ad_tag_uri, slate_id + project_id, location, live_config_id ) out, _ = capsys.readouterr() session_name_prefix = ( @@ -81,12 +90,6 @@ def test_live_session_operations(capsys: pytest.fixture) -> None: out, _ = capsys.readouterr() assert session_name in out - # Clean up slate as it is no longer needed - - delete_slate.delete_slate(project_id, location, slate_id) - out, _ = capsys.readouterr() - assert "Deleted slate" in out - # No list or delete methods for live sessions # Ad tag details @@ -133,3 +136,12 @@ def test_live_session_operations(capsys: pytest.fixture) -> None: ) out, _ = capsys.readouterr() assert ad_tag_details_name in out + + # Clean up live config and slate + delete_live_config.delete_live_config(project_id, location, live_config_id) + out, _ = capsys.readouterr() + assert "Deleted live config" in out + + delete_slate.delete_slate(project_id, location, slate_id) + out, _ = capsys.readouterr() + assert "Deleted slate" in out diff --git a/video/stitcher/slate_test.py b/video/stitcher/slate_test.py index 0773a06db4b..775dd449b7e 100644 --- a/video/stitcher/slate_test.py +++ b/video/stitcher/slate_test.py @@ -25,39 +25,32 @@ import update_slate import utils -location = "us-west1" project_id = os.environ["GOOGLE_CLOUD_PROJECT"] -project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"] +location = "us-central1" now = timestamp_pb2.Timestamp() now.GetCurrentTime() -slate_id = f"python-test-slate-{uuid.uuid4().hex[:5]}-{now.seconds}" - input_bucket_name = "cloud-samples-data/media/" slate_video_file_name = "ForBiggerEscapes.mp4" updated_slate_video_file_name = "ForBiggerJoyrides.mp4" - +slate_id = f"python-test-slate-{uuid.uuid4().hex[:5]}-{now.seconds}" slate_uri = f"https://storage.googleapis.com/{input_bucket_name}{slate_video_file_name}" updated_slate_uri = ( f"https://storage.googleapis.com/{input_bucket_name}{updated_slate_video_file_name}" ) -@pytest.mark.skip() def test_slate_operations(capsys: pytest.fixture) -> None: utils.delete_stale_slates(project_id, location) - slate_name_project_number = ( - f"projects/{project_number}/locations/{location}/slates/{slate_id}" - ) slate_name_project_id = ( f"projects/{project_id}/locations/{location}/slates/{slate_id}" ) create_slate.create_slate(project_id, location, slate_id, slate_uri) out, _ = capsys.readouterr() - assert slate_name_project_number in out + assert slate_name_project_id in out list_slates.list_slates(project_id, location) out, _ = capsys.readouterr() diff --git a/video/stitcher/update_cdn_key.py b/video/stitcher/update_cdn_key.py index 14144dbf03f..b7b7dae28f8 100644 --- a/video/stitcher/update_cdn_key.py +++ b/video/stitcher/update_cdn_key.py @@ -78,7 +78,8 @@ def update_cdn_key( ) update_mask = field_mask.FieldMask(paths=["hostname", "media_cdn_key"]) - response = client.update_cdn_key(cdn_key=cdn_key, update_mask=update_mask) + operation = client.update_cdn_key(cdn_key=cdn_key, update_mask=update_mask) + response = operation.result() print(f"Updated CDN key: {response.name}") return response diff --git a/video/stitcher/update_cdn_key_akamai.py b/video/stitcher/update_cdn_key_akamai.py index 0c5ca09e635..4c7be03674e 100644 --- a/video/stitcher/update_cdn_key_akamai.py +++ b/video/stitcher/update_cdn_key_akamai.py @@ -60,7 +60,8 @@ def update_cdn_key_akamai( ) update_mask = field_mask.FieldMask(paths=["hostname", "akamai_cdn_key"]) - response = client.update_cdn_key(cdn_key=cdn_key, update_mask=update_mask) + operation = client.update_cdn_key(cdn_key=cdn_key, update_mask=update_mask) + response = operation.result() print(f"Updated CDN key: {response.name}") return response diff --git a/video/stitcher/update_slate.py b/video/stitcher/update_slate.py index c239a060154..1527997b87f 100644 --- a/video/stitcher/update_slate.py +++ b/video/stitcher/update_slate.py @@ -48,7 +48,8 @@ def update_slate(project_id: str, location: str, slate_id: str, slate_uri: str) ) update_mask = field_mask.FieldMask(paths=["uri"]) - response = client.update_slate(slate=slate, update_mask=update_mask) + operation = client.update_slate(slate=slate, update_mask=update_mask) + response = operation.result() print(f"Updated slate: {response.name}") return response diff --git a/video/stitcher/utils.py b/video/stitcher/utils.py index 6cd5683476e..b74d176d358 100644 --- a/video/stitcher/utils.py +++ b/video/stitcher/utils.py @@ -22,7 +22,10 @@ def delete_stale_slates(project_id: str, location: str) -> None: for slate in response.slates: tmp = slate.name.split("-") - creation_time_sec = int(tmp.pop()) + try: + creation_time_sec = int(tmp.pop()) + except ValueError: + continue if (now.seconds - creation_time_sec) > (3 * seconds_per_hour): response = client.delete_slate(name=slate.name) @@ -43,6 +46,33 @@ def delete_stale_cdn_keys(project_id: str, location: str) -> None: for cdn_key in response.cdn_keys: tmp = cdn_key.name.split("-") - creation_time_sec = int(tmp.pop()) + try: + creation_time_sec = int(tmp.pop()) + except ValueError: + continue if (now.seconds - creation_time_sec) > (3 * seconds_per_hour): response = client.delete_cdn_key(name=cdn_key.name) + + +def delete_stale_live_configs(project_id: str, location: str) -> None: + """Lists all outdated live configs in a location. + Args: + project_id: The GCP project ID. + location: The location of the live configs.""" + + client = VideoStitcherServiceClient() + + parent = f"projects/{project_id}/locations/{location}" + response = client.list_live_configs(parent=parent) + + now = timestamp_pb2.Timestamp() + now.GetCurrentTime() + + for live_config in response.live_configs: + tmp = live_config.name.split("-") + try: + creation_time_sec = int(tmp.pop()) + except ValueError: + continue + if (now.seconds - creation_time_sec) > (3 * seconds_per_hour): + response = client.delete_live_config(name=live_config.name) diff --git a/video/stitcher/vod_session_test.py b/video/stitcher/vod_session_test.py index 37ed74ed311..187b1612d4d 100644 --- a/video/stitcher/vod_session_test.py +++ b/video/stitcher/vod_session_test.py @@ -33,7 +33,6 @@ ad_tag_uri = "https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpreonly&ciu_szs=300x250%2C728x90&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=" -@pytest.mark.skip() def test_vod_session_operations(capsys: pytest.fixture) -> None: create_vod_session.create_vod_session(project_id, location, vod_uri, ad_tag_uri) From cbf72e3e18604e0586bf16c8a135c102b171bb39 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 31 May 2023 21:14:29 +0200 Subject: [PATCH 48/55] chore(deps): update dependency requests to v2.31.0 [security] (#153) Co-authored-by: Anthonios Partheniou --- video/stitcher/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements-test.txt b/video/stitcher/requirements-test.txt index ea1d94ae6d9..c953c750e0b 100644 --- a/video/stitcher/requirements-test.txt +++ b/video/stitcher/requirements-test.txt @@ -1,2 +1,2 @@ pytest==7.3.1 -requests==2.30.0 \ No newline at end of file +requests==2.31.0 \ No newline at end of file From ae887c76004e92fcd16affed5c1692ca3b7eec0c Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 31 May 2023 21:32:01 +0200 Subject: [PATCH 49/55] chore(deps): update dependency google-api-python-client to v2.88.0 (#154) Co-authored-by: Anthonios Partheniou --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index 5aff127f173..d5ee1334c7c 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.86.0 +google-api-python-client==2.88.0 grpcio==1.54.2 google-cloud-video-stitcher==0.7.1 \ No newline at end of file From ef4e075a44a942bb2782811ad70ee46eb32ca29f Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 1 Jun 2023 12:30:25 +0200 Subject: [PATCH 50/55] chore(deps): update dependency google-cloud-video-stitcher to v0.7.2 (#155) --- video/stitcher/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/requirements.txt b/video/stitcher/requirements.txt index d5ee1334c7c..cc6ed3dfdfb 100644 --- a/video/stitcher/requirements.txt +++ b/video/stitcher/requirements.txt @@ -1,3 +1,3 @@ google-api-python-client==2.88.0 grpcio==1.54.2 -google-cloud-video-stitcher==0.7.1 \ No newline at end of file +google-cloud-video-stitcher==0.7.2 \ No newline at end of file From 4e5cfb3a0c1c97c90245032dd55e93b76fcc49ed Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 8 Jun 2023 16:21:40 +0000 Subject: [PATCH 51/55] ignore python 2.7, 3.6 --- video/stitcher/noxfile_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/stitcher/noxfile_config.py b/video/stitcher/noxfile_config.py index 706b3f3a0be..c8377ecb974 100644 --- a/video/stitcher/noxfile_config.py +++ b/video/stitcher/noxfile_config.py @@ -22,7 +22,7 @@ TEST_CONFIG_OVERRIDE = { # You can opt out from the test for specific Python versions. - "ignored_versions": [], + "ignored_versions": ["2.7", "3.6"], # Old samples are opted out of enforcing Python type hints # All new samples should feature them "enforce_type_hints": True, From 114273c7b99a190d1b89097292697f0ed3b4c84f Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 8 Jun 2023 16:26:04 +0000 Subject: [PATCH 52/55] update codeowners;blunderbuss --- .github/CODEOWNERS | 1 + .github/blunderbuss.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 80aa33f2443..10e9d00fd12 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -102,6 +102,7 @@ /retail/**/* @GoogleCloudPlatform/cloud-retail-team @GoogleCloudPlatform/python-samples-reviewers /billing/**/* @GoogleCloudPlatform/billing-samples-maintainers @GoogleCloudPlatform/python-samples-reviewers /iot/**/* @GoogleCloudPlatform/api-iot @GoogleCloudPlatform/python-samples-reviewers +/video/stitcher/* @GoogleCloudPlatform/cloud-media-team @GoogleCloudPlatform/python-samples-reviewers # Does not have owner /blog/**/* @GoogleCloudPlatform/python-samples-reviewers diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml index ef971b7a08f..b9dc308c6ed 100644 --- a/.github/blunderbuss.yml +++ b/.github/blunderbuss.yml @@ -303,6 +303,7 @@ assign_prs_by: - GoogleCloudPlatform/cloud-retail-team - labels: - "api: cloudmedia" + - "api: videostitcher" to: - GoogleCloudPlatform/cloud-media-team From db7808153682283c14532d30c9e2f8060acc8701 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 8 Jun 2023 16:27:56 +0000 Subject: [PATCH 53/55] update copyright headers --- video/stitcher/cdn_key_test.py | 2 +- video/stitcher/create_cdn_key.py | 2 +- video/stitcher/create_cdn_key_akamai.py | 2 +- video/stitcher/create_live_config.py | 2 +- video/stitcher/create_live_session.py | 2 +- video/stitcher/create_slate.py | 2 +- video/stitcher/create_vod_session.py | 2 +- video/stitcher/delete_cdn_key.py | 2 +- video/stitcher/delete_live_config.py | 2 +- video/stitcher/delete_slate.py | 2 +- video/stitcher/get_cdn_key.py | 2 +- video/stitcher/get_live_ad_tag_detail.py | 2 +- video/stitcher/get_live_config.py | 2 +- video/stitcher/get_live_session.py | 2 +- video/stitcher/get_slate.py | 2 +- video/stitcher/get_vod_ad_tag_detail.py | 2 +- video/stitcher/get_vod_session.py | 2 +- video/stitcher/get_vod_stitch_detail.py | 2 +- video/stitcher/list_cdn_keys.py | 2 +- video/stitcher/list_live_ad_tag_details.py | 2 +- video/stitcher/list_live_configs.py | 2 +- video/stitcher/list_slates.py | 2 +- video/stitcher/list_vod_ad_tag_details.py | 2 +- video/stitcher/list_vod_stitch_details.py | 2 +- video/stitcher/live_config_test.py | 2 +- video/stitcher/live_session_test.py | 2 +- video/stitcher/slate_test.py | 2 +- video/stitcher/update_cdn_key.py | 2 +- video/stitcher/update_cdn_key_akamai.py | 2 +- video/stitcher/update_slate.py | 2 +- video/stitcher/vod_session_test.py | 2 +- 31 files changed, 31 insertions(+), 31 deletions(-) diff --git a/video/stitcher/cdn_key_test.py b/video/stitcher/cdn_key_test.py index 7e25aeb15ac..24ad85fa0f8 100644 --- a/video/stitcher/cdn_key_test.py +++ b/video/stitcher/cdn_key_test.py @@ -1,4 +1,4 @@ -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/create_cdn_key.py b/video/stitcher/create_cdn_key.py index 6a1eb2c6cc1..ec941cb35db 100644 --- a/video/stitcher/create_cdn_key.py +++ b/video/stitcher/create_cdn_key.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/create_cdn_key_akamai.py b/video/stitcher/create_cdn_key_akamai.py index d6c9a3dbe77..a947cd214a7 100644 --- a/video/stitcher/create_cdn_key_akamai.py +++ b/video/stitcher/create_cdn_key_akamai.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/create_live_config.py b/video/stitcher/create_live_config.py index fbc1b69b7a0..b232402b9cf 100644 --- a/video/stitcher/create_live_config.py +++ b/video/stitcher/create_live_config.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2023 Google Inc. All Rights Reserved. +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/create_live_session.py b/video/stitcher/create_live_session.py index 63ae01ba2e5..d22e8953e00 100644 --- a/video/stitcher/create_live_session.py +++ b/video/stitcher/create_live_session.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/create_slate.py b/video/stitcher/create_slate.py index dd8281f25cc..98d2252e9e8 100644 --- a/video/stitcher/create_slate.py +++ b/video/stitcher/create_slate.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/create_vod_session.py b/video/stitcher/create_vod_session.py index 5c8149446f7..f5142035491 100644 --- a/video/stitcher/create_vod_session.py +++ b/video/stitcher/create_vod_session.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/delete_cdn_key.py b/video/stitcher/delete_cdn_key.py index 9cb3f64ae05..9e944167a08 100644 --- a/video/stitcher/delete_cdn_key.py +++ b/video/stitcher/delete_cdn_key.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/delete_live_config.py b/video/stitcher/delete_live_config.py index 309efb8dd0c..b6ffa56419e 100644 --- a/video/stitcher/delete_live_config.py +++ b/video/stitcher/delete_live_config.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2023 Google Inc. All Rights Reserved. +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/delete_slate.py b/video/stitcher/delete_slate.py index 7e4e0b8e7a4..8458e358ec6 100644 --- a/video/stitcher/delete_slate.py +++ b/video/stitcher/delete_slate.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/get_cdn_key.py b/video/stitcher/get_cdn_key.py index 8a4a249753b..531ace87c13 100644 --- a/video/stitcher/get_cdn_key.py +++ b/video/stitcher/get_cdn_key.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/get_live_ad_tag_detail.py b/video/stitcher/get_live_ad_tag_detail.py index 5a872bc771a..790b233c420 100644 --- a/video/stitcher/get_live_ad_tag_detail.py +++ b/video/stitcher/get_live_ad_tag_detail.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/get_live_config.py b/video/stitcher/get_live_config.py index 27d81f7f342..74019140483 100644 --- a/video/stitcher/get_live_config.py +++ b/video/stitcher/get_live_config.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2023 Google Inc. All Rights Reserved. +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/get_live_session.py b/video/stitcher/get_live_session.py index 21648a988ff..da3d2114d68 100644 --- a/video/stitcher/get_live_session.py +++ b/video/stitcher/get_live_session.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/get_slate.py b/video/stitcher/get_slate.py index 80aa8a8fcf5..3d3901887fd 100644 --- a/video/stitcher/get_slate.py +++ b/video/stitcher/get_slate.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/get_vod_ad_tag_detail.py b/video/stitcher/get_vod_ad_tag_detail.py index 86314e10014..cb717842b2e 100644 --- a/video/stitcher/get_vod_ad_tag_detail.py +++ b/video/stitcher/get_vod_ad_tag_detail.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/get_vod_session.py b/video/stitcher/get_vod_session.py index b55d0da13ea..073aeea01b8 100644 --- a/video/stitcher/get_vod_session.py +++ b/video/stitcher/get_vod_session.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/get_vod_stitch_detail.py b/video/stitcher/get_vod_stitch_detail.py index 86a5da8a7ec..2923221b562 100644 --- a/video/stitcher/get_vod_stitch_detail.py +++ b/video/stitcher/get_vod_stitch_detail.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/list_cdn_keys.py b/video/stitcher/list_cdn_keys.py index 33059912121..68f628f74a9 100644 --- a/video/stitcher/list_cdn_keys.py +++ b/video/stitcher/list_cdn_keys.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/list_live_ad_tag_details.py b/video/stitcher/list_live_ad_tag_details.py index c0181668237..4f1d0568c95 100644 --- a/video/stitcher/list_live_ad_tag_details.py +++ b/video/stitcher/list_live_ad_tag_details.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/list_live_configs.py b/video/stitcher/list_live_configs.py index 7056a01e7d6..24ddc3317f4 100644 --- a/video/stitcher/list_live_configs.py +++ b/video/stitcher/list_live_configs.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2023 Google Inc. All Rights Reserved. +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/list_slates.py b/video/stitcher/list_slates.py index 46389bdb7fe..873a2c19ae5 100644 --- a/video/stitcher/list_slates.py +++ b/video/stitcher/list_slates.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/list_vod_ad_tag_details.py b/video/stitcher/list_vod_ad_tag_details.py index 3c8c1bdfb06..4c2b24853ba 100644 --- a/video/stitcher/list_vod_ad_tag_details.py +++ b/video/stitcher/list_vod_ad_tag_details.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/list_vod_stitch_details.py b/video/stitcher/list_vod_stitch_details.py index 7d25d5b8382..4a26f2c4d75 100644 --- a/video/stitcher/list_vod_stitch_details.py +++ b/video/stitcher/list_vod_stitch_details.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/live_config_test.py b/video/stitcher/live_config_test.py index a400b461b8e..d1e83ccb9f0 100644 --- a/video/stitcher/live_config_test.py +++ b/video/stitcher/live_config_test.py @@ -1,4 +1,4 @@ -# Copyright 2023 Google Inc. All Rights Reserved. +# Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/live_session_test.py b/video/stitcher/live_session_test.py index f8608ef07f1..dd3dfd87881 100644 --- a/video/stitcher/live_session_test.py +++ b/video/stitcher/live_session_test.py @@ -1,4 +1,4 @@ -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/slate_test.py b/video/stitcher/slate_test.py index 775dd449b7e..27b3861114b 100644 --- a/video/stitcher/slate_test.py +++ b/video/stitcher/slate_test.py @@ -1,4 +1,4 @@ -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/update_cdn_key.py b/video/stitcher/update_cdn_key.py index b7b7dae28f8..e14861242e7 100644 --- a/video/stitcher/update_cdn_key.py +++ b/video/stitcher/update_cdn_key.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/update_cdn_key_akamai.py b/video/stitcher/update_cdn_key_akamai.py index 4c7be03674e..d91c8786629 100644 --- a/video/stitcher/update_cdn_key_akamai.py +++ b/video/stitcher/update_cdn_key_akamai.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/update_slate.py b/video/stitcher/update_slate.py index 1527997b87f..282c89ee716 100644 --- a/video/stitcher/update_slate.py +++ b/video/stitcher/update_slate.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/video/stitcher/vod_session_test.py b/video/stitcher/vod_session_test.py index 187b1612d4d..92ba36053d4 100644 --- a/video/stitcher/vod_session_test.py +++ b/video/stitcher/vod_session_test.py @@ -1,4 +1,4 @@ -# Copyright 2022 Google Inc. All Rights Reserved. +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From 2199545df7dc7377a693470727a829d760ab2f73 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 8 Jun 2023 16:33:31 +0000 Subject: [PATCH 54/55] add license header --- video/stitcher/utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/video/stitcher/utils.py b/video/stitcher/utils.py index b74d176d358..28537306262 100644 --- a/video/stitcher/utils.py +++ b/video/stitcher/utils.py @@ -1,3 +1,17 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + from google.cloud.video.stitcher_v1.services.video_stitcher_service import ( VideoStitcherServiceClient, ) From 50b4c24b92496cdfcb833ea5a528d5810bd484df Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 8 Jun 2023 13:15:43 -0400 Subject: [PATCH 55/55] spacing --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 624d24bfa39..d1c7b49c8be 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -103,7 +103,7 @@ /retail/**/* @GoogleCloudPlatform/cloud-retail-team @GoogleCloudPlatform/python-samples-reviewers /billing/**/* @GoogleCloudPlatform/billing-samples-maintainers @GoogleCloudPlatform/python-samples-reviewers /iot/**/* @GoogleCloudPlatform/api-iot @GoogleCloudPlatform/python-samples-reviewers -/video/stitcher/* @GoogleCloudPlatform/cloud-media-team @GoogleCloudPlatform/python-samples-reviewers +/video/stitcher/* @GoogleCloudPlatform/cloud-media-team @GoogleCloudPlatform/python-samples-reviewers # Does not have owner /blog/**/* @GoogleCloudPlatform/python-samples-reviewers