Skip to content
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
6 changes: 0 additions & 6 deletions lib/support/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -740,12 +740,6 @@ export function parseCommandLine() {
type: 'boolean',
describe: 'Collect Contentful Speed Index when you run --visualMetrics.'
})
.option('visualMetricsPortable', {
type: 'boolean',
default: true,
describe:
'Use the portable visual-metrics processing script (no ImageMagick dependencies).'
})
.option('visualMetricsKeyColor', {
type: 'array',
nargs: 8,
Expand Down
31 changes: 8 additions & 23 deletions lib/video/postprocessing/visualmetrics/visualMetrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ import { getProperty } from '../../../support/util.js';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const log = getLogger('browsertime.video');

const SCRIPT_PATH = path.join(
__dirname,
'..',
'..',
'..',
'..',
'visualmetrics',
'visualmetrics.py'
);

const PORTABLE_SCRIPT_PATH = path.join(
__dirname,
'..',
Expand All @@ -28,16 +18,11 @@ const PORTABLE_SCRIPT_PATH = path.join(
'visualmetrics-portable.py'
);

function getScript(options) {
if (options.visualMetricsPortable) {
log.info('Use the visual metrics portable script');
return PORTABLE_SCRIPT_PATH;
}
return SCRIPT_PATH;
}

export async function checkDependencies(options) {
return execa(process.env.PYTHON || 'python', [getScript(options), '--check']);
export async function checkDependencies() {
return execa(process.env.PYTHON || 'python', [
PORTABLE_SCRIPT_PATH,
'--check'
]);
}
export async function run(
videoPath,
Expand Down Expand Up @@ -141,13 +126,13 @@ export async function run(
scriptArguments.push('-vvv');
}

scriptArguments.unshift(getScript(options));
scriptArguments.unshift(PORTABLE_SCRIPT_PATH);

log.debug('Running visualmetrics.py ' + scriptArguments.join(' '));
log.debug('Running visualmetrics ' + scriptArguments.join(' '));
log.info('Get visual metrics from the video');
try {
const result = await execa(process.env.PYTHON || 'python', scriptArguments);
log.debug('visualmetrics.py output:' + result.stdout);
log.debug('visualmetrics output:' + result.stdout);
if (options.verbose < 1) {
try {
await removeFile(visualMetricsLogFile);
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"browserscripts",
"browsersupport",
"visualmetrics/visualmetrics-portable.py",
"visualmetrics/visualmetrics.py",
"browsertime.png",
"index.js",
"lib",
Expand Down
Loading