Skip to content
Closed
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vset",
"productName": "VSET",
"version": "4.2.2",
"version": "4.3.6",
"description": "VSET",
"author": "NangInShell",
"main": "./out/main/index.js",
Expand Down
File renamed without changes.
Empty file added resources/vpyfiles/.gitkeeper
Empty file.
8 changes: 4 additions & 4 deletions src/main/getCorePath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@
/**
* 获取 VSET 生成的设置文件路径
* 暂时存放在 config_json.outputfolder 目录下
* @param config_json

Check warning on line 42 in src/main/getCorePath.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

@param "config_json" does not match an existing function parameter
*/
export function getGenSettingsPath(config_json): string {
return path.join(config_json.outputfolder, 'setting.json')
export function getGenSettingsPath(): string {
return path.join(app.getAppPath(), 'resources', 'json', 'setting.json')
}

/**
* 获取 VSET 生成的 vpy 文件路径
* 暂时存放在 config_json.outputfolder 目录下
* @param config_json

Check warning on line 51 in src/main/getCorePath.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Expected @param names to be "base_name". Got "config_json, base_name"
* @param base_name 生成的 vpy 文件名(不含扩展名)
*/
export function getGenVpyPath(config_json, base_name: string): string {
return path.join(config_json.outputfolder, `${base_name}.vpy`)
export function getGenVpyPath(base_name: string): string {
return path.join(app.getAppPath(), 'resources', 'vpyfiles', `${base_name}.vpy`)
}
8 changes: 5 additions & 3 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getGenSettingsPath } from './getCorePath'
import { getCpuInfo, getGpuInfo } from './getSystemInfo'
import { openDirectory } from './openDirectory'
import { preview, previewFrame } from './previewOutput'
import { runCommand } from './runCommand'
import { PauseCommand, runCommand } from './runCommand'

function createWindow(): BrowserWindow {
const mainWindow = new BrowserWindow({
Expand All @@ -19,7 +19,7 @@ function createWindow(): BrowserWindow {
show: false,
autoHideMenuBar: true,
icon: nativeImage.createFromPath(appIcon),
title: 'VSET 4.2.2',
title: 'VSET 4.3.6',
webPreferences: {
preload: path.join(__dirname, '../preload/index.js'),
sandbox: false,
Expand All @@ -29,14 +29,16 @@ function createWindow(): BrowserWindow {
// ipcMain
ipcMain.on('execute-command', runCommand)

ipcMain.on('pause', PauseCommand)

ipcMain.on('preview', preview)

ipcMain.on('preview-frame', previewFrame)

ipcMain.on('stop-all-processes', killAllProcesses)

ipcMain.on('generate-json', (_, data) => {
const filePath = getGenSettingsPath(data)
const filePath = getGenSettingsPath()
writeFileSync(filePath, JSON.stringify(data, null, 2))
})

Expand Down
15 changes: 3 additions & 12 deletions src/main/previewOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,15 @@ import path from 'node:path'
import iconv from 'iconv-lite'
import { addProcess, removeProcess } from './childProcessManager'
import { getExecPath, getGenVpyPath } from './getCorePath'
import { generate_vpy } from './runCommand'

export async function preview(event, config_json): Promise<void> {
export async function preview(event, video, vpyContent): Promise<void> {
const vspipePath = getExecPath().vspipe

const videos = config_json.fileList
if (videos?.length === 0) {
event.sender.send('ffmpeg-finish')
return
}
const video = videos[0]

const baseName = path.basename(video, path.extname(video))
const vpyPath = getGenVpyPath(config_json, baseName)
const vpyPath = getGenVpyPath(baseName)

// ========== 生成 vpy 文件 ==========
const vpyFile = generate_vpy(config_json, video)
writeFileSync(vpyPath, vpyFile)
writeFileSync(vpyPath, vpyContent.replace('__VIDEO_PATH__', video))

let info: {
width: string
Expand Down
Loading
Loading