asar packaging (#21)
This commit is contained in:
parent
cb9de1b856
commit
af921925af
3 changed files with 12 additions and 5 deletions
|
@ -32,7 +32,10 @@
|
|||
"config": {
|
||||
"forge": {
|
||||
"packagerConfig": {
|
||||
"icon": "./image/icon.ico"
|
||||
"icon": "./image/icon.ico",
|
||||
"asar": {
|
||||
"unpack": "**/node_modules/*-static/**"
|
||||
}
|
||||
},
|
||||
"makers": [
|
||||
{
|
||||
|
|
|
@ -11,7 +11,9 @@ import {
|
|||
processes,
|
||||
} from "./utils/misc";
|
||||
import path = require("path");
|
||||
import ffmpegPath = require("ffmpeg-static");
|
||||
|
||||
import ffmpeg = require("ffmpeg-static");
|
||||
const ffmpegPath = `${ffmpeg}`.replace("app.asar", "app.asar.unpacked");
|
||||
|
||||
const kill = require("terminate");
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import ffprobe = require("ffprobe-static");
|
||||
import child_process = require("child_process");
|
||||
import path = require("path");
|
||||
import { BrowserWindow } from "electron";
|
||||
import { existsSync, unlink } from "fs";
|
||||
|
||||
import ffprobe = require("ffprobe-static");
|
||||
const ffprobePath = ffprobe.path.replace("app.asar", "app.asar.unpacked");
|
||||
|
||||
export const processes: child_process.ChildProcess[] = [];
|
||||
|
||||
/** Create a new filename from the OG one */
|
||||
|
@ -14,14 +16,14 @@ export const getNewFilename = (ogFile: string, part: string) => {
|
|||
|
||||
/** Return the duration of a video in second */
|
||||
export const getVideoDuration = (file: string) => {
|
||||
const command = `"${ffprobe.path}" -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "${file}"`;
|
||||
const command = `"${ffprobePath}" -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "${file}"`;
|
||||
const durationString = child_process.execSync(command).toString().trim();
|
||||
return parseFloat(durationString);
|
||||
};
|
||||
|
||||
/** Return the number of audio tracks */
|
||||
export const getNumberOfAudioTracks = (file: string) => {
|
||||
const command = `"${ffprobe.path}" -v error -show_entries stream=index -select_streams a -of json "${file}"`;
|
||||
const command = `"${ffprobePath}" -v error -show_entries stream=index -select_streams a -of json "${file}"`;
|
||||
const result = child_process.execSync(command, { encoding: "utf8" });
|
||||
return JSON.parse(result).streams.length;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue