snapshot: fix file pathing on windows

This commit is contained in:
Koushik Dutta
2023-11-23 19:38:17 -08:00
parent 80a1a78a79
commit 11ecff985d
4 changed files with 6 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
{
"scrypted.debugHost": "127.0.0.1",
"scrypted.debugHost": "koushik-windows",
}

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/snapshot",
"version": "0.2.11",
"version": "0.2.12",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/snapshot",
"version": "0.2.11",
"version": "0.2.12",
"dependencies": {
"@koush/axios-digest-auth": "^0.8.5",
"@types/node": "^18.16.18",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/snapshot",
"version": "0.2.11",
"version": "0.2.12",
"description": "Snapshot Plugin for Scrypted",
"scripts": {
"scrypted-setup-project": "scrypted-setup-project",

View File

@@ -2,6 +2,7 @@ import sdk, { FFmpegInput } from '@scrypted/sdk';
import type { MIMETypeParameters } from 'whatwg-mimetype';
import { loadSharp, loadVipsImage } from './image-reader';
import { FFmpegImageFilterOptions, ffmpegFilterImage, ffmpegFilterImageBuffer } from './ffmpeg-image-filter';
import url from 'url';
export type DimDict<T extends string> = {
[key in T]: string;
@@ -53,7 +54,7 @@ export async function processImageOp(input: string | FFmpegInput | Buffer, op: I
const { width, height, fractional } = resize;
const { left, top, right, bottom, fractional: cropFractional } = crop;
const filenameOrBuffer = typeof input === 'string' || Buffer.isBuffer(input) ? input : input.url?.startsWith('file:') && new URL(input.url).pathname;
const filenameOrBuffer = typeof input === 'string' || Buffer.isBuffer(input) ? input : input.url?.startsWith('file:') && url.fileURLToPath(input.url);
if (filenameOrBuffer && loadSharp()) {
const vips = await loadVipsImage(filenameOrBuffer, sourceId);