Skip to content

Commit 7fb3ad7

Browse files
feat!: drop node8, remove eslint, update gax, fix generated protos, run the generator (#423)
1 parent 27e256d commit 7fb3ad7

19 files changed

+57
-55
lines changed

video-intelligence/analyze-streaming-annotation-to-storage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async function main(path = 'YOUR_LOCAL_FILE', outputUri = 'PATH_TO_OUTPUT') {
5252
};
5353
chunks.push(request);
5454
})
55-
.on('close', function() {
55+
.on('close', () => {
5656
// configRequest should be the first in the stream of requests
5757
stream.write(configRequest);
5858
for (let i = 0; i < chunks.length; i++) {

video-intelligence/analyze-streaming-automl-classification.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async function main(
6262
};
6363
chunks.push(request);
6464
})
65-
.on('close', function() {
65+
.on('close', () => {
6666
// configRequest should be the first in the stream of requests
6767
stream.write(configRequest);
6868
for (let i = 0; i < chunks.length; i++) {

video-intelligence/analyze-streaming-labels.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async function main(path = 'YOUR_LOCAL_FILE') {
4646
};
4747
chunks.push(request);
4848
})
49-
.on('close', function() {
49+
.on('close', () => {
5050
// configRequest should be the first in the stream of requests
5151
stream.write(configRequest);
5252
for (let i = 0; i < chunks.length; i++) {

video-intelligence/analyze-streaming-object.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async function main(path = 'YOUR_LOCAL_FILE') {
4646
};
4747
chunks.push(request);
4848
})
49-
.on('close', function() {
49+
.on('close', () => {
5050
// configRequest should be the first in the stream of requests
5151
stream.write(configRequest);
5252
for (let i = 0; i < chunks.length; i++) {
@@ -70,7 +70,7 @@ async function main(path = 'YOUR_LOCAL_FILE') {
7070
);
7171
//Every annotation has only one frame.
7272
const box = object.frames[0].normalizedBoundingBox;
73-
console.log(`Bounding box position:`);
73+
console.log('Bounding box position:');
7474
console.log(` left :${box.left}`);
7575
console.log(` top :${box.top}`);
7676
console.log(` right :${box.right}`);

video-intelligence/analyze-streaming-safe-search.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async function main(path = 'YOUR_LOCAL_FILE') {
4747
};
4848
chunks.push(request);
4949
})
50-
.on('close', function() {
50+
.on('close', () => {
5151
// configRequest should be the first in the stream of requests
5252
stream.write(configRequest);
5353
for (let i = 0; i < chunks.length; i++) {

video-intelligence/analyze-streaming-shot-change.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async function main(path = 'YOUR_LOCAL_FILE') {
4646
};
4747
chunks.push(request);
4848
})
49-
.on('close', function() {
49+
.on('close', () => {
5050
// configRequest should be the first in the stream of requests
5151
stream.write(configRequest);
5252
for (let i = 0; i < chunks.length; i++) {
@@ -61,7 +61,7 @@ async function main(path = 'YOUR_LOCAL_FILE') {
6161
const shotChanges = annotations.shotAnnotations;
6262
console.log(JSON.stringify(shotChanges));
6363
if (shotChanges.length === 1) {
64-
console.log(`The entire video is one shot.`);
64+
console.log('The entire video is one shot.');
6565
}
6666
shotChanges.forEach(shot => {
6767
console.log(

video-intelligence/analyze.js

+36-34
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ async function analyzeShots(gcsUri) {
163163
console.log('Shot changes:');
164164

165165
if (shotChanges.length === 1) {
166-
console.log(`The entire video is one shot.`);
166+
console.log('The entire video is one shot.');
167167
} else {
168168
shotChanges.forEach((shot, shotIdx) => {
169169
console.log(`Scene ${shotIdx} occurs from:`);
@@ -344,7 +344,7 @@ async function analyzeTextGCS(gcsUri) {
344344
`Time offset for the frame: ${timeOffset.seconds || 0}` +
345345
`.${(timeOffset.nanos / 1e6).toFixed(0)}s`
346346
);
347-
console.log(`Rotated Bounding Box Vertices:`);
347+
console.log('Rotated Bounding Box Vertices:');
348348
frame.rotatedBoundingBox.vertices.forEach(vertex => {
349349
console.log(`Vertex.x:${vertex.x}, Vertex.y:${vertex.y}`);
350350
});
@@ -399,7 +399,7 @@ async function analyzeObjectTrackingGCS(gcsUri) {
399399
`Time offset for the first frame: ${timeOffset.seconds || 0}` +
400400
`.${(timeOffset.nanos / 1e6).toFixed(0)}s`
401401
);
402-
console.log(`Bounding box position:`);
402+
console.log('Bounding box position:');
403403
console.log(` left :${box.left}`);
404404
console.log(` top :${box.top}`);
405405
console.log(` right :${box.right}`);
@@ -468,7 +468,7 @@ async function analyzeText(path) {
468468
`Time offset for the frame: ${timeOffset.seconds || 0}` +
469469
`.${(timeOffset.nanos / 1e6).toFixed(0)}s`
470470
);
471-
console.log(`Rotated Bounding Box Vertices:`);
471+
console.log('Rotated Bounding Box Vertices:');
472472
frame.rotatedBoundingBox.vertices.forEach(vertex => {
473473
console.log(`Vertex.x:${vertex.x}, Vertex.y:${vertex.y}`);
474474
});
@@ -526,7 +526,7 @@ async function analyzeObjectTracking(path) {
526526
`Time offset for the first frame: ${timeOffset.seconds || 0}` +
527527
`.${(timeOffset.nanos / 1e6).toFixed(0)}s`
528528
);
529-
console.log(`Bounding box position:`);
529+
console.log('Bounding box position:');
530530
console.log(` left :${box.left}`);
531531
console.log(` top :${box.top}`);
532532
console.log(` right :${box.right}`);
@@ -536,77 +536,79 @@ async function analyzeObjectTracking(path) {
536536
}
537537

538538
async function main() {
539-
require(`yargs`)
539+
require('yargs')
540540
.demand(1)
541541
.command(
542-
`shots <gcsUri>`,
543-
`Analyzes shot angles in a video stored in Google Cloud Storage using the Cloud Video Intelligence API.`,
542+
'shots <gcsUri>',
543+
'Analyzes shot angles in a video stored in Google Cloud Storage using the Cloud Video Intelligence API.',
544544
{},
545545
opts => analyzeShots(opts.gcsUri)
546546
)
547547
.command(
548-
`labels-gcs <gcsUri>`,
549-
`Labels objects in a video stored in Google Cloud Storage using the Cloud Video Intelligence API.`,
548+
'labels-gcs <gcsUri>',
549+
'Labels objects in a video stored in Google Cloud Storage using the Cloud Video Intelligence API.',
550550
{},
551551
opts => analyzeLabelsGCS(opts.gcsUri)
552552
)
553553
.command(
554-
`labels-file <filePath>`,
555-
`Labels objects in a video stored locally using the Cloud Video Intelligence API.`,
554+
'labels-file <filePath>',
555+
'Labels objects in a video stored locally using the Cloud Video Intelligence API.',
556556
{},
557557
opts => analyzeLabelsLocal(opts.filePath)
558558
)
559559
.command(
560-
`safe-search <gcsUri>`,
561-
`Detects explicit content in a video stored in Google Cloud Storage.`,
560+
'safe-search <gcsUri>',
561+
'Detects explicit content in a video stored in Google Cloud Storage.',
562562
{},
563563
opts => analyzeSafeSearch(opts.gcsUri)
564564
)
565565
.command(
566-
`transcription <gcsUri>`,
567-
`Extract the video transcription using the Cloud Video Intelligence API.`,
566+
'transcription <gcsUri>',
567+
'Extract the video transcription using the Cloud Video Intelligence API.',
568568
{},
569569
opts => analyzeVideoTranscription(opts.gcsUri)
570570
)
571571
.command(
572-
`video-text-gcs <gcsUri>`,
573-
`Analyzes text in a video stored in Google Cloud Storage using the Cloud Video Intelligence API.`,
572+
'video-text-gcs <gcsUri>',
573+
'Analyzes text in a video stored in Google Cloud Storage using the Cloud Video Intelligence API.',
574574
{},
575575
opts => analyzeTextGCS(opts.gcsUri)
576576
)
577577
.command(
578-
`track-objects-gcs <gcsUri>`,
579-
`Analyzes objects in a video stored in Google Cloud Storage using the Cloud Video Intelligence API.`,
578+
'track-objects-gcs <gcsUri>',
579+
'Analyzes objects in a video stored in Google Cloud Storage using the Cloud Video Intelligence API.',
580580
{},
581581
opts => analyzeObjectTrackingGCS(opts.gcsUri)
582582
)
583583
.command(
584-
`video-text <path>`,
585-
`Analyzes text in a video stored in a local file using the Cloud Video Intelligence API.`,
584+
'video-text <path>',
585+
'Analyzes text in a video stored in a local file using the Cloud Video Intelligence API.',
586586
{},
587587
opts => analyzeText(opts.path)
588588
)
589589
.command(
590-
`track-objects <path>`,
591-
`Analyzes objects in a video stored in a local file using the Cloud Video Intelligence API.`,
590+
'track-objects <path>',
591+
'Analyzes objects in a video stored in a local file using the Cloud Video Intelligence API.',
592592
{},
593593
opts => analyzeObjectTracking(opts.path)
594594
)
595-
.example(`node $0 shots gs://cloud-samples-data/video/googlework_short.mp4`)
596-
.example(`node $0 labels-gcs gs://cloud-samples-data/video/cat.mp4`)
597-
.example(`node $0 labels-file googlework_short.mp4`)
598-
.example(`node $0 safe-search gs://cloud-samples-data/video/googlework_short.mp4`)
599-
.example(`node $0 transcription gs://cloud-samples-data/video/cat.mp4`)
600-
.example(`node $0 video-text ./resources/googlework_short.mp4`)
595+
.example('node $0 shots gs://cloud-samples-data/video/googlework_short.mp4')
596+
.example('node $0 labels-gcs gs://cloud-samples-data/video/cat.mp4')
597+
.example('node $0 labels-file googlework_short.mp4')
601598
.example(
602-
`node $0 video-text-gcs gs://nodejs-docs-samples/video/googlework_short.mp4`
599+
'node $0 safe-search gs://cloud-samples-data/video/googlework_short.mp4'
603600
)
604-
.example(`node $0 track-objects ./resources/googlework_short.mp4`)
605-
.example(`node $0 track-objects-gcs gs://nodejs-docs-samples/video/cat.mp4`)
601+
.example('node $0 transcription gs://cloud-samples-data/video/cat.mp4')
602+
.example('node $0 video-text ./resources/googlework_short.mp4')
603+
.example(
604+
'node $0 video-text-gcs gs://nodejs-docs-samples/video/googlework_short.mp4'
605+
)
606+
.example('node $0 track-objects ./resources/googlework_short.mp4')
607+
.example('node $0 track-objects-gcs gs://nodejs-docs-samples/video/cat.mp4')
606608
.wrap(120)
607609
.recommendCommands()
608610
.epilogue(
609-
`For more information, see https://cloud.google.com/video-intelligence/docs`
611+
'For more information, see https://cloud.google.com/video-intelligence/docs'
610612
)
611613
.help()
612614
.strict().argv;

video-intelligence/system-test/analyze-streaming-annotation-to-storage.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const {assert} = require('chai');
1919
const {describe, it} = require('mocha');
2020
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2121

22-
const cmd = `node analyze-streaming-annotation-to-storage.js`;
22+
const cmd = 'node analyze-streaming-annotation-to-storage.js';
2323
const project = process.env.GCLOUD_PROJECT;
2424
const file = 'resources/googlework_short.mp4';
2525
const outputUri = 'gs://' + project + '/VIDEO_STREAMING_OUTPUT';

video-intelligence/system-test/analyze-streaming-automl-classification.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const {describe, it} = require('mocha');
2020

2121
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2222

23-
const cmd = `node analyze-streaming-automl-classification.js`;
24-
const modelId = `VCN3094808572840640512`;
23+
const cmd = 'node analyze-streaming-automl-classification.js';
24+
const modelId = 'VCN3094808572840640512';
2525
const project = process.env.GCLOUD_PROJECT;
2626
const file = 'resources/googlework_short.mp4';
2727

video-intelligence/system-test/analyze-streaming-labels.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const {describe, it} = require('mocha');
2020

2121
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2222

23-
const cmd = `node analyze-streaming-labels.js`;
23+
const cmd = 'node analyze-streaming-labels.js';
2424
const file = 'resources/googlework_short.mp4';
2525

2626
describe('streaming label', () => {

video-intelligence/system-test/analyze-streaming-object.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const {describe, it} = require('mocha');
2020

2121
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2222

23-
const cmd = `node analyze-streaming-object.js`;
23+
const cmd = 'node analyze-streaming-object.js';
2424
const file = 'resources/googlework_short.mp4';
2525

2626
describe('streaming object', () => {

video-intelligence/system-test/analyze-streaming-safe-search.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const {assert} = require('chai');
1919
const {describe, it} = require('mocha');
2020
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2121

22-
const cmd = `node analyze-streaming-safe-search.js`;
22+
const cmd = 'node analyze-streaming-safe-search.js';
2323
const file = 'resources/googlework_short.mp4';
2424

2525
describe('streaming safe search', () => {

video-intelligence/system-test/analyze-streaming-shot-change.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const {describe, it} = require('mocha');
2020

2121
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2222

23-
const cmd = `node analyze-streaming-shot-change.js`;
23+
const cmd = 'node analyze-streaming-shot-change.js';
2424
const file = 'resources/googlework_short.mp4';
2525

2626
describe('streaming shot change', () => {

video-intelligence/system-test/analyze_face_detection.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const {describe, it} = require('mocha');
2020

2121
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2222

23-
const cmd = `node analyze_face_detection.js`;
23+
const cmd = 'node analyze_face_detection.js';
2424
const file = 'resources/googlework_short.mp4';
2525

2626
describe('analyzing faces in video', () => {

video-intelligence/system-test/analyze_face_detection_gcs.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const {describe, it} = require('mocha');
2020

2121
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2222

23-
const cmd = `node analyze_face_detection_gcs.js`;
23+
const cmd = 'node analyze_face_detection_gcs.js';
2424
const gcsUri = 'gs://cloud-samples-data/video/googlework_short.mp4';
2525

2626
describe('analyzing faces in video', () => {

video-intelligence/system-test/analyze_person_detection.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const {describe, it} = require('mocha');
2020

2121
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2222

23-
const cmd = `node analyze_person_detection.js`;
23+
const cmd = 'node analyze_person_detection.js';
2424
const file = 'resources/googlework_short.mp4';
2525

2626
describe('analyzing people in video', () => {

video-intelligence/system-test/analyze_person_detection_gcs.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const {describe, it} = require('mocha');
2020

2121
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2222

23-
const cmd = `node analyze_person_detection_gcs.js`;
23+
const cmd = 'node analyze_person_detection_gcs.js';
2424
const gcsUri = 'gs://cloud-samples-data/video/googlework_short.mp4';
2525

2626
describe('analyzing people in video', () => {

video-intelligence/system-test/detect_logo.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const {describe, it} = require('mocha');
2020

2121
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2222

23-
const cmd = `node detect_logo.js`;
23+
const cmd = 'node detect_logo.js';
2424
const file = 'resources/googlework_short.mp4';
2525

2626
describe('analyzing logos in video', () => {

video-intelligence/system-test/detect_logo_gcs.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const {describe, it} = require('mocha');
2020

2121
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2222

23-
const cmd = `node detect_logo_gcs.js`;
23+
const cmd = 'node detect_logo_gcs.js';
2424
const file = 'gs://cloud-samples-data/video/googlework_short.mp4';
2525

2626
describe('analyzing logos in video on gcs', () => {

0 commit comments

Comments
 (0)