Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

fix: update min dependencies and use repo-tools to generate README #236

Merged
merged 1 commit into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .repo-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "video",
"name_pretty": "Google Cloud Video Intelligence API",
"product_documentation": "https://cloud.google.com/video-intelligence",
"client_documentation": "https://cloud.google.com/nodejs/docs/reference/video-intelligence/latest/",
"issue_tracker": "https://issuetracker.google.com/savedsearches/5084810",
"release_level": "ga",
"language": "nodejs",
"repo": "googleapis/nodejs-video-intelligence",
"distribution_name": "@google-cloud/video-intelligence",
"api_id": "videointelligence.googleapis.com",
"requires_billing": true
}
173 changes: 87 additions & 86 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
[//]: # "To regenerate it, use `python -m synthtool`."
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>

# [Google Cloud Video Intelligence API: Node.js Client](https://github.com/googleapis/nodejs-video-intelligence)

[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style&#x3D;flat)](https://cloud.google.com/terms/launch-stages)
[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages)
[![npm version](https://img.shields.io/npm/v/@google-cloud/video-intelligence.svg)](https://www.npmjs.org/package/@google-cloud/video-intelligence)
[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-video-intelligence/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-video-intelligence)

> Node.js idiomatic client for [Video Intelligence API][product-docs].

The [Cloud Video Intelligence API](https://cloud.google.com/video-intelligence) allows developers to use Google video analysis technology as part of their applications.


* [Video Intelligence API Node.js Client API Reference][client-docs]
Google Cloud Video Intelligence API client for Node.js


* [Google Cloud Video Intelligence API Node.js Client API Reference][client-docs]
* [Google Cloud Video Intelligence API Documentation][product-docs]
* [github.com/googleapis/nodejs-video-intelligence](https://github.com/googleapis/nodejs-video-intelligence)
* [Video Intelligence API Documentation][product-docs]

Read more about the client libraries for Cloud APIs, including the older
Google APIs Client Libraries, in [Client Libraries Explained][explained].
Expand All @@ -22,6 +25,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].

**Table of contents:**


* [Quickstart](#quickstart)
* [Before you begin](#before-you-begin)
* [Installing the client library](#installing-the-client-library)
Expand All @@ -35,118 +39,112 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].

### Before you begin

1. Select or create a Cloud Platform project.

[Go to the projects page][projects]

1. Enable billing for your project.

[Enable billing][billing]

1. Enable the Google Cloud Video Intelligence API API.

[Enable the API][enable_api]

1. [Select or create a Cloud Platform project][projects].
1. [Enable billing for your project][billing].
1. [Enable the Google Cloud Video Intelligence API API][enable_api].
1. [Set up authentication with a service account][auth] so you can access the
API from your local workstation.

[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=videointelligence.googleapis.com
[auth]: https://cloud.google.com/docs/authentication/getting-started

### Installing the client library

npm install --save @google-cloud/video-intelligence
```bash
npm install @google-cloud/video-intelligence
```


### Using the client library

```javascript
// Imports the Google Cloud Video Intelligence library
const videoIntelligence = require('@google-cloud/video-intelligence');

// Creates a client
const client = new videoIntelligence.VideoIntelligenceServiceClient();

// The GCS uri of the video to analyze
const gcsUri = 'gs://nodejs-docs-samples-video/quickstart_short.mp4';

// Construct request
const request = {
inputUri: gcsUri,
features: ['LABEL_DETECTION'],
};

// Execute request
client
.annotateVideo(request)
.then(results => {
const operation = results[0];
console.log(
'Waiting for operation to complete... (this may take a few minutes)'
);
return operation.promise();
})
.then(results => {
// Gets annotations for video
const annotations = results[0].annotationResults[0];

// Gets labels for video from its annotations
const labels = annotations.segmentLabelAnnotations;
labels.forEach(label => {
console.log(`Label ${label.entity.description} occurs at:`);
label.segments.forEach(segment => {
segment = segment.segment;
if (segment.startTimeOffset.seconds === undefined) {
segment.startTimeOffset.seconds = 0;
}
if (segment.startTimeOffset.nanos === undefined) {
segment.startTimeOffset.nanos = 0;
}
if (segment.endTimeOffset.seconds === undefined) {
segment.endTimeOffset.seconds = 0;
}
if (segment.endTimeOffset.nanos === undefined) {
segment.endTimeOffset.nanos = 0;
}
console.log(
`\tStart: ${segment.startTimeOffset.seconds}` +
`.${(segment.startTimeOffset.nanos / 1e6).toFixed(0)}s`
);
console.log(
`\tEnd: ${segment.endTimeOffset.seconds}.` +
`${(segment.endTimeOffset.nanos / 1e6).toFixed(0)}s`
);
});
// Imports the Google Cloud Video Intelligence library
const videoIntelligence = require('@google-cloud/video-intelligence');

// Creates a client
const client = new videoIntelligence.VideoIntelligenceServiceClient();

// The GCS uri of the video to analyze
const gcsUri = 'gs://nodejs-docs-samples-video/quickstart_short.mp4';

// Construct request
const request = {
inputUri: gcsUri,
features: ['LABEL_DETECTION'],
};

// Execute request
const [operation] = await client.annotateVideo(request);

console.log(
'Waiting for operation to complete... (this may take a few minutes)'
);

const [operationResult] = await operation.promise();

// Gets annotations for video
const annotations = operationResult.annotationResults[0];

// Gets labels for video from its annotations
const labels = annotations.segmentLabelAnnotations;
labels.forEach(label => {
console.log(`Label ${label.entity.description} occurs at:`);
label.segments.forEach(segment => {
segment = segment.segment;
if (segment.startTimeOffset.seconds === undefined) {
segment.startTimeOffset.seconds = 0;
}
if (segment.startTimeOffset.nanos === undefined) {
segment.startTimeOffset.nanos = 0;
}
if (segment.endTimeOffset.seconds === undefined) {
segment.endTimeOffset.seconds = 0;
}
if (segment.endTimeOffset.nanos === undefined) {
segment.endTimeOffset.nanos = 0;
}
console.log(
`\tStart: ${segment.startTimeOffset.seconds}` +
`.${(segment.startTimeOffset.nanos / 1e6).toFixed(0)}s`
);
console.log(
`\tEnd: ${segment.endTimeOffset.seconds}.` +
`${(segment.endTimeOffset.nanos / 1e6).toFixed(0)}s`
);
});
})
.catch(err => {
console.error('ERROR:', err);
});

```



## Samples

Samples are in the [`samples/`](https://github.com/googleapis/nodejs-video-intelligence/tree/master/samples) directory. The samples' `README.md`
has instructions for running the samples.

| Sample | Source Code | Try it |
| --------------------------- | --------------------------------- | ------ |
| Video Intelligence | [source code](https://github.com/googleapis/nodejs-video-intelligence/blob/master/samples/analyze.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-video-intelligence&page=editor&open_in_editor=samples/analyze.js,samples/README.md) |
| Analyze | [source code](https://github.com/googleapis/nodejs-video-intelligence/blob/master/samples/analyze.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-video-intelligence&page=editor&open_in_editor=samples/analyze.js,samples/README.md) |
| Quickstart | [source code](https://github.com/googleapis/nodejs-video-intelligence/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-video-intelligence&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |


The [Video Intelligence API Node.js Client API Reference][client-docs] documentation

The [Google Cloud Video Intelligence API Node.js Client API Reference][client-docs] documentation
also contains samples.

## Versioning

This library follows [Semantic Versioning](http://semver.org/).


This library is considered to be **General Availability (GA)**. This means it
is stable; the code surface will not change in backwards-incompatible ways
unless absolutely necessary (e.g. because of critical security issues) or with
an extensive deprecation period. Issues and requests against **GA** libraries
are addressed with the highest priority.





More Information: [Google Cloud Platform Launch Stages][launch_stages]

[launch_stages]: https://cloud.google.com/terms/launch-stages
Expand All @@ -163,5 +161,8 @@ See [LICENSE](https://github.com/googleapis/nodejs-video-intelligence/blob/maste

[client-docs]: https://cloud.google.com/nodejs/docs/reference/video-intelligence/latest/
[product-docs]: https://cloud.google.com/video-intelligence
[shell_img]: //gstatic.com/cloudssh/images/open-btn.png

[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=videointelligence.googleapis.com
[auth]: https://cloud.google.com/docs/authentication/getting-started
28 changes: 13 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"scripts": {
"cover": "nyc --reporter=lcov mocha test/*.js && nyc report",
"docs": "jsdoc -c .jsdoc.js",
"generate-scaffolding": "repo-tools generate all && repo-tools generate lib_samples_readme -l samples/ --config ../.cloud-repo-tools.json",
"lint": "eslint '**/*.js'",
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"system-test": "mocha system-test/*.js --timeout 600000",
Expand All @@ -44,23 +43,22 @@
"dependencies": {
"google-gax": "^1.0.0",
"lodash.merge": "^4.6.1",
"protobufjs": "^6.8.6"
"protobufjs": "^6.8.8"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.0.0",
"codecov": "^3.0.2",
"eslint": "^5.0.0",
"eslint-config-prettier": "^4.0.0",
"eslint-plugin-node": "^9.0.0",
"eslint-plugin-prettier": "^3.0.0",
"codecov": "^3.4.0",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.2.0",
"eslint-plugin-node": "^9.0.1",
"eslint-plugin-prettier": "^3.1.0",
"intelli-espower-loader": "^1.0.1",
"jsdoc": "^3.5.5",
"jsdoc": "^3.6.2",
"jsdoc-baseline": "git+https://github.com/hegemonic/jsdoc-baseline.git",
"linkinator": "^1.1.2",
"mocha": "^6.0.0",
"nyc": "^14.0.0",
"power-assert": "^1.6.0",
"prettier": "^1.13.5",
"through2": "^3.0.0"
"linkinator": "^1.4.2",
"mocha": "^6.1.4",
"nyc": "^14.1.1",
"power-assert": "^1.6.1",
"prettier": "^1.17.1",
"through2": "^3.0.1"
}
}
Loading