From 9bb2a98b1ca129acc5a0be06b4682382b3c1f6c7 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 11 Jul 2023 22:03:52 +0200 Subject: [PATCH 01/14] chore(deps): update all dependencies (#320) --- samples/snippets/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index ca3ed05..e8f20c4 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.92.0 +google-api-python-client==2.93.0 grpcio==1.56.0 -google-cloud-video-transcoder==1.9.1 +google-cloud-video-transcoder==1.10.0 From 5141cc17c40fa757e16d289e61cc96d997b86ff5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 15:36:12 +0000 Subject: [PATCH 02/14] build(deps): [autoapprove] bump cryptography from 41.0.0 to 41.0.2 (#321) Source-Link: https://togithub.com/googleapis/synthtool/commit/d6103f4a3540ba60f633a9e25c37ec5fe7e6286d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:39f0f3f2be02ef036e297e376fe3b6256775576da8a6ccb1d5eeb80f4c8bf8fb --- .flake8 | 2 +- .github/.OwlBot.lock.yaml | 4 +-- .github/auto-label.yaml | 2 +- .kokoro/build.sh | 2 +- .kokoro/docker/docs/Dockerfile | 2 +- .kokoro/populate-secrets.sh | 2 +- .kokoro/publish-docs.sh | 2 +- .kokoro/release.sh | 2 +- .kokoro/requirements.txt | 44 +++++++++++++++------------- .kokoro/test-samples-against-head.sh | 2 +- .kokoro/test-samples-impl.sh | 2 +- .kokoro/test-samples.sh | 2 +- .kokoro/trampoline.sh | 2 +- .kokoro/trampoline_v2.sh | 2 +- .pre-commit-config.yaml | 2 +- .trampolinerc | 4 +-- MANIFEST.in | 2 +- README.rst | 27 +++++++++-------- docs/conf.py | 2 +- noxfile.py | 3 +- scripts/decrypt-secrets.sh | 2 +- scripts/readme-gen/readme_gen.py | 18 ++++++------ setup.cfg | 2 +- 23 files changed, 69 insertions(+), 65 deletions(-) diff --git a/.flake8 b/.flake8 index 2e43874..87f6e40 100644 --- a/.flake8 +++ b/.flake8 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2020 Google LLC +# 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/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 98994f4..ae4a522 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:2d816f26f728ac8b24248741e7d4c461c09764ef9f7be3684d557c9632e46dbd -# created: 2023-06-28T17:03:33.371210701Z + digest: sha256:39f0f3f2be02ef036e297e376fe3b6256775576da8a6ccb1d5eeb80f4c8bf8fb +# created: 2023-07-17T15:20:13.819193964Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml index 41bff0b..b2016d1 100644 --- a/.github/auto-label.yaml +++ b/.github/auto-label.yaml @@ -1,4 +1,4 @@ -# Copyright 2022 Google LLC +# 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/.kokoro/build.sh b/.kokoro/build.sh index 16a776a..e1af3a6 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2018 Google LLC +# 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/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index f8137d0..8e39a2c 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2020 Google LLC +# 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/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh index f525142..6f39721 100755 --- a/.kokoro/populate-secrets.sh +++ b/.kokoro/populate-secrets.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Google LLC. +# 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/.kokoro/publish-docs.sh b/.kokoro/publish-docs.sh index 1c4d623..9eafe0b 100755 --- a/.kokoro/publish-docs.sh +++ b/.kokoro/publish-docs.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Google LLC +# 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/.kokoro/release.sh b/.kokoro/release.sh index 194e68e..8915dd5 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Google LLC +# 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/.kokoro/requirements.txt b/.kokoro/requirements.txt index c7929db..67d70a1 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -113,26 +113,30 @@ commonmark==0.9.1 \ --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 # via rich -cryptography==41.0.0 \ - --hash=sha256:0ddaee209d1cf1f180f1efa338a68c4621154de0afaef92b89486f5f96047c55 \ - --hash=sha256:14754bcdae909d66ff24b7b5f166d69340ccc6cb15731670435efd5719294895 \ - --hash=sha256:344c6de9f8bda3c425b3a41b319522ba3208551b70c2ae00099c205f0d9fd3be \ - --hash=sha256:34d405ea69a8b34566ba3dfb0521379b210ea5d560fafedf9f800a9a94a41928 \ - --hash=sha256:3680248309d340fda9611498a5319b0193a8dbdb73586a1acf8109d06f25b92d \ - --hash=sha256:3c5ef25d060c80d6d9f7f9892e1d41bb1c79b78ce74805b8cb4aa373cb7d5ec8 \ - --hash=sha256:4ab14d567f7bbe7f1cdff1c53d5324ed4d3fc8bd17c481b395db224fb405c237 \ - --hash=sha256:5c1f7293c31ebc72163a9a0df246f890d65f66b4a40d9ec80081969ba8c78cc9 \ - --hash=sha256:6b71f64beeea341c9b4f963b48ee3b62d62d57ba93eb120e1196b31dc1025e78 \ - --hash=sha256:7d92f0248d38faa411d17f4107fc0bce0c42cae0b0ba5415505df72d751bf62d \ - --hash=sha256:8362565b3835ceacf4dc8f3b56471a2289cf51ac80946f9087e66dc283a810e0 \ - --hash=sha256:84a165379cb9d411d58ed739e4af3396e544eac190805a54ba2e0322feb55c46 \ - --hash=sha256:88ff107f211ea696455ea8d911389f6d2b276aabf3231bf72c8853d22db755c5 \ - --hash=sha256:9f65e842cb02550fac96536edb1d17f24c0a338fd84eaf582be25926e993dde4 \ - --hash=sha256:a4fc68d1c5b951cfb72dfd54702afdbbf0fb7acdc9b7dc4301bbf2225a27714d \ - --hash=sha256:b7f2f5c525a642cecad24ee8670443ba27ac1fab81bba4cc24c7b6b41f2d0c75 \ - --hash=sha256:b846d59a8d5a9ba87e2c3d757ca019fa576793e8758174d3868aecb88d6fc8eb \ - --hash=sha256:bf8fc66012ca857d62f6a347007e166ed59c0bc150cefa49f28376ebe7d992a2 \ - --hash=sha256:f5d0bf9b252f30a31664b6f64432b4730bb7038339bd18b1fafe129cfc2be9be +cryptography==41.0.2 \ + --hash=sha256:01f1d9e537f9a15b037d5d9ee442b8c22e3ae11ce65ea1f3316a41c78756b711 \ + --hash=sha256:079347de771f9282fbfe0e0236c716686950c19dee1b76240ab09ce1624d76d7 \ + --hash=sha256:182be4171f9332b6741ee818ec27daff9fb00349f706629f5cbf417bd50e66fd \ + --hash=sha256:192255f539d7a89f2102d07d7375b1e0a81f7478925b3bc2e0549ebf739dae0e \ + --hash=sha256:2a034bf7d9ca894720f2ec1d8b7b5832d7e363571828037f9e0c4f18c1b58a58 \ + --hash=sha256:342f3767e25876751e14f8459ad85e77e660537ca0a066e10e75df9c9e9099f0 \ + --hash=sha256:439c3cc4c0d42fa999b83ded80a9a1fb54d53c58d6e59234cfe97f241e6c781d \ + --hash=sha256:49c3222bb8f8e800aead2e376cbef687bc9e3cb9b58b29a261210456a7783d83 \ + --hash=sha256:674b669d5daa64206c38e507808aae49904c988fa0a71c935e7006a3e1e83831 \ + --hash=sha256:7a9a3bced53b7f09da251685224d6a260c3cb291768f54954e28f03ef14e3766 \ + --hash=sha256:7af244b012711a26196450d34f483357e42aeddb04128885d95a69bd8b14b69b \ + --hash=sha256:7d230bf856164de164ecb615ccc14c7fc6de6906ddd5b491f3af90d3514c925c \ + --hash=sha256:84609ade00a6ec59a89729e87a503c6e36af98ddcd566d5f3be52e29ba993182 \ + --hash=sha256:9a6673c1828db6270b76b22cc696f40cde9043eb90373da5c2f8f2158957f42f \ + --hash=sha256:9b6d717393dbae53d4e52684ef4f022444fc1cce3c48c38cb74fca29e1f08eaa \ + --hash=sha256:9c3fe6534d59d071ee82081ca3d71eed3210f76ebd0361798c74abc2bcf347d4 \ + --hash=sha256:a719399b99377b218dac6cf547b6ec54e6ef20207b6165126a280b0ce97e0d2a \ + --hash=sha256:b332cba64d99a70c1e0836902720887fb4529ea49ea7f5462cf6640e095e11d2 \ + --hash=sha256:d124682c7a23c9764e54ca9ab5b308b14b18eba02722b8659fb238546de83a76 \ + --hash=sha256:d73f419a56d74fef257955f51b18d046f3506270a5fd2ac5febbfa259d6c0fa5 \ + --hash=sha256:f0dc40e6f7aa37af01aba07277d3d64d5a03dc66d682097541ec4da03cc140ee \ + --hash=sha256:f14ad275364c8b4e525d018f6716537ae7b6d369c094805cae45300847e0894f \ + --hash=sha256:f772610fe364372de33d76edcd313636a25684edb94cee53fd790195f5989d14 # via # gcp-releasetool # secretstorage diff --git a/.kokoro/test-samples-against-head.sh b/.kokoro/test-samples-against-head.sh index ba3a707..63ac41d 100755 --- a/.kokoro/test-samples-against-head.sh +++ b/.kokoro/test-samples-against-head.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Google LLC +# 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/.kokoro/test-samples-impl.sh b/.kokoro/test-samples-impl.sh index 2c6500c..5a0f5fa 100755 --- a/.kokoro/test-samples-impl.sh +++ b/.kokoro/test-samples-impl.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2021 Google LLC +# 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/.kokoro/test-samples.sh b/.kokoro/test-samples.sh index 11c042d..50b35a4 100755 --- a/.kokoro/test-samples.sh +++ b/.kokoro/test-samples.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2020 Google LLC +# 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/.kokoro/trampoline.sh b/.kokoro/trampoline.sh index f39236e..d85b1f2 100755 --- a/.kokoro/trampoline.sh +++ b/.kokoro/trampoline.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2017 Google Inc. +# 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/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index 4af6cdc..59a7cf3 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Copyright 2020 Google LLC +# 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/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5405cc8..9e3898f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,4 @@ -# Copyright 2021 Google LLC +# 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/.trampolinerc b/.trampolinerc index 0eee72a..a7dfeb4 100644 --- a/.trampolinerc +++ b/.trampolinerc @@ -1,4 +1,4 @@ -# Copyright 2020 Google LLC +# 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. @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Template for .trampolinerc - # Add required env vars here. required_envvars+=( ) diff --git a/MANIFEST.in b/MANIFEST.in index e783f4c..e0a6670 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2020 Google LLC +# 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/README.rst b/README.rst index b5a5330..e06daa3 100644 --- a/README.rst +++ b/README.rst @@ -36,21 +36,24 @@ In order to use this library, you first need to go through the following steps: Installation ~~~~~~~~~~~~ -Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to -create isolated Python environments. The basic problem it addresses is one of -dependencies and versions, and indirectly permissions. +Install this library in a virtual environment using `venv`_. `venv`_ is a tool that +creates isolated Python environments. These isolated environments can have separate +versions of Python packages, which allows you to isolate one project's dependencies +from the dependencies of other projects. -With `virtualenv`_, it's possible to install this library without needing system +With `venv`_, it's possible to install this library without needing system install permissions, and without clashing with the installed system dependencies. -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ +.. _`venv`: https://docs.python.org/3/library/venv.html Code samples and snippets ~~~~~~~~~~~~~~~~~~~~~~~~~ -Code samples and snippets live in the `samples/` folder. +Code samples and snippets live in the `samples/`_ folder. + +.. _samples/: https://github.com/googleapis/python-video-transcoder/tree/main/samples Supported Python Versions @@ -77,10 +80,9 @@ Mac/Linux .. code-block:: console - pip install virtualenv - virtualenv + python3 -m venv source /bin/activate - /bin/pip install google-cloud-video-transcoder + pip install google-cloud-video-transcoder Windows @@ -88,10 +90,9 @@ Windows .. code-block:: console - pip install virtualenv - virtualenv - \Scripts\activate - \Scripts\pip.exe install google-cloud-video-transcoder + py -m venv + .\\Scripts\activate + pip install google-cloud-video-transcoder Next Steps ~~~~~~~~~~ diff --git a/docs/conf.py b/docs/conf.py index 05a11fc..c954c3f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2021 Google LLC +# 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/noxfile.py b/noxfile.py index 7d411fe..3773a35 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2018 Google LLC +# 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. @@ -400,6 +400,7 @@ def prerelease_deps(session): "python", "-c", "import google.protobuf; print(google.protobuf.__version__)" ) session.run("python", "-c", "import grpc; print(grpc.__version__)") + session.run("python", "-c", "import google.auth; print(google.auth.__version__)") session.run("py.test", "tests/unit") diff --git a/scripts/decrypt-secrets.sh b/scripts/decrypt-secrets.sh index 21f6d2a..0018b42 100755 --- a/scripts/decrypt-secrets.sh +++ b/scripts/decrypt-secrets.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2015 Google Inc. All rights reserved. +# Copyright 2023 Google LLC 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. diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py index 91b5967..1acc119 100644 --- a/scripts/readme-gen/readme_gen.py +++ b/scripts/readme-gen/readme_gen.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright 2016 Google Inc +# 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. @@ -33,17 +33,17 @@ autoescape=True, ) -README_TMPL = jinja_env.get_template('README.tmpl.rst') +README_TMPL = jinja_env.get_template("README.tmpl.rst") def get_help(file): - return subprocess.check_output(['python', file, '--help']).decode() + return subprocess.check_output(["python", file, "--help"]).decode() def main(): parser = argparse.ArgumentParser() - parser.add_argument('source') - parser.add_argument('--destination', default='README.rst') + parser.add_argument("source") + parser.add_argument("--destination", default="README.rst") args = parser.parse_args() @@ -51,9 +51,9 @@ def main(): root = os.path.dirname(source) destination = os.path.join(root, args.destination) - jinja_env.globals['get_help'] = get_help + jinja_env.globals["get_help"] = get_help - with io.open(source, 'r') as f: + with io.open(source, "r") as f: config = yaml.load(f) # This allows get_help to execute in the right directory. @@ -61,9 +61,9 @@ def main(): output = README_TMPL.render(config) - with io.open(destination, 'w') as f: + with io.open(destination, "w") as f: f.write(output) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/setup.cfg b/setup.cfg index c3a2b39..0523500 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2020 Google LLC +# 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. From 317939622bd35b21bfb68062836a62189fbfc495 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 19 Jul 2023 18:43:26 +0200 Subject: [PATCH 03/14] chore(deps): update dependency google-api-python-client to v2.94.0 (#322) --- samples/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index e8f20c4..9e99693 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.93.0 +google-api-python-client==2.94.0 grpcio==1.56.0 google-cloud-video-transcoder==1.10.0 From 448dcb40a3ac71930d03b9574ef56269731e420c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 21 Jul 2023 02:26:21 +0000 Subject: [PATCH 04/14] build(deps): [autoapprove] bump pygments from 2.13.0 to 2.15.0 (#324) Source-Link: https://togithub.com/googleapis/synthtool/commit/eaef28efd179e6eeb9f4e9bf697530d074a6f3b9 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f8ca7655fa8a449cadcabcbce4054f593dcbae7aeeab34aa3fcc8b5cf7a93c9e --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/requirements.txt | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index ae4a522..17c21d9 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:39f0f3f2be02ef036e297e376fe3b6256775576da8a6ccb1d5eeb80f4c8bf8fb -# created: 2023-07-17T15:20:13.819193964Z + digest: sha256:f8ca7655fa8a449cadcabcbce4054f593dcbae7aeeab34aa3fcc8b5cf7a93c9e +# created: 2023-07-21T02:12:46.49799314Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 67d70a1..b563eb2 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -396,9 +396,9 @@ pycparser==2.21 \ --hash=sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9 \ --hash=sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206 # via cffi -pygments==2.13.0 \ - --hash=sha256:56a8508ae95f98e2b9bdf93a6be5ae3f7d8af858b43e02c5a2ff083726be40c1 \ - --hash=sha256:f643f331ab57ba3c9d89212ee4a2dabc6e94f117cf4eefde99a0574720d14c42 +pygments==2.15.0 \ + --hash=sha256:77a3299119af881904cd5ecd1ac6a66214b6e9bed1f2db16993b54adede64094 \ + --hash=sha256:f7e36cffc4c517fbc252861b9a6e4644ca0e5abadf9a113c72d1358ad09b9500 # via # readme-renderer # rich From c9cd4fd2e631acfc347ac4055776fddbf3e2931f Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Sat, 22 Jul 2023 13:14:03 +0200 Subject: [PATCH 05/14] chore(deps): update dependency grpcio to v1.56.2 (#323) Co-authored-by: Anthonios Partheniou --- samples/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index 9e99693..399c4fb 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,3 +1,3 @@ google-api-python-client==2.94.0 -grpcio==1.56.0 +grpcio==1.56.2 google-cloud-video-transcoder==1.10.0 From c8ddef09217e0d1ae4cb47cdb9c65aaae4114bc6 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 25 Jul 2023 19:28:02 +0200 Subject: [PATCH 06/14] chore(deps): update dependency google-api-python-client to v2.95.0 (#325) --- samples/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index 399c4fb..d0b1c1c 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.94.0 +google-api-python-client==2.95.0 grpcio==1.56.2 google-cloud-video-transcoder==1.10.0 From c71297374f115031852d7a6d6ca43b298f194269 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 25 Jul 2023 21:16:23 +0000 Subject: [PATCH 07/14] build(deps): [autoapprove] bump certifi from 2022.12.7 to 2023.7.22 (#326) Source-Link: https://togithub.com/googleapis/synthtool/commit/395d53adeeacfca00b73abf197f65f3c17c8f1e9 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:6c1cbc75c74b8bdd71dada2fa1677e9d6d78a889e9a70ee75b93d1d0543f96e1 --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/requirements.txt | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 17c21d9..0ddd0e4 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:f8ca7655fa8a449cadcabcbce4054f593dcbae7aeeab34aa3fcc8b5cf7a93c9e -# created: 2023-07-21T02:12:46.49799314Z + digest: sha256:6c1cbc75c74b8bdd71dada2fa1677e9d6d78a889e9a70ee75b93d1d0543f96e1 +# created: 2023-07-25T21:01:10.396410762Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index b563eb2..76d9bba 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -20,9 +20,9 @@ cachetools==5.2.0 \ --hash=sha256:6a94c6402995a99c3970cc7e4884bb60b4a8639938157eeed436098bf9831757 \ --hash=sha256:f9f17d2aec496a9aa6b76f53e3b614c965223c061982d434d160f930c698a9db # via google-auth -certifi==2022.12.7 \ - --hash=sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3 \ - --hash=sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18 +certifi==2023.7.22 \ + --hash=sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082 \ + --hash=sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9 # via requests cffi==1.15.1 \ --hash=sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5 \ From fad8662c859e4c7fb4877e742b443912d0b222d6 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 1 Aug 2023 17:54:20 +0000 Subject: [PATCH 08/14] chore: [autoapprove] Pin flake8 version (#327) Source-Link: https://togithub.com/googleapis/synthtool/commit/0ddbff8012e47cde4462fe3f9feab01fbc4cdfd6 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bced5ca77c4dda0fd2f5d845d4035fc3c5d3d6b81f245246a36aee114970082b --- .github/.OwlBot.lock.yaml | 4 ++-- .pre-commit-config.yaml | 2 +- noxfile.py | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 0ddd0e4..d71329c 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:6c1cbc75c74b8bdd71dada2fa1677e9d6d78a889e9a70ee75b93d1d0543f96e1 -# created: 2023-07-25T21:01:10.396410762Z + digest: sha256:bced5ca77c4dda0fd2f5d845d4035fc3c5d3d6b81f245246a36aee114970082b +# created: 2023-08-01T17:41:45.434027321Z diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9e3898f..19409cb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,6 @@ repos: hooks: - id: black - repo: https://github.com/pycqa/flake8 - rev: 3.9.2 + rev: 6.1.0 hooks: - id: flake8 diff --git a/noxfile.py b/noxfile.py index 3773a35..4000733 100644 --- a/noxfile.py +++ b/noxfile.py @@ -26,6 +26,7 @@ import nox +FLAKE8_VERSION = "flake8==6.1.0" BLACK_VERSION = "black==22.3.0" ISORT_VERSION = "isort==5.10.1" LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] @@ -82,7 +83,7 @@ def lint(session): Returns a failure if the linters find linting errors or sufficiently serious code quality issues. """ - session.install("flake8", BLACK_VERSION) + session.install(FLAKE8_VERSION, BLACK_VERSION) session.run( "black", "--check", From 31fbdb3cc6dbe5fcff7ede01c7306d48e7efdcc9 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 11:06:19 +0000 Subject: [PATCH 09/14] build: [autoapprove] bump cryptography from 41.0.2 to 41.0.3 (#328) Source-Link: https://togithub.com/googleapis/synthtool/commit/352b9d4c068ce7c05908172af128b294073bf53c Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3e3800bb100af5d7f9e810d48212b37812c1856d20ffeafb99ebe66461b61fc7 --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/requirements.txt | 48 +++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index d71329c..a3da1b0 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:bced5ca77c4dda0fd2f5d845d4035fc3c5d3d6b81f245246a36aee114970082b -# created: 2023-08-01T17:41:45.434027321Z + digest: sha256:3e3800bb100af5d7f9e810d48212b37812c1856d20ffeafb99ebe66461b61fc7 +# created: 2023-08-02T10:53:29.114535628Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 76d9bba..029bd34 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -113,30 +113,30 @@ commonmark==0.9.1 \ --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 # via rich -cryptography==41.0.2 \ - --hash=sha256:01f1d9e537f9a15b037d5d9ee442b8c22e3ae11ce65ea1f3316a41c78756b711 \ - --hash=sha256:079347de771f9282fbfe0e0236c716686950c19dee1b76240ab09ce1624d76d7 \ - --hash=sha256:182be4171f9332b6741ee818ec27daff9fb00349f706629f5cbf417bd50e66fd \ - --hash=sha256:192255f539d7a89f2102d07d7375b1e0a81f7478925b3bc2e0549ebf739dae0e \ - --hash=sha256:2a034bf7d9ca894720f2ec1d8b7b5832d7e363571828037f9e0c4f18c1b58a58 \ - --hash=sha256:342f3767e25876751e14f8459ad85e77e660537ca0a066e10e75df9c9e9099f0 \ - --hash=sha256:439c3cc4c0d42fa999b83ded80a9a1fb54d53c58d6e59234cfe97f241e6c781d \ - --hash=sha256:49c3222bb8f8e800aead2e376cbef687bc9e3cb9b58b29a261210456a7783d83 \ - --hash=sha256:674b669d5daa64206c38e507808aae49904c988fa0a71c935e7006a3e1e83831 \ - --hash=sha256:7a9a3bced53b7f09da251685224d6a260c3cb291768f54954e28f03ef14e3766 \ - --hash=sha256:7af244b012711a26196450d34f483357e42aeddb04128885d95a69bd8b14b69b \ - --hash=sha256:7d230bf856164de164ecb615ccc14c7fc6de6906ddd5b491f3af90d3514c925c \ - --hash=sha256:84609ade00a6ec59a89729e87a503c6e36af98ddcd566d5f3be52e29ba993182 \ - --hash=sha256:9a6673c1828db6270b76b22cc696f40cde9043eb90373da5c2f8f2158957f42f \ - --hash=sha256:9b6d717393dbae53d4e52684ef4f022444fc1cce3c48c38cb74fca29e1f08eaa \ - --hash=sha256:9c3fe6534d59d071ee82081ca3d71eed3210f76ebd0361798c74abc2bcf347d4 \ - --hash=sha256:a719399b99377b218dac6cf547b6ec54e6ef20207b6165126a280b0ce97e0d2a \ - --hash=sha256:b332cba64d99a70c1e0836902720887fb4529ea49ea7f5462cf6640e095e11d2 \ - --hash=sha256:d124682c7a23c9764e54ca9ab5b308b14b18eba02722b8659fb238546de83a76 \ - --hash=sha256:d73f419a56d74fef257955f51b18d046f3506270a5fd2ac5febbfa259d6c0fa5 \ - --hash=sha256:f0dc40e6f7aa37af01aba07277d3d64d5a03dc66d682097541ec4da03cc140ee \ - --hash=sha256:f14ad275364c8b4e525d018f6716537ae7b6d369c094805cae45300847e0894f \ - --hash=sha256:f772610fe364372de33d76edcd313636a25684edb94cee53fd790195f5989d14 +cryptography==41.0.3 \ + --hash=sha256:0d09fb5356f975974dbcb595ad2d178305e5050656affb7890a1583f5e02a306 \ + --hash=sha256:23c2d778cf829f7d0ae180600b17e9fceea3c2ef8b31a99e3c694cbbf3a24b84 \ + --hash=sha256:3fb248989b6363906827284cd20cca63bb1a757e0a2864d4c1682a985e3dca47 \ + --hash=sha256:41d7aa7cdfded09b3d73a47f429c298e80796c8e825ddfadc84c8a7f12df212d \ + --hash=sha256:42cb413e01a5d36da9929baa9d70ca90d90b969269e5a12d39c1e0d475010116 \ + --hash=sha256:4c2f0d35703d61002a2bbdcf15548ebb701cfdd83cdc12471d2bae80878a4207 \ + --hash=sha256:4fd871184321100fb400d759ad0cddddf284c4b696568204d281c902fc7b0d81 \ + --hash=sha256:5259cb659aa43005eb55a0e4ff2c825ca111a0da1814202c64d28a985d33b087 \ + --hash=sha256:57a51b89f954f216a81c9d057bf1a24e2f36e764a1ca9a501a6964eb4a6800dd \ + --hash=sha256:652627a055cb52a84f8c448185922241dd5217443ca194d5739b44612c5e6507 \ + --hash=sha256:67e120e9a577c64fe1f611e53b30b3e69744e5910ff3b6e97e935aeb96005858 \ + --hash=sha256:6af1c6387c531cd364b72c28daa29232162010d952ceb7e5ca8e2827526aceae \ + --hash=sha256:6d192741113ef5e30d89dcb5b956ef4e1578f304708701b8b73d38e3e1461f34 \ + --hash=sha256:7efe8041897fe7a50863e51b77789b657a133c75c3b094e51b5e4b5cec7bf906 \ + --hash=sha256:84537453d57f55a50a5b6835622ee405816999a7113267739a1b4581f83535bd \ + --hash=sha256:8f09daa483aedea50d249ef98ed500569841d6498aa9c9f4b0531b9964658922 \ + --hash=sha256:95dd7f261bb76948b52a5330ba5202b91a26fbac13ad0e9fc8a3ac04752058c7 \ + --hash=sha256:a74fbcdb2a0d46fe00504f571a2a540532f4c188e6ccf26f1f178480117b33c4 \ + --hash=sha256:a983e441a00a9d57a4d7c91b3116a37ae602907a7618b882c8013b5762e80574 \ + --hash=sha256:ab8de0d091acbf778f74286f4989cf3d1528336af1b59f3e5d2ebca8b5fe49e1 \ + --hash=sha256:aeb57c421b34af8f9fe830e1955bf493a86a7996cc1338fe41b30047d16e962c \ + --hash=sha256:ce785cf81a7bdade534297ef9e490ddff800d956625020ab2ec2780a556c313e \ + --hash=sha256:d0d651aa754ef58d75cec6edfbd21259d93810b73f6ec246436a21b7841908de # via # gcp-releasetool # secretstorage From ef283adfa094e231346df605233e84bee6068263 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 9 Aug 2023 15:30:14 +0200 Subject: [PATCH 10/14] chore(deps): update dependency google-api-python-client to v2.96.0 (#329) --- samples/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index d0b1c1c..f61c235 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,3 +1,3 @@ -google-api-python-client==2.95.0 +google-api-python-client==2.96.0 grpcio==1.56.2 google-cloud-video-transcoder==1.10.0 From 6117901bdeb4aeb1a43e9bfb7d3930df9015dc49 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Fri, 11 Aug 2023 01:49:20 +0200 Subject: [PATCH 11/14] chore(deps): update dependency grpcio to v1.57.0 (#330) --- samples/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index f61c235..51c11b3 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,3 +1,3 @@ google-api-python-client==2.96.0 -grpcio==1.56.2 +grpcio==1.57.0 google-cloud-video-transcoder==1.10.0 From 180aca14aca091cb5705451e164f2b9466481ea2 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 13 Sep 2023 15:39:21 -0700 Subject: [PATCH 12/14] docs: Minor formatting (#332) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: Minor formatting chore: Update gapic-generator-python to v1.11.5 build: Update rules_python to 0.24.0 PiperOrigin-RevId: 563436317 Source-Link: https://github.com/googleapis/googleapis/commit/42fd37b18d706f6f51f52f209973b3b2c28f509a Source-Link: https://github.com/googleapis/googleapis-gen/commit/280264ca02fb9316b4237a96d0af1a2343a81a56 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjgwMjY0Y2EwMmZiOTMxNmI0MjM3YTk2ZDBhZjFhMjM0M2E4MWE1NiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- google/cloud/video/transcoder_v1/types/resources.py | 6 ++++++ .../snippet_metadata_google.cloud.video.transcoder.v1.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/google/cloud/video/transcoder_v1/types/resources.py b/google/cloud/video/transcoder_v1/types/resources.py index 0e0fa65..72ebfd2 100644 --- a/google/cloud/video/transcoder_v1/types/resources.py +++ b/google/cloud/video/transcoder_v1/types/resources.py @@ -1500,6 +1500,7 @@ class H264CodecSettings(proto.Message): adjusted to match the specified height and input aspect ratio. If both are omitted, the input width is used. + For portrait videos that contain horizontal ASR and rotation metadata, provide the width, in pixels, per the horizontal ASR. The API @@ -1512,6 +1513,7 @@ class H264CodecSettings(proto.Message): adjusted to match the specified width and input aspect ratio. If both are omitted, the input height is used. + For portrait videos that contain horizontal ASR and rotation metadata, provide the height, in pixels, per the horizontal ASR. The API @@ -1733,6 +1735,7 @@ class H265CodecSettings(proto.Message): adjusted to match the specified height and input aspect ratio. If both are omitted, the input width is used. + For portrait videos that contain horizontal ASR and rotation metadata, provide the width, in pixels, per the horizontal ASR. The API @@ -1745,6 +1748,7 @@ class H265CodecSettings(proto.Message): adjusted to match the specified width and input aspect ratio. If both are omitted, the input height is used. + For portrait videos that contain horizontal ASR and rotation metadata, provide the height, in pixels, per the horizontal ASR. The API @@ -1975,6 +1979,7 @@ class Vp9CodecSettings(proto.Message): adjusted to match the specified height and input aspect ratio. If both are omitted, the input width is used. + For portrait videos that contain horizontal ASR and rotation metadata, provide the width, in pixels, per the horizontal ASR. The API @@ -1987,6 +1992,7 @@ class Vp9CodecSettings(proto.Message): adjusted to match the specified width and input aspect ratio. If both are omitted, the input height is used. + For portrait videos that contain horizontal ASR and rotation metadata, provide the height, in pixels, per the horizontal ASR. The API diff --git a/samples/generated_samples/snippet_metadata_google.cloud.video.transcoder.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.video.transcoder.v1.json index 6dea80b..2c7572e 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.video.transcoder.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.video.transcoder.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-video-transcoder", - "version": "1.10.0" + "version": "0.1.0" }, "snippets": [ { From 27b99fb757e206f13062ca69c3b752d256351397 Mon Sep 17 00:00:00 2001 From: Yu-Han Liu Date: Mon, 18 Sep 2023 12:10:37 -0700 Subject: [PATCH 13/14] docs: remove migrated samples (#333) --- samples/snippets/README.md | 40 -- samples/snippets/create_job_from_ad_hoc.py | 123 ----- samples/snippets/create_job_from_preset.py | 88 --- samples/snippets/create_job_from_template.py | 88 --- samples/snippets/create_job_template.py | 115 ---- .../create_job_with_animated_overlay.py | 161 ------ .../create_job_with_concatenated_inputs.py | 203 ------- .../create_job_with_embedded_captions.py | 178 ------ ...te_job_with_periodic_images_spritesheet.py | 137 ----- ..._job_with_set_number_images_spritesheet.py | 136 ----- .../create_job_with_standalone_captions.py | 222 -------- .../create_job_with_static_overlay.py | 149 ----- samples/snippets/delete_job.py | 56 -- samples/snippets/delete_job_template.py | 58 -- samples/snippets/get_job.py | 57 -- samples/snippets/get_job_state.py | 58 -- samples/snippets/get_job_template.py | 58 -- samples/snippets/job_template_test.py | 60 -- samples/snippets/job_test.py | 520 ------------------ samples/snippets/list_job_templates.py | 59 -- samples/snippets/list_jobs.py | 57 -- samples/snippets/noxfile.py | 292 ---------- samples/snippets/requirements-test.txt | 3 - samples/snippets/requirements.txt | 3 - 24 files changed, 2921 deletions(-) delete mode 100644 samples/snippets/README.md delete mode 100644 samples/snippets/create_job_from_ad_hoc.py delete mode 100644 samples/snippets/create_job_from_preset.py delete mode 100644 samples/snippets/create_job_from_template.py delete mode 100644 samples/snippets/create_job_template.py delete mode 100644 samples/snippets/create_job_with_animated_overlay.py delete mode 100644 samples/snippets/create_job_with_concatenated_inputs.py delete mode 100644 samples/snippets/create_job_with_embedded_captions.py delete mode 100644 samples/snippets/create_job_with_periodic_images_spritesheet.py delete mode 100644 samples/snippets/create_job_with_set_number_images_spritesheet.py delete mode 100644 samples/snippets/create_job_with_standalone_captions.py delete mode 100644 samples/snippets/create_job_with_static_overlay.py delete mode 100644 samples/snippets/delete_job.py delete mode 100644 samples/snippets/delete_job_template.py delete mode 100644 samples/snippets/get_job.py delete mode 100644 samples/snippets/get_job_state.py delete mode 100644 samples/snippets/get_job_template.py delete mode 100644 samples/snippets/job_template_test.py delete mode 100644 samples/snippets/job_test.py delete mode 100644 samples/snippets/list_job_templates.py delete mode 100644 samples/snippets/list_jobs.py delete mode 100644 samples/snippets/noxfile.py delete mode 100644 samples/snippets/requirements-test.txt delete mode 100644 samples/snippets/requirements.txt diff --git a/samples/snippets/README.md b/samples/snippets/README.md deleted file mode 100644 index ce4ff95..0000000 --- a/samples/snippets/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# Transcoder API Python Samples - -This directory contains samples for the Transcoder API. Use this API to transcode videos into a variety of formats. The Transcoder API benefits broadcasters, production companies, businesses, and individuals looking to transform their video content for use across a variety of user devices. For more information, see the [Transcoder API documentation](https://cloud.google.com/transcoder/). - -## Setup - -To run the samples, you need to first follow the steps in [Before you begin](https://cloud.google.com/transcoder/docs/how-to/before-you-begin). - -For more information on authentication, refer to the -[Authentication Getting Started Guide](https://cloud.google.com/docs/authentication/getting-started). - -## Install Dependencies - -1. Clone python-docs-samples and change directory to the sample directory you want to use. - - $ git clone https://github.com/googleapis/python-video-transcoder.git - -1. Install [pip](https://pip.pypa.io/) and [virtualenv](https://virtualenv.pypa.io/) if you do not already have them. You may want to refer to the [Python Development Environment Setup Guide](https://cloud.google.com/python/setup) for Google Cloud Platform for instructions. - -1. Create a virtualenv. Samples are compatible with Python 3.6+. - - $ virtualenv env - $ source env/bin/activate - -1. Install the dependencies needed to run the samples. - - $ pip install -r requirements.txt - -## The client library - -This sample uses the [Google Cloud Client Library for Python](https://googlecloudplatform.github.io/google-cloud-python/). -You can read the documentation for more details on API usage and use GitHub -to [browse the source](https://github.com/GoogleCloudPlatform/google-cloud-python) and [report issues](https://github.com/GoogleCloudPlatform/google-cloud-python/issues). - -## Testing - -Make sure to enable the Transcoder API on the test project. Set the following environment variables: - -* `GOOGLE_CLOUD_PROJECT` -* `GOOGLE_CLOUD_PROJECT_NUMBER` diff --git a/samples/snippets/create_job_from_ad_hoc.py b/samples/snippets/create_job_from_ad_hoc.py deleted file mode 100644 index 7fc6dce..0000000 --- a/samples/snippets/create_job_from_ad_hoc.py +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2020 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 Transcoder sample for creating a job based on a supplied job config. - -Example usage: - python create_job_from_ad_hoc.py --project_id --location --input_uri --output_uri -""" - -# [START transcoder_create_job_from_ad_hoc] - -import argparse - -from google.cloud.video import transcoder_v1 -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) - - -def create_job_from_ad_hoc(project_id, location, input_uri, output_uri): - """Creates a job based on an ad-hoc job configuration. - - Args: - project_id: The GCP project ID. - location: The location to start the job in. - input_uri: Uri of the video in the Cloud Storage bucket. - output_uri: Uri of the video output folder in the Cloud Storage bucket.""" - - client = TranscoderServiceClient() - - parent = f"projects/{project_id}/locations/{location}" - job = transcoder_v1.types.Job() - job.input_uri = input_uri - job.output_uri = output_uri - job.config = transcoder_v1.types.JobConfig( - elementary_streams=[ - transcoder_v1.types.ElementaryStream( - key="video-stream0", - video_stream=transcoder_v1.types.VideoStream( - h264=transcoder_v1.types.VideoStream.H264CodecSettings( - height_pixels=360, - width_pixels=640, - bitrate_bps=550000, - frame_rate=60, - ), - ), - ), - transcoder_v1.types.ElementaryStream( - key="video-stream1", - video_stream=transcoder_v1.types.VideoStream( - h264=transcoder_v1.types.VideoStream.H264CodecSettings( - height_pixels=720, - width_pixels=1280, - bitrate_bps=2500000, - frame_rate=60, - ), - ), - ), - transcoder_v1.types.ElementaryStream( - key="audio-stream0", - audio_stream=transcoder_v1.types.AudioStream( - codec="aac", bitrate_bps=64000 - ), - ), - ], - mux_streams=[ - transcoder_v1.types.MuxStream( - key="sd", - container="mp4", - elementary_streams=["video-stream0", "audio-stream0"], - ), - transcoder_v1.types.MuxStream( - key="hd", - container="mp4", - elementary_streams=["video-stream1", "audio-stream0"], - ), - ], - ) - response = client.create_job(parent=parent, job=job) - print(f"Job: {response.name}") - return response - - -# [END transcoder_create_job_from_ad_hoc] - -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 to start this job in.", - default="us-central1", - ) - parser.add_argument( - "--input_uri", - help="Uri of the video in the Cloud Storage bucket.", - required=True, - ) - parser.add_argument( - "--output_uri", - help="Uri of the video output folder in the Cloud Storage bucket. Must end in '/'.", - required=True, - ) - args = parser.parse_args() - create_job_from_ad_hoc( - args.project_id, - args.location, - args.input_uri, - args.output_uri, - ) diff --git a/samples/snippets/create_job_from_preset.py b/samples/snippets/create_job_from_preset.py deleted file mode 100644 index 67c1672..0000000 --- a/samples/snippets/create_job_from_preset.py +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2020 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 Transcoder sample for creating a job based on a job preset. - -Example usage: - python create_job_from_preset.py --project_id --location --input_uri --output_uri [--preset ] -""" - -# [START transcoder_create_job_from_preset] - -import argparse - -from google.cloud.video import transcoder_v1 -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) - - -def create_job_from_preset(project_id, location, input_uri, output_uri, preset): - """Creates a job based on a job preset. - - Args: - project_id: The GCP project ID. - location: The location to start the job in. - input_uri: Uri of the video in the Cloud Storage bucket. - output_uri: Uri of the video output folder in the Cloud Storage bucket. - preset: The preset template (for example, 'preset/web-hd').""" - - client = TranscoderServiceClient() - - parent = f"projects/{project_id}/locations/{location}" - job = transcoder_v1.types.Job() - job.input_uri = input_uri - job.output_uri = output_uri - job.template_id = preset - - response = client.create_job(parent=parent, job=job) - print(f"Job: {response.name}") - return response - - -# [END transcoder_create_job_from_preset] - -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 to start this job in.", - default="us-central1", - ) - parser.add_argument( - "--input_uri", - help="Uri of the video in the Cloud Storage bucket.", - required=True, - ) - parser.add_argument( - "--output_uri", - help="Uri of the video output folder in the Cloud Storage bucket. Must end in '/'.", - required=True, - ) - parser.add_argument( - "--preset", - help="The preset template (for example, 'preset/web-hd').", - default="preset/web-hd", - ) - args = parser.parse_args() - create_job_from_preset( - args.project_id, - args.location, - args.input_uri, - args.output_uri, - args.preset, - ) diff --git a/samples/snippets/create_job_from_template.py b/samples/snippets/create_job_from_template.py deleted file mode 100644 index 685c3f6..0000000 --- a/samples/snippets/create_job_from_template.py +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2020 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 Transcoder sample for creating a job based on a job template. - -Example usage: - python create_job_from_template.py --project_id --location --input_uri --output_uri --template_id -""" - -# [START transcoder_create_job_from_template] - -import argparse - -from google.cloud.video import transcoder_v1 -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) - - -def create_job_from_template(project_id, location, input_uri, output_uri, template_id): - """Creates a job based on a job template. - - Args: - project_id: The GCP project ID. - location: The location to start the job in. - input_uri: Uri of the video in the Cloud Storage bucket. - output_uri: Uri of the video output folder in the Cloud Storage bucket. - template_id: The user-defined template ID.""" - - client = TranscoderServiceClient() - - parent = f"projects/{project_id}/locations/{location}" - job = transcoder_v1.types.Job() - job.input_uri = input_uri - job.output_uri = output_uri - job.template_id = template_id - - response = client.create_job(parent=parent, job=job) - print(f"Job: {response.name}") - return response - - -# [END transcoder_create_job_from_template] - -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 to start this job in.", - default="us-central1", - ) - parser.add_argument( - "--input_uri", - help="Uri of the video in the Cloud Storage bucket.", - required=True, - ) - parser.add_argument( - "--output_uri", - help="Uri of the video output folder in the Cloud Storage bucket. Must end in '/'.", - required=True, - ) - parser.add_argument( - "--template_id", - help="The job template ID. The template must be located in the same location as the job.", - required=True, - ) - args = parser.parse_args() - create_job_from_template( - args.project_id, - args.location, - args.input_uri, - args.output_uri, - args.template_id, - ) diff --git a/samples/snippets/create_job_template.py b/samples/snippets/create_job_template.py deleted file mode 100644 index 95ed05d..0000000 --- a/samples/snippets/create_job_template.py +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2020 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 Transcoder sample for creating a job template. - -Example usage: - python create_job_template.py --project_id [--location ] [--template_id ] -""" - -# [START transcoder_create_job_template] - -import argparse - -from google.cloud.video import transcoder_v1 -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) - - -def create_job_template(project_id, location, template_id): - """Creates a job template. - - Args: - project_id: The GCP project ID. - location: The location to store this template in. - template_id: The user-defined template ID.""" - - client = TranscoderServiceClient() - - parent = f"projects/{project_id}/locations/{location}" - - job_template = transcoder_v1.types.JobTemplate() - job_template.name = ( - f"projects/{project_id}/locations/{location}/jobTemplates/{template_id}" - ) - job_template.config = transcoder_v1.types.JobConfig( - elementary_streams=[ - transcoder_v1.types.ElementaryStream( - key="video-stream0", - video_stream=transcoder_v1.types.VideoStream( - h264=transcoder_v1.types.VideoStream.H264CodecSettings( - height_pixels=360, - width_pixels=640, - bitrate_bps=550000, - frame_rate=60, - ), - ), - ), - transcoder_v1.types.ElementaryStream( - key="video-stream1", - video_stream=transcoder_v1.types.VideoStream( - h264=transcoder_v1.types.VideoStream.H264CodecSettings( - height_pixels=720, - width_pixels=1280, - bitrate_bps=2500000, - frame_rate=60, - ), - ), - ), - transcoder_v1.types.ElementaryStream( - key="audio-stream0", - audio_stream=transcoder_v1.types.AudioStream( - codec="aac", bitrate_bps=64000 - ), - ), - ], - mux_streams=[ - transcoder_v1.types.MuxStream( - key="sd", - container="mp4", - elementary_streams=["video-stream0", "audio-stream0"], - ), - transcoder_v1.types.MuxStream( - key="hd", - container="mp4", - elementary_streams=["video-stream1", "audio-stream0"], - ), - ], - ) - - response = client.create_job_template( - parent=parent, job_template=job_template, job_template_id=template_id - ) - print(f"Job template: {response.name}") - return response - - -# [END transcoder_create_job_template] - -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 to store this template in.", - default="us-central1", - ) - parser.add_argument( - "--template_id", help="The job template ID.", default="my-job-template" - ) - args = parser.parse_args() - create_job_template(args.project_id, args.location, args.template_id) diff --git a/samples/snippets/create_job_with_animated_overlay.py b/samples/snippets/create_job_with_animated_overlay.py deleted file mode 100644 index 52940e8..0000000 --- a/samples/snippets/create_job_with_animated_overlay.py +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env python - -# 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. - -"""Google Cloud Transcoder sample for creating a job based on a supplied job config that includes an animated overlay. - -Example usage: - python create_job_with_animated_overlay.py --project_id --location --input_uri --overlay_image_uri --output_uri -""" - -# [START transcoder_create_job_with_animated_overlay] - -import argparse - -from google.cloud.video import transcoder_v1 -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) -from google.protobuf import duration_pb2 as duration - - -def create_job_with_animated_overlay( - project_id, location, input_uri, overlay_image_uri, output_uri -): - """Creates a job based on an ad-hoc job configuration that includes an animated image overlay. - - Args: - project_id: The GCP project ID. - location: The location to start the job in. - input_uri: Uri of the video in the Cloud Storage bucket. - overlay_image_uri: Uri of the image for the overlay in the Cloud Storage bucket. - output_uri: Uri of the video output folder in the Cloud Storage bucket.""" - - client = TranscoderServiceClient() - - parent = f"projects/{project_id}/locations/{location}" - job = transcoder_v1.types.Job() - job.input_uri = input_uri - job.output_uri = output_uri - job.config = transcoder_v1.types.JobConfig( - elementary_streams=[ - transcoder_v1.types.ElementaryStream( - key="video-stream0", - video_stream=transcoder_v1.types.VideoStream( - h264=transcoder_v1.types.VideoStream.H264CodecSettings( - height_pixels=360, - width_pixels=640, - bitrate_bps=550000, - frame_rate=60, - ), - ), - ), - transcoder_v1.types.ElementaryStream( - key="audio-stream0", - audio_stream=transcoder_v1.types.AudioStream( - codec="aac", bitrate_bps=64000 - ), - ), - ], - mux_streams=[ - transcoder_v1.types.MuxStream( - key="sd", - container="mp4", - elementary_streams=["video-stream0", "audio-stream0"], - ), - ], - overlays=[ - transcoder_v1.types.Overlay( - image=transcoder_v1.types.Overlay.Image( - uri=overlay_image_uri, - resolution=transcoder_v1.types.Overlay.NormalizedCoordinate( - x=0, - y=0, - ), - alpha=1, - ), - animations=[ - transcoder_v1.types.Overlay.Animation( - animation_fade=transcoder_v1.types.Overlay.AnimationFade( - fade_type=transcoder_v1.types.Overlay.FadeType.FADE_IN, - xy=transcoder_v1.types.Overlay.NormalizedCoordinate( - x=0.5, - y=0.5, - ), - start_time_offset=duration.Duration( - seconds=5, - ), - end_time_offset=duration.Duration( - seconds=10, - ), - ), - ), - transcoder_v1.types.Overlay.Animation( - animation_fade=transcoder_v1.types.Overlay.AnimationFade( - fade_type=transcoder_v1.types.Overlay.FadeType.FADE_OUT, - xy=transcoder_v1.types.Overlay.NormalizedCoordinate( - x=0.5, - y=0.5, - ), - start_time_offset=duration.Duration( - seconds=12, - ), - end_time_offset=duration.Duration( - seconds=15, - ), - ), - ), - ], - ), - ], - ) - response = client.create_job(parent=parent, job=job) - print(f"Job: {response.name}") - return response - - -# [END transcoder_create_job_with_animated_overlay] - -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 to start this job in.", - default="us-central1", - ) - parser.add_argument( - "--input_uri", - help="Uri of the video in the Cloud Storage bucket.", - required=True, - ) - parser.add_argument( - "--overlay_image_uri", - help="Uri of the overlay image in the Cloud Storage bucket.", - required=True, - ) - parser.add_argument( - "--output_uri", - help="Uri of the video output folder in the Cloud Storage bucket. Must end in '/'.", - required=True, - ) - args = parser.parse_args() - create_job_with_animated_overlay( - args.project_id, - args.location, - args.input_uri, - args.overlay_image_uri, - args.output_uri, - ) diff --git a/samples/snippets/create_job_with_concatenated_inputs.py b/samples/snippets/create_job_with_concatenated_inputs.py deleted file mode 100644 index 4a64f88..0000000 --- a/samples/snippets/create_job_with_concatenated_inputs.py +++ /dev/null @@ -1,203 +0,0 @@ -#!/usr/bin/env python - -# 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. -# 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 Transcoder sample for creating a job based on concatenating two input videos. - -Example usage: - python create_job_with_concatenated_inputs.py --project_id --location \ - --input1_uri --start_time_input1 --end_time_input1 \ - --input2_uri --start_time_input2 --end_time_input2 \ - --output_uri -""" - -# [START transcoder_create_job_with_concatenated_inputs] - -import argparse - -from google.cloud.video import transcoder_v1 -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) -from google.protobuf import duration_pb2 as duration - - -def create_job_with_concatenated_inputs( - project_id, - location, - input1_uri, - start_time_input1, - end_time_input1, - input2_uri, - start_time_input2, - end_time_input2, - output_uri, -): - """Creates a job based on an ad-hoc job configuration that concatenates two input videos. - - Args: - project_id (str): The GCP project ID. - location (str): The location to start the job in. - input1_uri (str): Uri of the first video in the Cloud Storage bucket. - start_time_input1 (str): Start time, in fractional seconds ending in 's' - (e.g., '0s'), relative to the first input video timeline. - end_time_input1 (str): End time, in fractional seconds ending in 's' - (e.g., '8.1s'), relative to the first input video timeline. - input2_uri (str): Uri of the second video in the Cloud Storage bucket. - start_time_input2 (str): Start time, in fractional seconds ending in 's' - (e.g., '3.5s'), relative to the second input video timeline. - end_time_input2 (str): End time, in fractional seconds ending in 's' - (e.g., '15s'), relative to the second input video timeline. - output_uri (str): Uri of the video output folder in the Cloud Storage - bucket.""" - - s1 = duration.Duration() - s1.FromJsonString(start_time_input1) - e1 = duration.Duration() - e1.FromJsonString(end_time_input1) - - s2 = duration.Duration() - s2.FromJsonString(start_time_input2) - e2 = duration.Duration() - e2.FromJsonString(end_time_input2) - - client = TranscoderServiceClient() - - parent = f"projects/{project_id}/locations/{location}" - job = transcoder_v1.types.Job() - job.output_uri = output_uri - job.config = transcoder_v1.types.JobConfig( - inputs=[ - transcoder_v1.types.Input( - key="input1", - uri=input1_uri, - ), - transcoder_v1.types.Input( - key="input2", - uri=input2_uri, - ), - ], - edit_list=[ - transcoder_v1.types.EditAtom( - key="atom1", - inputs=["input1"], - start_time_offset=s1, - end_time_offset=e1, - ), - transcoder_v1.types.EditAtom( - key="atom2", - inputs=["input2"], - start_time_offset=s2, - end_time_offset=e2, - ), - ], - elementary_streams=[ - transcoder_v1.types.ElementaryStream( - key="video-stream0", - video_stream=transcoder_v1.types.VideoStream( - h264=transcoder_v1.types.VideoStream.H264CodecSettings( - height_pixels=360, - width_pixels=640, - bitrate_bps=550000, - frame_rate=60, - ), - ), - ), - transcoder_v1.types.ElementaryStream( - key="audio-stream0", - audio_stream=transcoder_v1.types.AudioStream( - codec="aac", bitrate_bps=64000 - ), - ), - ], - mux_streams=[ - transcoder_v1.types.MuxStream( - key="sd", - container="mp4", - elementary_streams=["video-stream0", "audio-stream0"], - ), - ], - ) - response = client.create_job(parent=parent, job=job) - print(f"Job: {response.name}") - return response - - -# [END transcoder_create_job_with_concatenated_inputs] - -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 to start this job in.", - default="us-central1", - ) - parser.add_argument( - "--input1_uri", - help="Uri of the first video in the Cloud Storage bucket.", - required=True, - ) - parser.add_argument( - "--start_time_input1", - help="Start time, in fractional seconds ending in 's' (e.g., '1.1s'), " - + "relative to the first input video timeline. Use this field to trim " - + "content from the beginning of the first video.", - required=True, - ) - parser.add_argument( - "--end_time_input1", - help="End time, in fractional seconds ending in 's' (e.g., '9.5s'), " - + "relative to the first input video timeline. Use this field to trim " - + "content from the end of the first video.", - required=True, - ) - parser.add_argument( - "--input2_uri", - help="Uri of the second video in the Cloud Storage bucket.", - required=True, - ) - parser.add_argument( - "--start_time_input2", - help="Start time, in fractional seconds ending in 's' (e.g., '1.1s'), " - + "relative to the second input video timeline. Use this field to trim " - + "content from the beginning of the second video.", - required=True, - ) - parser.add_argument( - "--end_time_input2", - help="End time, in fractional seconds ending in 's' (e.g., '9.5s'), " - + "relative to the second input video timeline. Use this field to trim " - + "content from the end of the second video.", - required=True, - ) - parser.add_argument( - "--output_uri", - help="Uri of the video output folder in the Cloud Storage bucket. " - + "Must end in '/'.", - required=True, - ) - args = parser.parse_args() - create_job_with_concatenated_inputs( - args.project_id, - args.location, - args.input1_uri, - args.start_time_input1, - args.end_time_input1, - args.input2_uri, - args.start_time_input2, - args.end_time_input2, - args.output_uri, - ) diff --git a/samples/snippets/create_job_with_embedded_captions.py b/samples/snippets/create_job_with_embedded_captions.py deleted file mode 100644 index 58f985d..0000000 --- a/samples/snippets/create_job_with_embedded_captions.py +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/env python - -# 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. -# 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 Transcoder sample for creating a job that embeds captions in the output video. - -Example usage: - python create_job_with_embedded_captions.py --project_id --location \ - --input_video_uri --input_captions_uri --output_uri -""" - -# [START transcoder_create_job_with_embedded_captions] - -import argparse - -from google.cloud.video import transcoder_v1 -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) - - -def create_job_with_embedded_captions( - project_id, - location, - input_video_uri, - input_captions_uri, - output_uri, -): - """Creates a job based on an ad-hoc job configuration that embeds closed captions in the output video. - - Args: - project_id (str): The GCP project ID. - location (str): The location to start the job in. - input_video_uri (str): Uri of the input video in the Cloud Storage - bucket. - input_captions_uri (str): Uri of the input captions file in the Cloud - Storage bucket. - output_uri (str): Uri of the video output folder in the Cloud Storage - bucket.""" - - client = TranscoderServiceClient() - - parent = f"projects/{project_id}/locations/{location}" - job = transcoder_v1.types.Job() - job.output_uri = output_uri - job.config = transcoder_v1.types.JobConfig( - inputs=[ - transcoder_v1.types.Input( - key="input0", - uri=input_video_uri, - ), - transcoder_v1.types.Input( - key="caption-input0", - uri=input_captions_uri, - ), - ], - edit_list=[ - transcoder_v1.types.EditAtom( - key="atom0", - inputs=["input0", "caption-input0"], - ), - ], - elementary_streams=[ - transcoder_v1.types.ElementaryStream( - key="video-stream0", - video_stream=transcoder_v1.types.VideoStream( - h264=transcoder_v1.types.VideoStream.H264CodecSettings( - height_pixels=360, - width_pixels=640, - bitrate_bps=550000, - frame_rate=60, - ), - ), - ), - transcoder_v1.types.ElementaryStream( - key="audio-stream0", - audio_stream=transcoder_v1.types.AudioStream( - codec="aac", - bitrate_bps=64000, - ), - ), - transcoder_v1.types.ElementaryStream( - key="cea-stream0", - text_stream=transcoder_v1.types.TextStream( - codec="cea608", - mapping_=[ - transcoder_v1.types.TextStream.TextMapping( - atom_key="atom0", - input_key="caption-input0", - input_track=0, - ), - ], - language_code="en-US", - display_name="English", - ), - ), - ], - mux_streams=[ - transcoder_v1.types.MuxStream( - key="sd-hls", - container="ts", - elementary_streams=["video-stream0", "audio-stream0"], - ), - transcoder_v1.types.MuxStream( - key="sd-dash", - container="fmp4", - elementary_streams=["video-stream0"], - ), - transcoder_v1.types.MuxStream( - key="audio-dash", - container="fmp4", - elementary_streams=["audio-stream0"], - ), - ], - manifests=[ - transcoder_v1.types.Manifest( - file_name="manifest.m3u8", - type_="HLS", - mux_streams=["sd-hls"], - ), - transcoder_v1.types.Manifest( - file_name="manifest.mpd", - type_="DASH", - mux_streams=["sd-dash", "audio-dash"], - ), - ], - ) - response = client.create_job(parent=parent, job=job) - print(f"Job: {response.name}") - return response - - -# [END transcoder_create_job_with_embedded_captions] - -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 to start this job in.", - default="us-central1", - ) - parser.add_argument( - "--input_video_uri", - help="Uri of the input video in the Cloud Storage bucket.", - required=True, - ) - parser.add_argument( - "--input_captions_uri", - help="Uri of the input captions file in the Cloud Storage bucket.", - required=True, - ) - parser.add_argument( - "--output_uri", - help="Uri of the video output folder in the Cloud Storage bucket. " - + "Must end in '/'.", - required=True, - ) - args = parser.parse_args() - create_job_with_embedded_captions( - args.project_id, - args.location, - args.input_video_uri, - args.input_captions_uri, - args.output_uri, - ) diff --git a/samples/snippets/create_job_with_periodic_images_spritesheet.py b/samples/snippets/create_job_with_periodic_images_spritesheet.py deleted file mode 100644 index 1690ba6..0000000 --- a/samples/snippets/create_job_with_periodic_images_spritesheet.py +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/env python - -# 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. - -"""Google Cloud Transcoder sample for creating a job that generates two spritesheets from the input video. Each spritesheet contains images that are captured periodically. - -Example usage: - python create_job_with_periodic_images_spritesheet.py --project_id --location --input_uri --output_uri -""" - -# [START transcoder_create_job_with_periodic_images_spritesheet] - -import argparse - -from google.cloud.video import transcoder_v1 -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) -from google.protobuf import duration_pb2 as duration - - -def create_job_with_periodic_images_spritesheet( - project_id, location, input_uri, output_uri -): - """Creates a job based on an ad-hoc job configuration that generates two spritesheets. - - Args: - project_id: The GCP project ID. - location: The location to start the job in. - input_uri: Uri of the video in the Cloud Storage bucket. - output_uri: Uri of the video output folder in the Cloud Storage bucket.""" - - client = TranscoderServiceClient() - - parent = f"projects/{project_id}/locations/{location}" - job = transcoder_v1.types.Job() - job.input_uri = input_uri - job.output_uri = output_uri - job.config = transcoder_v1.types.JobConfig( - # Create an ad-hoc job. For more information, see https://cloud.google.com/transcoder/docs/how-to/jobs#create_jobs_ad_hoc. - # See all options for the job config at https://cloud.google.com/transcoder/docs/reference/rest/v1/JobConfig. - elementary_streams=[ - # This section defines the output video stream. - transcoder_v1.types.ElementaryStream( - key="video-stream0", - video_stream=transcoder_v1.types.VideoStream( - h264=transcoder_v1.types.VideoStream.H264CodecSettings( - height_pixels=360, - width_pixels=640, - bitrate_bps=550000, - frame_rate=60, - ), - ), - ), - # This section defines the output audio stream. - transcoder_v1.types.ElementaryStream( - key="audio-stream0", - audio_stream=transcoder_v1.types.AudioStream( - codec="aac", bitrate_bps=64000 - ), - ), - ], - # This section multiplexes the output audio and video together into a container. - mux_streams=[ - transcoder_v1.types.MuxStream( - key="sd", - container="mp4", - elementary_streams=["video-stream0", "audio-stream0"], - ), - ], - # Generate two sprite sheets from the input video into the GCS bucket. For more information, see - # https://cloud.google.com/transcoder/docs/how-to/generate-spritesheet#generate_image_periodically. - sprite_sheets=[ - # Generate a sprite sheet with 64x32px images. An image is taken every 7 seconds from the video. - transcoder_v1.types.SpriteSheet( - file_prefix="small-sprite-sheet", - sprite_width_pixels=64, - sprite_height_pixels=32, - interval=duration.Duration( - seconds=7, - ), - ), - # Generate a sprite sheet with 128x72px images. An image is taken every 7 seconds from the video. - transcoder_v1.types.SpriteSheet( - file_prefix="large-sprite-sheet", - sprite_width_pixels=128, - sprite_height_pixels=72, - interval=duration.Duration( - seconds=7, - ), - ), - ], - ) - response = client.create_job(parent=parent, job=job) - print(f"Job: {response.name}") - return response - - -# [END transcoder_create_job_with_periodic_images_spritesheet] - -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 to start this job in.", - default="us-central1", - ) - parser.add_argument( - "--input_uri", - help="Uri of the video in the Cloud Storage bucket.", - required=True, - ) - parser.add_argument( - "--output_uri", - help="Uri of the video output folder in the Cloud Storage bucket. Must end in '/'.", - required=True, - ) - args = parser.parse_args() - create_job_with_periodic_images_spritesheet( - args.project_id, - args.location, - args.input_uri, - args.output_uri, - ) diff --git a/samples/snippets/create_job_with_set_number_images_spritesheet.py b/samples/snippets/create_job_with_set_number_images_spritesheet.py deleted file mode 100644 index bc196fb..0000000 --- a/samples/snippets/create_job_with_set_number_images_spritesheet.py +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/env python - -# 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. - -"""Google Cloud Transcoder sample for creating a job that generates two spritesheets from the input video. Each spritesheet contains a set number of images. - -Example usage: - python create_job_with_set_number_images_spritesheet.py --project_id --location --input_uri --output_uri -""" - -# [START transcoder_create_job_with_set_number_images_spritesheet] - -import argparse - -from google.cloud.video import transcoder_v1 -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) - - -def create_job_with_set_number_images_spritesheet( - project_id, location, input_uri, output_uri -): - """Creates a job based on an ad-hoc job configuration that generates two spritesheets. - - Args: - project_id: The GCP project ID. - location: The location to start the job in. - input_uri: Uri of the video in the Cloud Storage bucket. - output_uri: Uri of the video output folder in the Cloud Storage bucket.""" - - client = TranscoderServiceClient() - - parent = f"projects/{project_id}/locations/{location}" - job = transcoder_v1.types.Job() - job.input_uri = input_uri - job.output_uri = output_uri - job.config = transcoder_v1.types.JobConfig( - # Create an ad-hoc job. For more information, see https://cloud.google.com/transcoder/docs/how-to/jobs#create_jobs_ad_hoc. - # See all options for the job config at https://cloud.google.com/transcoder/docs/reference/rest/v1/JobConfig. - elementary_streams=[ - # This section defines the output video stream. - transcoder_v1.types.ElementaryStream( - key="video-stream0", - video_stream=transcoder_v1.types.VideoStream( - h264=transcoder_v1.types.VideoStream.H264CodecSettings( - height_pixels=360, - width_pixels=640, - bitrate_bps=550000, - frame_rate=60, - ), - ), - ), - # This section defines the output audio stream. - transcoder_v1.types.ElementaryStream( - key="audio-stream0", - audio_stream=transcoder_v1.types.AudioStream( - codec="aac", bitrate_bps=64000 - ), - ), - ], - # This section multiplexes the output audio and video together into a container. - mux_streams=[ - transcoder_v1.types.MuxStream( - key="sd", - container="mp4", - elementary_streams=["video-stream0", "audio-stream0"], - ), - ], - # Generate two sprite sheets from the input video into the GCS bucket. For more information, see - # https://cloud.google.com/transcoder/docs/how-to/generate-spritesheet#generate_set_number_of_images. - sprite_sheets=[ - # Generate a 10x10 sprite sheet with 64x32px images. - transcoder_v1.types.SpriteSheet( - file_prefix="small-sprite-sheet", - sprite_width_pixels=64, - sprite_height_pixels=32, - column_count=10, - row_count=10, - total_count=100, - ), - # Generate a 10x10 sprite sheet with 128x72px images. - transcoder_v1.types.SpriteSheet( - file_prefix="large-sprite-sheet", - sprite_width_pixels=128, - sprite_height_pixels=72, - column_count=10, - row_count=10, - total_count=100, - ), - ], - ) - response = client.create_job(parent=parent, job=job) - print(f"Job: {response.name}") - return response - - -# [END transcoder_create_job_with_set_number_images_spritesheet] - -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 to start this job in.", - default="us-central1", - ) - parser.add_argument( - "--input_uri", - help="Uri of the video in the Cloud Storage bucket.", - required=True, - ) - parser.add_argument( - "--output_uri", - help="Uri of the video output folder in the Cloud Storage bucket. Must end in '/'.", - required=True, - ) - args = parser.parse_args() - create_job_with_set_number_images_spritesheet( - args.project_id, - args.location, - args.input_uri, - args.output_uri, - ) diff --git a/samples/snippets/create_job_with_standalone_captions.py b/samples/snippets/create_job_with_standalone_captions.py deleted file mode 100644 index 4524185..0000000 --- a/samples/snippets/create_job_with_standalone_captions.py +++ /dev/null @@ -1,222 +0,0 @@ -#!/usr/bin/env python - -# 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. -# 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 Transcoder sample for creating a job that can use subtitles from a standalone file. - -Example usage: - python create_job_with_standalone_captions.py --project_id --location \ - --input_video_uri --input_subtitles1_uri --input_subtitles2_uri --output_uri -""" - -# [START transcoder_create_job_with_standalone_captions] - -import argparse - -from google.cloud.video import transcoder_v1 -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) -from google.protobuf import duration_pb2 as duration - - -def create_job_with_standalone_captions( - project_id, - location, - input_video_uri, - input_subtitles1_uri, - input_subtitles2_uri, - output_uri, -): - """Creates a job based on an ad-hoc job configuration that can use subtitles from a standalone file. - - Args: - project_id (str): The GCP project ID. - location (str): The location to start the job in. - input_video_uri (str): Uri of the input video in the Cloud Storage - bucket. - input_subtitles1_uri (str): Uri of an input subtitles file in the Cloud - Storage bucket. - input_subtitles2_uri (str): Uri of an input subtitles file in the Cloud - Storage bucket. - output_uri (str): Uri of the video output folder in the Cloud Storage - bucket.""" - - client = TranscoderServiceClient() - - parent = f"projects/{project_id}/locations/{location}" - job = transcoder_v1.types.Job() - job.output_uri = output_uri - job.config = transcoder_v1.types.JobConfig( - inputs=[ - transcoder_v1.types.Input( - key="input0", - uri=input_video_uri, - ), - transcoder_v1.types.Input( - key="subtitle-input-en", - uri=input_subtitles1_uri, - ), - transcoder_v1.types.Input( - key="subtitle-input-es", - uri=input_subtitles2_uri, - ), - ], - edit_list=[ - transcoder_v1.types.EditAtom( - key="atom0", - inputs=["input0", "subtitle-input-en", "subtitle-input-es"], - ), - ], - elementary_streams=[ - transcoder_v1.types.ElementaryStream( - key="video-stream0", - video_stream=transcoder_v1.types.VideoStream( - h264=transcoder_v1.types.VideoStream.H264CodecSettings( - height_pixels=360, - width_pixels=640, - bitrate_bps=550000, - frame_rate=60, - ), - ), - ), - transcoder_v1.types.ElementaryStream( - key="audio-stream0", - audio_stream=transcoder_v1.types.AudioStream( - codec="aac", - bitrate_bps=64000, - ), - ), - transcoder_v1.types.ElementaryStream( - key="vtt-stream-en", - text_stream=transcoder_v1.types.TextStream( - codec="webvtt", - language_code="en-US", - display_name="English", - mapping_=[ - transcoder_v1.types.TextStream.TextMapping( - atom_key="atom0", - input_key="subtitle-input-en", - ), - ], - ), - ), - transcoder_v1.types.ElementaryStream( - key="vtt-stream-es", - text_stream=transcoder_v1.types.TextStream( - codec="webvtt", - language_code="es-ES", - display_name="Spanish", - mapping_=[ - transcoder_v1.types.TextStream.TextMapping( - atom_key="atom0", - input_key="subtitle-input-es", - ), - ], - ), - ), - ], - mux_streams=[ - transcoder_v1.types.MuxStream( - key="sd-hls-fmp4", - container="fmp4", - elementary_streams=["video-stream0"], - ), - transcoder_v1.types.MuxStream( - key="audio-hls-fmp4", - container="fmp4", - elementary_streams=["audio-stream0"], - ), - transcoder_v1.types.MuxStream( - key="text-vtt-en", - container="vtt", - elementary_streams=["vtt-stream-en"], - segment_settings=transcoder_v1.types.SegmentSettings( - segment_duration=duration.Duration( - seconds=6, - ), - individual_segments=True, - ), - ), - transcoder_v1.types.MuxStream( - key="text-vtt-es", - container="vtt", - elementary_streams=["vtt-stream-es"], - segment_settings=transcoder_v1.types.SegmentSettings( - segment_duration=duration.Duration( - seconds=6, - ), - individual_segments=True, - ), - ), - ], - manifests=[ - transcoder_v1.types.Manifest( - file_name="manifest.m3u8", - type_="HLS", - mux_streams=[ - "sd-hls-fmp4", - "audio-hls-fmp4", - "text-vtt-en", - "text-vtt-es", - ], - ), - ], - ) - response = client.create_job(parent=parent, job=job) - print(f"Job: {response.name}") - return response - - -# [END transcoder_create_job_with_standalone_captions] - -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 to start this job in.", - default="us-central1", - ) - parser.add_argument( - "--input_video_uri", - help="Uri of the input video in the Cloud Storage bucket.", - required=True, - ) - parser.add_argument( - "--input_subtitles1_uri", - help="Uri of an input subtitles file in the Cloud Storage bucket.", - required=True, - ) - parser.add_argument( - "--input_subtitles2_uri", - help="Uri of an input subtitles file in the Cloud Storage bucket.", - required=True, - ) - parser.add_argument( - "--output_uri", - help="Uri of the video output folder in the Cloud Storage bucket. " - + "Must end in '/'.", - required=True, - ) - args = parser.parse_args() - create_job_with_standalone_captions( - args.project_id, - args.location, - args.input_video_uri, - args.input_subtitles1_uri, - args.input_subtitles2_uri, - args.output_uri, - ) diff --git a/samples/snippets/create_job_with_static_overlay.py b/samples/snippets/create_job_with_static_overlay.py deleted file mode 100644 index 67839bb..0000000 --- a/samples/snippets/create_job_with_static_overlay.py +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/bin/env python - -# 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. - -"""Google Cloud Transcoder sample for creating a job based on a supplied job config that includes a static overlay. - -Example usage: - python create_job_with_static_overlay.py --project_id --location --input_uri --overlay_image_uri --output_uri -""" - -# [START transcoder_create_job_with_static_overlay] - -import argparse - -from google.cloud.video import transcoder_v1 -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) -from google.protobuf import duration_pb2 as duration - - -def create_job_with_static_overlay( - project_id, location, input_uri, overlay_image_uri, output_uri -): - """Creates a job based on an ad-hoc job configuration that includes a static image overlay. - - Args: - project_id: The GCP project ID. - location: The location to start the job in. - input_uri: Uri of the video in the Cloud Storage bucket. - overlay_image_uri: Uri of the image for the overlay in the Cloud Storage bucket. - output_uri: Uri of the video output folder in the Cloud Storage bucket.""" - - client = TranscoderServiceClient() - - parent = f"projects/{project_id}/locations/{location}" - job = transcoder_v1.types.Job() - job.input_uri = input_uri - job.output_uri = output_uri - job.config = transcoder_v1.types.JobConfig( - elementary_streams=[ - transcoder_v1.types.ElementaryStream( - key="video-stream0", - video_stream=transcoder_v1.types.VideoStream( - h264=transcoder_v1.types.VideoStream.H264CodecSettings( - height_pixels=360, - width_pixels=640, - bitrate_bps=550000, - frame_rate=60, - ), - ), - ), - transcoder_v1.types.ElementaryStream( - key="audio-stream0", - audio_stream=transcoder_v1.types.AudioStream( - codec="aac", bitrate_bps=64000 - ), - ), - ], - mux_streams=[ - transcoder_v1.types.MuxStream( - key="sd", - container="mp4", - elementary_streams=["video-stream0", "audio-stream0"], - ), - ], - overlays=[ - transcoder_v1.types.Overlay( - image=transcoder_v1.types.Overlay.Image( - uri=overlay_image_uri, - resolution=transcoder_v1.types.Overlay.NormalizedCoordinate( - x=1, - y=0.5, - ), - alpha=1, - ), - animations=[ - transcoder_v1.types.Overlay.Animation( - animation_static=transcoder_v1.types.Overlay.AnimationStatic( - xy=transcoder_v1.types.Overlay.NormalizedCoordinate( - x=0, - y=0, - ), - start_time_offset=duration.Duration( - seconds=0, - ), - ), - ), - transcoder_v1.types.Overlay.Animation( - animation_end=transcoder_v1.types.Overlay.AnimationEnd( - start_time_offset=duration.Duration( - seconds=10, - ), - ), - ), - ], - ), - ], - ) - response = client.create_job(parent=parent, job=job) - print(f"Job: {response.name}") - return response - - -# [END transcoder_create_job_with_static_overlay] - -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 to start this job in.", - default="us-central1", - ) - parser.add_argument( - "--input_uri", - help="Uri of the video in the Cloud Storage bucket.", - required=True, - ) - parser.add_argument( - "--overlay_image_uri", - help="Uri of the overlay image in the Cloud Storage bucket.", - required=True, - ) - parser.add_argument( - "--output_uri", - help="Uri of the video output folder in the Cloud Storage bucket. Must end in '/'.", - required=True, - ) - args = parser.parse_args() - create_job_with_static_overlay( - args.project_id, - args.location, - args.input_uri, - args.overlay_image_uri, - args.output_uri, - ) diff --git a/samples/snippets/delete_job.py b/samples/snippets/delete_job.py deleted file mode 100644 index 5f139f9..0000000 --- a/samples/snippets/delete_job.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2020 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 Transcoder sample for deleting a job. - -Example usage: - python delete_job.py --project_id --location --job_id -""" - -# [START transcoder_delete_job] - -import argparse - -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) - - -def delete_job(project_id, location, job_id): - """Gets a job. - - Args: - project_id: The GCP project ID. - location: The location this job is in. - job_id: The job ID.""" - - client = TranscoderServiceClient() - - name = f"projects/{project_id}/locations/{location}/jobs/{job_id}" - response = client.delete_job(name=name) - print("Deleted job") - return response - - -# [END transcoder_delete_job] - -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 job.", required=True) - parser.add_argument("--job_id", help="The job ID.", required=True) - args = parser.parse_args() - delete_job(args.project_id, args.location, args.job_id) diff --git a/samples/snippets/delete_job_template.py b/samples/snippets/delete_job_template.py deleted file mode 100644 index ccce70f..0000000 --- a/samples/snippets/delete_job_template.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2020 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 Transcoder sample for deleting a job template. - -Example usage: - python delete_job_template.py --project_id --location --template_id -""" - -# [START transcoder_delete_job_template] - -import argparse - -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) - - -def delete_job_template(project_id, location, template_id): - """Deletes a job template. - - Args: - project_id: The GCP project ID. - location: The location of the template. - template_id: The user-defined template ID.""" - - client = TranscoderServiceClient() - - name = f"projects/{project_id}/locations/{location}/jobTemplates/{template_id}" - response = client.delete_job_template(name=name) - print("Deleted job template") - return response - - -# [END transcoder_delete_job_template] - -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 template.", required=True - ) - parser.add_argument("--template_id", help="The job template ID.", required=True) - args = parser.parse_args() - delete_job_template(args.project_id, args.location, args.template_id) diff --git a/samples/snippets/get_job.py b/samples/snippets/get_job.py deleted file mode 100644 index ec5d7f1..0000000 --- a/samples/snippets/get_job.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2020 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 Transcoder sample for getting the details for a job. - -Example usage: - python get_job.py --project_id --location --job_id -""" - -# [START transcoder_get_job] - -import argparse - -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) - - -def get_job(project_id, location, job_id): - """Gets a job. - - Args: - project_id: The GCP project ID. - location: The location this job is in. - job_id: The job ID.""" - - client = TranscoderServiceClient() - - name = f"projects/{project_id}/locations/{location}/jobs/{job_id}" - response = client.get_job(name=name) - print(f"Job: {response.name}") - return response - - -# [END transcoder_get_job] - - -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 job.", required=True) - parser.add_argument("--job_id", help="The job ID.", required=True) - args = parser.parse_args() - get_job(args.project_id, args.location, args.job_id) diff --git a/samples/snippets/get_job_state.py b/samples/snippets/get_job_state.py deleted file mode 100644 index 6b73acf..0000000 --- a/samples/snippets/get_job_state.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2020 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 Transcoder sample for getting the state for a job. - -Example usage: - python get_job_state.py --project_id --location --job_id -""" - -# [START transcoder_get_job_state] - -import argparse - -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) - - -def get_job_state(project_id, location, job_id): - """Gets a job's state. - - Args: - project_id: The GCP project ID. - location: The location this job is in. - job_id: The job ID.""" - - client = TranscoderServiceClient() - - name = f"projects/{project_id}/locations/{location}/jobs/{job_id}" - response = client.get_job(name=name) - - print(f"Job state: {str(response.state)}") - return response - - -# [END transcoder_get_job_state] - - -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 job.", required=True) - parser.add_argument("--job_id", help="The job ID.", required=True) - args = parser.parse_args() - get_job_state(args.project_id, args.location, args.job_id) diff --git a/samples/snippets/get_job_template.py b/samples/snippets/get_job_template.py deleted file mode 100644 index 4d6ccf7..0000000 --- a/samples/snippets/get_job_template.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2020 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 Transcoder sample for getting a job template. - -Example usage: - python get_job_template.py --project_id --location --template_id -""" - -# [START transcoder_get_job_template] - -import argparse - -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) - - -def get_job_template(project_id, location, template_id): - """Gets a job template. - - Args: - project_id: The GCP project ID. - location: The location of the template. - template_id: The user-defined template ID.""" - - client = TranscoderServiceClient() - - name = f"projects/{project_id}/locations/{location}/jobTemplates/{template_id}" - response = client.get_job_template(name=name) - print(f"Job template: {response.name}") - return response - - -# [END transcoder_get_job_template] - -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 template.", required=True - ) - parser.add_argument("--template_id", help="The job template ID.", required=True) - args = parser.parse_args() - get_job_template(args.project_id, args.location, args.template_id) diff --git a/samples/snippets/job_template_test.py b/samples/snippets/job_template_test.py deleted file mode 100644 index 259595a..0000000 --- a/samples/snippets/job_template_test.py +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright 2020 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 create_job_template -import delete_job_template -import get_job_template -import list_job_templates - -location = "us-central1" -project_id = os.environ["GOOGLE_CLOUD_PROJECT"] -project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"] -template_id = f"my-python-test-template-{uuid.uuid4()}" - - -def test_template_operations(capsys): - - # Enable the following API on the test project: - # * Transcoder API - - job_template_name = ( - f"projects/{project_number}/locations/{location}/jobTemplates/{template_id}" - ) - - try: - delete_job_template.delete_job_template(project_id, location, template_id) - except NotFound as e: - print(f"Ignoring NotFound, details: {e}") - out, _ = capsys.readouterr() - - create_job_template.create_job_template(project_id, location, template_id) - out, _ = capsys.readouterr() - assert job_template_name in out - - get_job_template.get_job_template(project_id, location, template_id) - out, _ = capsys.readouterr() - assert job_template_name in out - - list_job_templates.list_job_templates(project_id, location) - out, _ = capsys.readouterr() - assert job_template_name in out - - delete_job_template.delete_job_template(project_id, location, template_id) - out, _ = capsys.readouterr() - assert "Deleted job template" in out diff --git a/samples/snippets/job_test.py b/samples/snippets/job_test.py deleted file mode 100644 index 6dbf8cd..0000000 --- a/samples/snippets/job_test.py +++ /dev/null @@ -1,520 +0,0 @@ -# Copyright 2020 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 time -import uuid - -import backoff -from google.cloud import storage -from googleapiclient.errors import HttpError -import pytest - -import create_job_from_ad_hoc -import create_job_from_preset -import create_job_from_template -import create_job_template -import create_job_with_animated_overlay -import create_job_with_concatenated_inputs -import create_job_with_embedded_captions -import create_job_with_periodic_images_spritesheet -import create_job_with_set_number_images_spritesheet -import create_job_with_standalone_captions -import create_job_with_static_overlay -import delete_job -import delete_job_template -import get_job -import get_job_state -import list_jobs - -location = "us-central1" -project_id = os.environ["GOOGLE_CLOUD_PROJECT"] -project_number = os.environ["GOOGLE_CLOUD_PROJECT_NUMBER"] -template_id = f"my-python-test-template-{uuid.uuid4()}" - -input_bucket_name = "cloud-samples-data/media/" -output_bucket_name = f"python-samples-transcoder-{uuid.uuid4()}" -test_video_file_name = "ChromeCast.mp4" -test_overlay_image_file_name = "overlay.jpg" -test_concat1_file_name = "ForBiggerEscapes.mp4" -test_concat2_file_name = "ForBiggerJoyrides.mp4" -test_captions_file_name = "captions.srt" -test_subtitles1_file_name = "subtitles-en.srt" -test_subtitles2_file_name = "subtitles-es.srt" - -input_uri = f"gs://{input_bucket_name}{test_video_file_name}" -overlay_image_uri = f"gs://{input_bucket_name}{test_overlay_image_file_name}" -concat1_uri = f"gs://{input_bucket_name}{test_concat1_file_name}" -concat2_uri = f"gs://{input_bucket_name}{test_concat2_file_name}" -captions_uri = f"gs://{input_bucket_name}{test_captions_file_name}" -subtitles1_uri = f"gs://{input_bucket_name}{test_subtitles1_file_name}" -subtitles2_uri = f"gs://{input_bucket_name}{test_subtitles2_file_name}" -output_uri_for_preset = f"gs://{output_bucket_name}/test-output-preset/" -output_uri_for_template = f"gs://{output_bucket_name}/test-output-template/" -output_uri_for_adhoc = f"gs://{output_bucket_name}/test-output-adhoc/" -output_uri_for_static_overlay = f"gs://{output_bucket_name}/test-output-static-overlay/" -output_uri_for_animated_overlay = ( - f"gs://{output_bucket_name}/test-output-animated-overlay/" -) -output_uri_for_embedded_captions = ( - f"gs://{output_bucket_name}/test-output-embedded-captions/" -) -output_uri_for_standalone_captions = ( - f"gs://{output_bucket_name}/test-output-standalone-captions/" -) - -small_spritesheet_file_prefix = "small-sprite-sheet" -large_spritesheet_file_prefix = "large-sprite-sheet" -spritesheet_file_suffix = "0000000000.jpeg" - -output_dir_for_set_number_spritesheet = "test-output-set-number-spritesheet/" -output_uri_for_set_number_spritesheet = ( - f"gs://{output_bucket_name}/{output_dir_for_set_number_spritesheet}" -) -output_dir_for_periodic_spritesheet = "test-output-periodic-spritesheet/" -output_uri_for_periodic_spritesheet = ( - f"gs://{output_bucket_name}/{output_dir_for_periodic_spritesheet}" -) -output_uri_for_concat = f"gs://{output_bucket_name}/test-output-concat/" - -preset = "preset/web-hd" -job_succeeded_state = "ProcessingState.SUCCEEDED" -job_running_state = "ProcessingState.RUNNING" - - -@pytest.fixture(scope="module") -def test_bucket(): - storage_client = storage.Client() - bucket = storage_client.create_bucket(output_bucket_name) - - yield bucket - bucket.delete(force=True) - - -def test_create_job_from_preset(capsys, test_bucket): - create_job_from_preset.create_job_from_preset( - project_id, location, input_uri, output_uri_for_preset, preset - ) - out, _ = capsys.readouterr() - job_name_prefix = f"projects/{project_number}/locations/{location}/jobs/" - assert job_name_prefix in out - - str_slice = out.split("/") - job_id = str_slice[len(str_slice) - 1].rstrip("\n") - job_name = f"projects/{project_number}/locations/{location}/jobs/{job_id}" - assert job_name in out - - get_job.get_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert job_name in out - - time.sleep(30) - - _assert_job_state_succeeded_or_running(capsys, job_id) - - list_jobs.list_jobs(project_id, location) - out, _ = capsys.readouterr() - assert job_name in out - - delete_job.delete_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert "Deleted job" in out - - -def test_create_job_from_template(capsys, test_bucket): - - job_template_name = ( - f"projects/{project_number}/locations/{location}/jobTemplates/{template_id}" - ) - - create_job_template.create_job_template(project_id, location, template_id) - out, _ = capsys.readouterr() - assert job_template_name in out - - create_job_from_template.create_job_from_template( - project_id, location, input_uri, output_uri_for_template, template_id - ) - out, _ = capsys.readouterr() - job_name_prefix = f"projects/{project_number}/locations/{location}/jobs/" - assert job_name_prefix in out - - str_slice = out.split("/") - job_id = str_slice[len(str_slice) - 1].rstrip("\n") - job_name = f"projects/{project_number}/locations/{location}/jobs/{job_id}" - assert job_name in out - - get_job.get_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert job_name in out - - time.sleep(30) - - _assert_job_state_succeeded_or_running(capsys, job_id) - - list_jobs.list_jobs(project_id, location) - out, _ = capsys.readouterr() - assert job_name in out - - delete_job.delete_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert "Deleted job" in out - - delete_job_template.delete_job_template(project_id, location, template_id) - out, _ = capsys.readouterr() - assert "Deleted job template" in out - - -def test_create_job_from_ad_hoc(capsys, test_bucket): - create_job_from_ad_hoc.create_job_from_ad_hoc( - project_id, location, input_uri, output_uri_for_adhoc - ) - out, _ = capsys.readouterr() - job_name_prefix = f"projects/{project_number}/locations/{location}/jobs/" - assert job_name_prefix in out - - str_slice = out.split("/") - job_id = str_slice[len(str_slice) - 1].rstrip("\n") - job_name = f"projects/{project_number}/locations/{location}/jobs/{job_id}" - assert job_name in out - - get_job.get_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert job_name in out - - time.sleep(30) - - _assert_job_state_succeeded_or_running(capsys, job_id) - - list_jobs.list_jobs(project_id, location) - out, _ = capsys.readouterr() - assert job_name in out - - delete_job.delete_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert "Deleted job" in out - - -def test_create_job_with_static_overlay(capsys, test_bucket): - create_job_with_static_overlay.create_job_with_static_overlay( - project_id, - location, - input_uri, - overlay_image_uri, - output_uri_for_static_overlay, - ) - out, _ = capsys.readouterr() - job_name_prefix = f"projects/{project_number}/locations/{location}/jobs/" - assert job_name_prefix in out - - str_slice = out.split("/") - job_id = str_slice[len(str_slice) - 1].rstrip("\n") - job_name = f"projects/{project_number}/locations/{location}/jobs/{job_id}" - assert job_name in out - - get_job.get_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert job_name in out - - time.sleep(30) - - _assert_job_state_succeeded(capsys, job_id) - - list_jobs.list_jobs(project_id, location) - out, _ = capsys.readouterr() - assert job_name in out - - delete_job.delete_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert "Deleted job" in out - - -def test_create_job_with_animated_overlay(capsys, test_bucket): - create_job_with_animated_overlay.create_job_with_animated_overlay( - project_id, - location, - input_uri, - overlay_image_uri, - output_uri_for_animated_overlay, - ) - out, _ = capsys.readouterr() - job_name_prefix = f"projects/{project_number}/locations/{location}/jobs/" - assert job_name_prefix in out - - str_slice = out.split("/") - job_id = str_slice[len(str_slice) - 1].rstrip("\n") - job_name = f"projects/{project_number}/locations/{location}/jobs/{job_id}" - assert job_name in out - - get_job.get_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert job_name in out - - time.sleep(30) - - _assert_job_state_succeeded(capsys, job_id) - - list_jobs.list_jobs(project_id, location) - out, _ = capsys.readouterr() - assert job_name in out - - delete_job.delete_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert "Deleted job" in out - - -def test_create_job_with_set_number_spritesheet(capsys, test_bucket): - create_job_with_set_number_images_spritesheet.create_job_with_set_number_images_spritesheet( - project_id, - location, - input_uri, - output_uri_for_set_number_spritesheet, - ) - out, _ = capsys.readouterr() - job_name_prefix = f"projects/{project_number}/locations/{location}/jobs/" - assert job_name_prefix in out - - str_slice = out.split("/") - job_id = str_slice[len(str_slice) - 1].rstrip("\n") - job_name = f"projects/{project_number}/locations/{location}/jobs/{job_id}" - assert job_name in out - - get_job.get_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert ( - job_name in out - ) # Get the job name so you can use it later to get the job and delete the job. - - time.sleep( - 30 - ) # Transcoding jobs need time to complete. Once the job completes, check the job state. - - _assert_job_state_succeeded(capsys, job_id) - _assert_file_in_bucket( - capsys, - test_bucket, - output_dir_for_set_number_spritesheet - + small_spritesheet_file_prefix - + spritesheet_file_suffix, - ) - _assert_file_in_bucket( - capsys, - test_bucket, - output_dir_for_set_number_spritesheet - + large_spritesheet_file_prefix - + spritesheet_file_suffix, - ) - - list_jobs.list_jobs(project_id, location) - out, _ = capsys.readouterr() - assert job_name in out - - delete_job.delete_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert "Deleted job" in out - - -def test_create_job_with_periodic_spritesheet(capsys, test_bucket): - create_job_with_periodic_images_spritesheet.create_job_with_periodic_images_spritesheet( - project_id, - location, - input_uri, - output_uri_for_periodic_spritesheet, - ) - out, _ = capsys.readouterr() - job_name_prefix = f"projects/{project_number}/locations/{location}/jobs/" - assert job_name_prefix in out - - str_slice = out.split("/") - job_id = str_slice[len(str_slice) - 1].rstrip("\n") - job_name = f"projects/{project_number}/locations/{location}/jobs/{job_id}" - assert job_name in out - - get_job.get_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert ( - job_name in out - ) # Get the job name so you can use it later to get the job and delete the job. - - time.sleep( - 30 - ) # Transcoding jobs need time to complete. Once the job completes, check the job state. - - _assert_job_state_succeeded(capsys, job_id) - _assert_file_in_bucket( - capsys, - test_bucket, - output_dir_for_periodic_spritesheet - + small_spritesheet_file_prefix - + spritesheet_file_suffix, - ) - _assert_file_in_bucket( - capsys, - test_bucket, - output_dir_for_periodic_spritesheet - + large_spritesheet_file_prefix - + spritesheet_file_suffix, - ) - - list_jobs.list_jobs(project_id, location) - out, _ = capsys.readouterr() - assert job_name in out - - delete_job.delete_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert "Deleted job" in out - - -def test_create_job_with_concatenated_inputs(capsys, test_bucket): - create_job_with_concatenated_inputs.create_job_with_concatenated_inputs( - project_id, - location, - concat1_uri, - "0s", - "8.1s", - concat2_uri, - "3.5s", - "15s", - output_uri_for_concat, - ) - out, _ = capsys.readouterr() - job_name_prefix = f"projects/{project_number}/locations/{location}/jobs/" - assert job_name_prefix in out - - str_slice = out.split("/") - job_id = str_slice[len(str_slice) - 1].rstrip("\n") - job_name = f"projects/{project_number}/locations/{location}/jobs/{job_id}" - assert job_name in out - - get_job.get_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert job_name in out - - time.sleep( - 30 - ) # Transcoding jobs need time to complete. Once the job completes, check the job state. - - _assert_job_state_succeeded(capsys, job_id) - - list_jobs.list_jobs(project_id, location) - out, _ = capsys.readouterr() - assert job_name in out - - delete_job.delete_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert "Deleted job" in out - - -def test_create_job_with_embedded_captions(capsys, test_bucket): - create_job_with_embedded_captions.create_job_with_embedded_captions( - project_id, - location, - input_uri, - captions_uri, - output_uri_for_embedded_captions, - ) - out, _ = capsys.readouterr() - job_name_prefix = f"projects/{project_number}/locations/{location}/jobs/" - assert job_name_prefix in out - - str_slice = out.split("/") - job_id = str_slice[len(str_slice) - 1].rstrip("\n") - job_name = f"projects/{project_number}/locations/{location}/jobs/{job_id}" - assert job_name in out - - get_job.get_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert job_name in out - - time.sleep( - 30 - ) # Transcoding jobs need time to complete. Once the job completes, check the job state. - - _assert_job_state_succeeded(capsys, job_id) - - list_jobs.list_jobs(project_id, location) - out, _ = capsys.readouterr() - assert job_name in out - - delete_job.delete_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert "Deleted job" in out - - -def test_create_job_with_standalone_captions(capsys, test_bucket): - create_job_with_standalone_captions.create_job_with_standalone_captions( - project_id, - location, - input_uri, - subtitles1_uri, - subtitles2_uri, - output_uri_for_standalone_captions, - ) - out, _ = capsys.readouterr() - job_name_prefix = f"projects/{project_number}/locations/{location}/jobs/" - assert job_name_prefix in out - - str_slice = out.split("/") - job_id = str_slice[len(str_slice) - 1].rstrip("\n") - job_name = f"projects/{project_number}/locations/{location}/jobs/{job_id}" - assert job_name in out - - get_job.get_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert job_name in out - - time.sleep( - 30 - ) # Transcoding jobs need time to complete. Once the job completes, check the job state. - - _assert_job_state_succeeded(capsys, job_id) - - list_jobs.list_jobs(project_id, location) - out, _ = capsys.readouterr() - assert job_name in out - - delete_job.delete_job(project_id, location, job_id) - out, _ = capsys.readouterr() - assert "Deleted job" in out - - -# Retrying up to 10 mins. This function checks if the job completed -# successfully. -@backoff.on_exception(backoff.expo, AssertionError, max_time=600) -def _assert_job_state_succeeded(capsys, job_id): - try: - get_job_state.get_job_state(project_id, location, job_id) - except HttpError as err: - raise AssertionError(f"Could not get job state: {err.resp.status}") - - out, _ = capsys.readouterr() - assert job_succeeded_state in out - - -# Retrying up to 10 mins. This function checks if the job is running or has -# completed. Both of these conditions signal the API is functioning. The test -# can list or delete a job that is running or completed with no ill effects. -@backoff.on_exception(backoff.expo, AssertionError, max_time=600) -def _assert_job_state_succeeded_or_running(capsys, job_id): - try: - get_job_state.get_job_state(project_id, location, job_id) - except HttpError as err: - raise AssertionError(f"Could not get job state: {err.resp.status}") - - out, _ = capsys.readouterr() - assert (job_succeeded_state in out) or (job_running_state in out) - - -def _assert_file_in_bucket(capsys, test_bucket, directory_and_filename): - blob = test_bucket.blob(directory_and_filename) - assert blob.exists() diff --git a/samples/snippets/list_job_templates.py b/samples/snippets/list_job_templates.py deleted file mode 100644 index 020f7a3..0000000 --- a/samples/snippets/list_job_templates.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2020 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 Transcoder sample for listing job templates in a location. - -Example usage: - python list_job_templates.py --project_id --location -""" - -# [START transcoder_list_job_templates] - -import argparse - -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) - - -def list_job_templates(project_id, location): - """Lists all job templates in a location. - - Args: - project_id: The GCP project ID. - location: The location of the templates.""" - - client = TranscoderServiceClient() - - parent = f"projects/{project_id}/locations/{location}" - response = client.list_job_templates(parent=parent) - print("Job templates:") - for jobTemplate in response.job_templates: - print({jobTemplate.name}) - - return response - - -# [END transcoder_list_job_templates] - -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 templates.", required=True - ) - args = parser.parse_args() - list_job_templates(args.project_id, args.location) diff --git a/samples/snippets/list_jobs.py b/samples/snippets/list_jobs.py deleted file mode 100644 index cf1fdbd..0000000 --- a/samples/snippets/list_jobs.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2020 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 Transcoder sample for listing jobs in a location. - -Example usage: - python list_jobs.py --project_id --location -""" - -# [START transcoder_list_jobs] - -import argparse - -from google.cloud.video.transcoder_v1.services.transcoder_service import ( - TranscoderServiceClient, -) - - -def list_jobs(project_id, location): - """Lists all jobs in a location. - - Args: - project_id: The GCP project ID. - location: The location of the jobs.""" - - client = TranscoderServiceClient() - - parent = f"projects/{project_id}/locations/{location}" - response = client.list_jobs(parent=parent) - print("Jobs:") - for job in response.jobs: - print({job.name}) - - return response - - -# [END transcoder_list_jobs] - -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 jobs.", required=True) - args = parser.parse_args() - list_jobs(args.project_id, args.location) diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py deleted file mode 100644 index de104db..0000000 --- a/samples/snippets/noxfile.py +++ /dev/null @@ -1,292 +0,0 @@ -# Copyright 2019 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 __future__ import print_function - -import glob -import os -from pathlib import Path -import sys -from typing import Callable, Dict, Optional - -import nox - -# WARNING - WARNING - WARNING - WARNING - WARNING -# WARNING - WARNING - WARNING - WARNING - WARNING -# DO NOT EDIT THIS FILE EVER! -# WARNING - WARNING - WARNING - WARNING - WARNING -# WARNING - WARNING - WARNING - WARNING - WARNING - -BLACK_VERSION = "black==22.3.0" -ISORT_VERSION = "isort==5.10.1" - -# Copy `noxfile_config.py` to your directory and modify it instead. - -# `TEST_CONFIG` dict is a configuration hook that allows users to -# modify the test configurations. The values here should be in sync -# with `noxfile_config.py`. Users will copy `noxfile_config.py` into -# their directory and modify it. - -TEST_CONFIG = { - # 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": False, - # 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': 'BUILD_SPECIFIC_GCLOUD_PROJECT', - # If you need to use a specific version of pip, - # change pip_version_override to the string representation - # of the version number, for example, "20.2.4" - "pip_version_override": None, - # A dictionary you want to inject into your test. Don't put any - # secrets here. These values will override predefined values. - "envs": {}, -} - - -try: - # Ensure we can import noxfile_config in the project's directory. - sys.path.append(".") - from noxfile_config import TEST_CONFIG_OVERRIDE -except ImportError as e: - print("No user noxfile_config found: detail: {}".format(e)) - TEST_CONFIG_OVERRIDE = {} - -# Update the TEST_CONFIG with the user supplied values. -TEST_CONFIG.update(TEST_CONFIG_OVERRIDE) - - -def get_pytest_env_vars() -> Dict[str, str]: - """Returns a dict for pytest invocation.""" - ret = {} - - # Override the GCLOUD_PROJECT and the alias. - env_key = TEST_CONFIG["gcloud_project_env"] - # This should error out if not set. - ret["GOOGLE_CLOUD_PROJECT"] = os.environ[env_key] - - # Apply user supplied envs. - ret.update(TEST_CONFIG["envs"]) - return ret - - -# DO NOT EDIT - automatically generated. -# All versions used to test samples. -ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"] - -# Any default versions that should be ignored. -IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"] - -TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS]) - -INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ( - "True", - "true", -) - -# Error if a python version is missing -nox.options.error_on_missing_interpreters = True - -# -# Style Checks -# - - -# Linting with flake8. -# -# We ignore the following rules: -# E203: whitespace before ‘:’ -# E266: too many leading ‘#’ for block comment -# E501: line too long -# I202: Additional newline in a section of imports -# -# We also need to specify the rules which are ignored by default: -# ['E226', 'W504', 'E126', 'E123', 'W503', 'E24', 'E704', 'E121'] -FLAKE8_COMMON_ARGS = [ - "--show-source", - "--builtin=gettext", - "--max-complexity=20", - "--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py", - "--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202", - "--max-line-length=88", -] - - -@nox.session -def lint(session: nox.sessions.Session) -> None: - if not TEST_CONFIG["enforce_type_hints"]: - session.install("flake8") - else: - session.install("flake8", "flake8-annotations") - - args = FLAKE8_COMMON_ARGS + [ - ".", - ] - session.run("flake8", *args) - - -# -# Black -# - - -@nox.session -def blacken(session: nox.sessions.Session) -> None: - """Run black. Format code to uniform standard.""" - session.install(BLACK_VERSION) - python_files = [path for path in os.listdir(".") if path.endswith(".py")] - - session.run("black", *python_files) - - -# -# format = isort + black -# - - -@nox.session -def format(session: nox.sessions.Session) -> None: - """ - Run isort to sort imports. Then run black - to format code to uniform standard. - """ - session.install(BLACK_VERSION, ISORT_VERSION) - python_files = [path for path in os.listdir(".") if path.endswith(".py")] - - # Use the --fss option to sort imports using strict alphabetical order. - # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections - session.run("isort", "--fss", *python_files) - session.run("black", *python_files) - - -# -# Sample Tests -# - - -PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"] - - -def _session_tests( - session: nox.sessions.Session, post_install: Callable = None -) -> None: - # check for presence of tests - test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob( - "**/test_*.py", recursive=True - ) - test_list.extend(glob.glob("**/tests", recursive=True)) - - if len(test_list) == 0: - print("No tests found, skipping directory.") - return - - if TEST_CONFIG["pip_version_override"]: - pip_version = TEST_CONFIG["pip_version_override"] - session.install(f"pip=={pip_version}") - """Runs py.test for a particular project.""" - concurrent_args = [] - if os.path.exists("requirements.txt"): - if os.path.exists("constraints.txt"): - session.install("-r", "requirements.txt", "-c", "constraints.txt") - else: - session.install("-r", "requirements.txt") - with open("requirements.txt") as rfile: - packages = rfile.read() - - if os.path.exists("requirements-test.txt"): - if os.path.exists("constraints-test.txt"): - session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt") - else: - session.install("-r", "requirements-test.txt") - with open("requirements-test.txt") as rtfile: - packages += rtfile.read() - - if INSTALL_LIBRARY_FROM_SOURCE: - session.install("-e", _get_repo_root()) - - if post_install: - post_install(session) - - if "pytest-parallel" in packages: - concurrent_args.extend(["--workers", "auto", "--tests-per-worker", "auto"]) - elif "pytest-xdist" in packages: - concurrent_args.extend(["-n", "auto"]) - - session.run( - "pytest", - *(PYTEST_COMMON_ARGS + session.posargs + concurrent_args), - # Pytest will return 5 when no tests are collected. This can happen - # on travis where slow and flaky tests are excluded. - # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html - success_codes=[0, 5], - env=get_pytest_env_vars(), - ) - - -@nox.session(python=ALL_VERSIONS) -def py(session: nox.sessions.Session) -> None: - """Runs py.test for a sample using the specified version of Python.""" - if session.python in TESTED_VERSIONS: - _session_tests(session) - else: - session.skip( - "SKIPPED: {} tests are disabled for this sample.".format(session.python) - ) - - -# -# Readmegen -# - - -def _get_repo_root() -> Optional[str]: - """Returns the root folder of the project.""" - # Get root of this repository. Assume we don't have directories nested deeper than 10 items. - p = Path(os.getcwd()) - for i in range(10): - if p is None: - break - if Path(p / ".git").exists(): - return str(p) - # .git is not available in repos cloned via Cloud Build - # setup.py is always in the library's root, so use that instead - # https://github.com/googleapis/synthtool/issues/792 - if Path(p / "setup.py").exists(): - return str(p) - p = p.parent - raise Exception("Unable to detect repository root.") - - -GENERATED_READMES = sorted([x for x in Path(".").rglob("*.rst.in")]) - - -@nox.session -@nox.parametrize("path", GENERATED_READMES) -def readmegen(session: nox.sessions.Session, path: str) -> None: - """(Re-)generates the readme for a sample.""" - session.install("jinja2", "pyyaml") - dir_ = os.path.dirname(path) - - if os.path.exists(os.path.join(dir_, "requirements.txt")): - session.install("-r", os.path.join(dir_, "requirements.txt")) - - in_file = os.path.join(dir_, "README.rst.in") - session.run( - "python", _get_repo_root() + "/scripts/readme-gen/readme_gen.py", in_file - ) diff --git a/samples/snippets/requirements-test.txt b/samples/snippets/requirements-test.txt deleted file mode 100644 index bd5d1b5..0000000 --- a/samples/snippets/requirements-test.txt +++ /dev/null @@ -1,3 +0,0 @@ -backoff==2.2.1 -google-cloud-storage==2.10.0 -pytest==7.4.0 diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt deleted file mode 100644 index 51c11b3..0000000 --- a/samples/snippets/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -google-api-python-client==2.96.0 -grpcio==1.57.0 -google-cloud-video-transcoder==1.10.0 From daca59a546e4a95383ef0ab0ad01517ba43088b9 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 20 Sep 2023 10:38:33 -0400 Subject: [PATCH 14/14] chore(main): release 1.10.1 (#334) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ google/cloud/video/transcoder/gapic_version.py | 2 +- google/cloud/video/transcoder_v1/gapic_version.py | 2 +- ...snippet_metadata_google.cloud.video.transcoder.v1.json | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d9246dd..211ac9a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.10.0" + ".": "1.10.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 0602ccd..81dc826 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [1.10.1](https://github.com/googleapis/python-video-transcoder/compare/v1.10.0...v1.10.1) (2023-09-18) + + +### Documentation + +* Minor formatting ([180aca1](https://github.com/googleapis/python-video-transcoder/commit/180aca14aca091cb5705451e164f2b9466481ea2)) +* Remove migrated samples ([#333](https://github.com/googleapis/python-video-transcoder/issues/333)) ([27b99fb](https://github.com/googleapis/python-video-transcoder/commit/27b99fb757e206f13062ca69c3b752d256351397)) + ## [1.10.0](https://github.com/googleapis/python-video-transcoder/compare/v1.9.1...v1.10.0) (2023-07-11) diff --git a/google/cloud/video/transcoder/gapic_version.py b/google/cloud/video/transcoder/gapic_version.py index 7ce1917..6f9b28f 100644 --- a/google/cloud/video/transcoder/gapic_version.py +++ b/google/cloud/video/transcoder/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.10.0" # {x-release-please-version} +__version__ = "1.10.1" # {x-release-please-version} diff --git a/google/cloud/video/transcoder_v1/gapic_version.py b/google/cloud/video/transcoder_v1/gapic_version.py index 7ce1917..6f9b28f 100644 --- a/google/cloud/video/transcoder_v1/gapic_version.py +++ b/google/cloud/video/transcoder_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.10.0" # {x-release-please-version} +__version__ = "1.10.1" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.cloud.video.transcoder.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.video.transcoder.v1.json index 2c7572e..688c534 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.video.transcoder.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.video.transcoder.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-video-transcoder", - "version": "0.1.0" + "version": "1.10.1" }, "snippets": [ { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy