New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@alezanai/torquator

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alezanai/torquator - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

lib/utils/check-jsonl-extension.js

27

lib/actions/info.js

@@ -1,11 +0,28 @@

const getMxfDate = require('../utils/get-mxf-date');
const checkVideoExtension = require('../utils/check-video-extension');
const checkJsonlExtension = require('../utils/check-jsonl-extension');
const getGpsInfo = require('../utils/get-gps-info');
const getMxfInfo = require('../utils/get-mxf-info');
const formatDateDuration = require('../utils/format-date-duration');
//
module.exports = function ({logger}) {
return function (videoFilename) {
return getMxfDate({filename: videoFilename, logger}).then(date => {
console.log(`Date is ${date.toISOString()}`);
return function (filename) {
let promise;
try {
checkVideoExtension(filename);
promise = getMxfInfo({filename, logger});
} catch {
try {
checkJsonlExtension(filename);
} catch {
promise = Promise.reject(new Error(`File ${filename} is not a video (.mxf, .footage) nor a gps file (.jsonl)`));
}
promise = getGpsInfo({filename, logger});
}
return promise.then(o => {
logger.info(formatDateDuration(o));
});
};
};

37

lib/actions/replay.js

@@ -8,2 +8,7 @@ const fs = require('fs');

const parseS3Uri = require('@momocode/parse-s3-uri');
const checkVideoExtension = require('../utils/check-video-extension');
const checkJsonlExtension = require('../utils/check-jsonl-extension');
const getGpsInfo = require('../utils/get-gps-info');
const getMxfInfo = require('../utils/get-mxf-info');
const formatDateDuration = require('../utils/format-date-duration');

@@ -215,10 +220,5 @@ //

if (path.extname(videoFilename) !== '.mxf' && path.extname(videoFilename) !== '.footage') {
throw (new Error(`Error occured with ${videoFilename} extension, should be .mxf or .footage and is "${path.extname(videoFilename)}"`));
}
checkVideoExtension(videoFilename);
checkJsonlExtension(gpsFilename);
if (path.extname(gpsFilename) !== '.jsonl') {
throw (new Error(`Error occured with ${gpsFilename} extension, should be .jsonl and is "${path.extname(gpsFilename)}`));
}
if (output && path.extname(output) !== '.jsonl') {

@@ -253,2 +253,16 @@ throw (new Error(`Error occured with ${output} extension, should be .jsonl`));

const checkTimeConsistency = function ({gpsFilename, videoFilename}) {
return Promise.all([getMxfInfo({filename: videoFilename, logger}), getGpsInfo({filename: gpsFilename, logger})])
.then(([videoInfo, gpsInfo]) => {
const intersection = [
Math.max(videoInfo.date.getTime(), gpsInfo.date.getTime()),
Math.min(videoInfo.date.getTime() + videoInfo.duration * 1000, gpsInfo.date.getTime() + gpsInfo.duration * 1000),
];
if (intersection[0] > intersection[1]) {
throw (new Error(`Timestamps are not matching\n ${formatDateDuration(videoInfo)}\n${formatDateDuration(gpsInfo)}`));
}
});
};
const safeUpload = function ({source, destination, reuse, force, logger}) {

@@ -281,6 +295,7 @@ return checkExists({s3Uri: destination}).then(exists => {

return Promise.all([
safeUpload({destination: videoDestination, source: videoFilename, force, reuse, logger}),
safeUpload({destination: gpsDestination, source: gpsFilename, force, reuse, logger}),
])
return checkTimeConsistency({gpsFilename, videoFilename})
.then(() => Promise.all([
safeUpload({destination: videoDestination, source: videoFilename, force, reuse, logger}),
safeUpload({destination: gpsDestination, source: gpsFilename, force, reuse, logger}),
]))
.then(() => {

@@ -287,0 +302,0 @@ const safeISOExecDate = isoExecDate.slice(0, 19).replace(/:/g, '');

@@ -7,3 +7,3 @@ const {Command} = require('commander');

command.argument('<video-filename>', 'The .mxf/.footage video filename');
command.argument('<filename>', 'The .mxf/.footage video filename or the .jsonl GPS Filename');
command.action(info(options));

@@ -10,0 +10,0 @@

@@ -1,30 +0,5 @@

const Ffmpeg = require('fluent-ffmpeg');
const timecodeToDate = require('./timecode-to-date');
const getMxfInfo = require('./get-mxf-info');
module.exports = function ({filename, logger}) {
return new Promise((resolve, reject) => {
const ffmpeg = new Ffmpeg();
ffmpeg
.input(filename)
.ffprobe((error, data) => {
if (error) {
return reject(error);
}
resolve(data);
});
}).then(meta => {
// The timecode format is '13:49:36:00' we change it to '13:49:36'
const timecode = meta.format.tags.timecode;
logger.info(`Opening ${filename} with timecode ${timecode}`);
const dateMatch = filename.match(/(\d{4})-(\d{2})-(\d{2})/);
if (dateMatch) {
const [, year, month, day] = dateMatch;
return timecodeToDate({timecode, year, month, day});
}
return timecodeToDate({timecode});
});
module.exports = function (options) {
return getMxfInfo(options).then(({date}) => date);
};
{
"name": "@alezanai/torquator",
"version": "1.4.0",
"version": "1.4.1",
"description": "Command line interface for Alezan.ai Torquator SaaS",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -84,9 +84,9 @@

```sh
Usage: torquator info [options] <video-filename>
Usage: torquator info [options] <filename>
Arguments:
video-filename The .mxf/.footage video filename
filename The .mxf/.footage video filename or the .jsonl GPS Filename
Options:
-h, --help display help for command
-h, --help display help for command

@@ -93,0 +93,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc