New log saving system

This commit is contained in:
2022-12-02 21:46:26 +01:00
parent f2318cccf0
commit c9c3316437
8 changed files with 231 additions and 93 deletions

View File

@@ -51,7 +51,7 @@ while True:
stickDistance = _map(settings["stickDistance"], 0, 100, 5, 105) stickDistance = _map(settings["stickDistance"], 0, 100, 5, 105)
fps = settings["fps"] fps = settings["fps"]
videoFormat = settings["videoFormat"] videoFormat = settings["videoFormat"]
logs = settings["logs"][1:][:-1].split("\"\"") logs = settings["logs"]
output = settings["output"] output = settings["output"]
dataPath = settings["dataPath"] dataPath = settings["dataPath"]
@@ -127,7 +127,7 @@ while True:
Camera.location[0] = stickDistance/2 Camera.location[0] = stickDistance/2
Camera.data.ortho_scale = stickDistance+5 Camera.data.ortho_scale = stickDistance+5
scn.render.resolution_y = int(width/_map(stickDistance, 5, 105, 2, 21.6)) scn.render.resolution_y = int(width/_map(stickDistance, 5, 105, 2, 21.6))
bpy.context.scene.render.filepath = output + "\\" + log.split("/")[-1].split("\\")[-1].replace(".csv", "."+videoFormat) bpy.context.scene.render.filepath = output[logNumber-1]
scn.render.fps = 1000 scn.render.fps = 1000
scn.render.fps_base = FPSxxx scn.render.fps_base = FPSxxx

View File

@@ -5,9 +5,10 @@ import { setBlenderLoading, setBlenderStatus } from "./ui/menu";
import { setLogNumber, setPastTime, setRemainingTime, setRenderDisplayProgress, setStatus, setPastTimeNow, setRemainingTimeNow } from "./ui/renderingPage"; import { setLogNumber, setPastTime, setRemainingTime, setRenderDisplayProgress, setStatus, setPastTimeNow, setRemainingTimeNow } from "./ui/renderingPage";
import {imageLoading, imageLoaded} from "./ui/settingsPage"; import {imageLoading, imageLoaded} from "./ui/settingsPage";
import { getLogSize, getInOutSettings, getActiveProfile } from "./settings"; import { getLogSize, getInOutSettings, getActiveProfile } from "./settings";
import isValid from "is-valid-path";
import { pageSetRendering, setProgress, openPage, Page } from "../renderer"; import { pageSetRendering, setProgress, openPage, Page } from "../renderer";
import { ipcRenderer } from "electron"; import { ipcRenderer } from "electron";
import path from 'path';
import fs from "fs";
// import { getDoNotDisturb } from "electron-notification-state"; // import { getDoNotDisturb } from "electron-notification-state";
export const renderInfo = { export const renderInfo = {
@@ -68,6 +69,42 @@ function setRenderProgress(log:number, init:boolean, frameCount:number, frame:nu
} }
} }
function getOutPath(log:string) {
let fullOutPath = path.join(getInOutSettings().output, log.substring(log.lastIndexOf("\\")).replace(".csv", "."+getActiveProfile().videoFormat));
if(fs.existsSync(fullOutPath)) {
let i = 1;
while(fs.existsSync(fullOutPath.replace("."+getActiveProfile().videoFormat, " ("+i+")."+getActiveProfile().videoFormat))) {
i++;
}
fullOutPath = fullOutPath.replace("."+getActiveProfile().videoFormat, " ("+i+")."+getActiveProfile().videoFormat);
}
return fullOutPath;
}
let outputArgs:string[] = [];
function blenderArgs() {
const outputList:string[] = [];
getInOutSettings().logs.forEach(log => {
outputList.push(getOutPath(log));
});
outputArgs = outputList;
return JSON.stringify({
stickMode2:getActiveProfile().stickMode2,
width:getActiveProfile().width,
stickDistance:getActiveProfile().stickDistance,
fps:getActiveProfile().fps,
videoFormat:getActiveProfile().videoFormat,
logs:getInOutSettings().logs,
output:outputList,
dataPath:dataPath
});
}
function startBlender() { function startBlender() {
let frames = "0"; let frames = "0";
let lastFrame = "0"; let lastFrame = "0";
@@ -156,17 +193,7 @@ function startBlender() {
} else { } else {
waitingForRender = false; waitingForRender = false;
renderingPicture = true; renderingPicture = true;
const blenderArgs = JSON.stringify({ blenderConsole.stdin.write("getRender -- "+blenderArgs()+"\n");
stickMode2:getActiveProfile().stickMode2,
width:getActiveProfile().width,
stickDistance:getActiveProfile().stickDistance,
fps:getActiveProfile().fps,
videoFormat:getActiveProfile().videoFormat,
logs:getInOutSettings().log,
output:getInOutSettings().output,
dataPath:dataPath
});
blenderConsole.stdin.write("getRender -- "+blenderArgs+"\n");
setBlenderStatus("Rendering"); setBlenderStatus("Rendering");
setBlenderLoading(true); setBlenderLoading(true);
imageLoading(); imageLoading();
@@ -200,31 +227,19 @@ function blender(command:blenderCmd) {
imageLoading(); imageLoading();
setBlenderStatus("Rendering"); setBlenderStatus("Rendering");
setBlenderLoading(true); setBlenderLoading(true);
const blenderArgs = JSON.stringify({ blenderConsole.stdin.write("getRender -- "+blenderArgs()+"\n");
stickMode2:getActiveProfile().stickMode2,
width:getActiveProfile().width,
stickDistance:getActiveProfile().stickDistance,
fps:getActiveProfile().fps,
videoFormat:getActiveProfile().videoFormat,
logs:getInOutSettings().log,
output:getInOutSettings().output,
dataPath:dataPath
});
blenderConsole.stdin.write("getRender -- "+blenderArgs+"\n");
} else { } else {
waitingForRender = true; waitingForRender = true;
} }
} else if(command === blenderCmd.startRendering) { } else if(command === blenderCmd.startRendering) {
if(readyToAcceptCommand) { if(readyToAcceptCommand) {
if(getInOutSettings().log == "") { if(getInOutSettings().logs.length === 0) {
logger.warningMSG("No log selected!"); logger.warningMSG("No log selected!");
} else if(!isValid(getInOutSettings().log)) {
logger.warningMSG("Output path is invalid!");
} else { } else {
currentLogPortion = 0; currentLogPortion = 0;
const logSizeList:number[] = []; const logSizeList:number[] = [];
getInOutSettings().logList.forEach(function (value, index) { getInOutSettings().logs.forEach(function (value, index) {
logSizeList.push(getLogSize(index)); logSizeList.push(getLogSize(index));
}); });
@@ -243,17 +258,7 @@ function blender(command:blenderCmd) {
pageSetRendering(true); pageSetRendering(true);
setBlenderStatus("Rendering"); setBlenderStatus("Rendering");
setBlenderLoading(true); setBlenderLoading(true);
const blenderArgs = JSON.stringify({ blenderConsole.stdin.write("startRendering -- "+blenderArgs()+"\n");
stickMode2:getActiveProfile().stickMode2,
width:getActiveProfile().width,
stickDistance:getActiveProfile().stickDistance,
fps:getActiveProfile().fps,
videoFormat:getActiveProfile().videoFormat,
logs:getInOutSettings().log,
output:getInOutSettings().output,
dataPath:dataPath
});
blenderConsole.stdin.write("startRendering -- "+blenderArgs+"\n");
renderInfo.startTime = new Date().getTime(); renderInfo.startTime = new Date().getTime();
setPastTime("0min 0sec"); setPastTime("0min 0sec");
@@ -280,5 +285,6 @@ export {
blender, blender,
blenderCmd, blenderCmd,
startBlender, startBlender,
renderingPicture renderingPicture,
outputArgs
} }

View File

@@ -163,10 +163,8 @@ async function getLogTime(filePath:string) {
async function getAllLogs() { async function getAllLogs() {
const loadList = []; const loadList = [];
if(getInOutSettings().log.length > 0) { if(getInOutSettings().logs.length > 0) {
const logs = getInOutSettings().log.substring(1).slice(0, -1).split('""'); for(const log of getInOutSettings().logs) {
for(const log of logs) {
loadList.push({ loadList.push({
name: log.split(platformCharacter())[log.split(platformCharacter()).length - 1].replace(".csv", ""), name: log.split(platformCharacter())[log.split(platformCharacter()).length - 1].replace(".csv", ""),
path: log, path: log,
@@ -185,9 +183,8 @@ async function reloadAllLogs() {
} }
async function updateLogs() { async function updateLogs() {
if(getInOutSettings().log.length > 0) { if(getInOutSettings().logs.length > 0) {
const logs = getInOutSettings().log.substring(1).slice(0, -1).split('""'); for(const log of getInOutSettings().logs) {
for(const log of logs) {
if(!logList.some(x => x.path === log)) { if(!logList.some(x => x.path === log)) {
logList.push({ logList.push({
name: log.split(platformCharacter())[log.split(platformCharacter()).length - 1].replace(".csv", ""), name: log.split(platformCharacter())[log.split(platformCharacter()).length - 1].replace(".csv", ""),
@@ -198,7 +195,7 @@ async function updateLogs() {
} }
for(const log of logList) { for(const log of logList) {
if(!logs.some(x => x === log.path)) { if(!getInOutSettings().logs.some(x => x === log.path)) {
logList.splice(logList.indexOf(log), 1); logList.splice(logList.indexOf(log), 1);
} }
} }
@@ -207,20 +204,13 @@ async function updateLogs() {
} }
} }
function getLogList() {
return getInOutSettings().log.split("\"\"");
}
function getLogSize(index:number) { function getLogSize(index:number) {
const logList = getInOutSettings().log.substring(1).slice(0, -1).split('""'); return fs.statSync(getInOutSettings().logs[index]).size;
return fs.statSync(logList[index]).size;
} }
export { export {
reloadAllLogs, reloadAllLogs,
logList, logList,
updateLogs, updateLogs,
getLogList,
getLogSize getLogSize
}; };

View File

@@ -40,10 +40,14 @@ const logger = {
dialog.showMessageBox({ dialog.showMessageBox({
type: 'warning', type: 'warning',
buttons: ['OK'], buttons: ['Open Log', 'OK'],
defaultId: 1, defaultId: 1,
title: 'Warning!', title: 'Warning!',
message: message message: message
}).then(res => {
if(res.response === 0) {
exec('start "" "' + path.join(dataPath, "logs") + '"');
}
}); });
} }
} }

View File

@@ -1,6 +1,9 @@
import {SettingPath, defaultOutputPath, OLDSettingPath} from './paths'; import {SettingPath, defaultOutputPath, OLDSettingPath} from './paths';
import {dialog} from '@electron/remote';
import logger from "./logger"; import logger from "./logger";
import fs from "fs"; import fs from "fs";
import {app} from 'electron';
import { ipcRenderer } from "electron";
enum VideoFormat { enum VideoFormat {
mp4="mp4", mp4="mp4",
@@ -22,7 +25,7 @@ type JSONProfile = {
type JSONSettings = { type JSONSettings = {
activeProfile: string, activeProfile: string,
profiles: JSONProfile[], profiles: JSONProfile[],
log: string, logs: string[],
output: string, output: string,
} }
@@ -38,7 +41,7 @@ const defaultSettings:JSONSettings = {
videoFormat: VideoFormat.webm videoFormat: VideoFormat.webm
} }
], ],
log: '', logs: [],
output: defaultOutputPath output: defaultOutputPath
}; };
@@ -57,6 +60,7 @@ function getXMLChild(doc:Document, child:string) {
return String(doc.getElementsByTagName(child)[0].childNodes[0].nodeValue); return String(doc.getElementsByTagName(child)[0].childNodes[0].nodeValue);
} }
let fetchFailed = "";
const settingList = await fetch(SettingPath).then(function(response) { const settingList = await fetch(SettingPath).then(function(response) {
return response.text(); return response.text();
}).catch(function(err) { }).catch(function(err) {
@@ -64,7 +68,6 @@ const settingList = await fetch(SettingPath).then(function(response) {
return "fileLoadFailed"; return "fileLoadFailed";
}).then(async function(data) { }).then(async function(data) {
if(data === "fileLoadFailed") { if(data === "fileLoadFailed") {
return await fetch(OLDSettingPath).then(function(response) { return await fetch(OLDSettingPath).then(function(response) {
return response.text(); return response.text();
}).catch(function(err) { }).catch(function(err) {
@@ -72,32 +75,171 @@ const settingList = await fetch(SettingPath).then(function(response) {
return "fileLoadFailed"; return "fileLoadFailed";
}).then(function(data) { }).then(function(data) {
if(data === "fileLoadFailed") { if(data === "fileLoadFailed") {
fetchFailed = "fileLoadFailed";
return defaultSettings; return defaultSettings;
} }
const parser = new DOMParser(); const parser = new DOMParser();
const xmlDoc = parser.parseFromString(data, 'text/xml'); const xmlDoc = parser.parseFromString(data, 'text/xml');
const allLogs = catchSetting(function() {return (getXMLChild(xmlDoc, "log") === "None")? "":getXMLChild(xmlDoc, "log");},function() {
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
return ""
});
const newLogs = defaultSettings.logs;
if(allLogs !== "") {
const allLogsList = allLogs.split("\"\"");
allLogsList.forEach(log => {
if(log !== "") {
newLogs.push(log.replace('"', ''));
}
});
}
return { return {
activeProfile: defaultSettings.activeProfile, activeProfile: defaultSettings.activeProfile,
profiles: [ profiles: [
{ {
profileName: defaultSettings.profiles[0].profileName, profileName: defaultSettings.profiles[0].profileName,
fps: parseInt(catchSetting(function() {return getXMLChild(xmlDoc, "fps");},function() {return defaultSettings.profiles[0].fps.toString();})), fps: parseInt(catchSetting(function() {return getXMLChild(xmlDoc, "fps");},function() {
width: parseInt(catchSetting(function() {return getXMLChild(xmlDoc, "width");},function() {return defaultSettings.profiles[0].width.toString();})), fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
stickDistance: parseInt(catchSetting(function() {return getXMLChild(xmlDoc, "stickDistance");},function() {return defaultSettings.profiles[0].stickDistance.toString();})), return defaultSettings.profiles[0].fps.toString();
stickMode2: catchSetting(function() {return getXMLChild(xmlDoc, "stickMode2");},function() {return defaultSettings.profiles[0].stickMode2.toString();}) === "true", })),
videoFormat: catchSetting(function() {return getXMLChild(xmlDoc, "videoFormat");},function() {return defaultSettings.profiles[0].videoFormat.toString();}) as VideoFormat as VideoFormat width: parseInt(catchSetting(function() {return getXMLChild(xmlDoc, "width");},function() {
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
return defaultSettings.profiles[0].width.toString();
})),
stickDistance: parseInt(catchSetting(function() {return getXMLChild(xmlDoc, "stickDistance");},function() {
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
return defaultSettings.profiles[0].stickDistance.toString();
})),
stickMode2: catchSetting(function() {return getXMLChild(xmlDoc, "stickMode2");},function() {
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
return defaultSettings.profiles[0].stickMode2.toString();
}) === "true",
videoFormat: catchSetting(function() {return getXMLChild(xmlDoc, "videoFormat");},function() {
return defaultSettings.profiles[0].videoFormat.toString();
}) as VideoFormat as VideoFormat
} }
], ],
log: catchSetting(function() {return (getXMLChild(xmlDoc, "log") === "None")? "":getXMLChild(xmlDoc, "log");},function() {return defaultSettings.log;}), logs: newLogs,
output: catchSetting(function() {return getXMLChild(xmlDoc, "output");},function() {return defaultSettings.output;}) output: catchSetting(function() {return getXMLChild(xmlDoc, "output");},function() {
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
return defaultSettings.output;
})
} as JSONSettings; } as JSONSettings;
}); });
} }
const parsedData = JSON.parse(data);
return JSON.parse(data) as JSONSettings; let profiles:JSONProfile[] = [];
if(parsedData.profiles !== undefined) {
parsedData.profiles.forEach((profile:JSONProfile) => {
if(typeof profile.profileName !== "string") {
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
profile.profileName = defaultSettings.profiles[0].profileName;
}
if(typeof profile.fps !== "number") {
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
profile.fps = defaultSettings.profiles[0].fps;
}
if(typeof profile.width !== "number") {
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
profile.width = defaultSettings.profiles[0].width;
}
if(typeof profile.stickDistance !== "number") {
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
profile.stickDistance = defaultSettings.profiles[0].stickDistance;
}
if(typeof profile.stickMode2 !== "boolean") {
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
profile.stickMode2 = defaultSettings.profiles[0].stickMode2;
}
if(typeof profile.videoFormat !== "string") {
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
profile.videoFormat = defaultSettings.profiles[0].videoFormat;
}
profiles.push({
profileName: profile.profileName,
fps: profile.fps,
width: profile.width,
stickDistance: profile.stickDistance,
stickMode2: profile.stickMode2,
videoFormat: profile.videoFormat
}); });
});
} else {
fetchFailed = "multiSetting";
profiles = defaultSettings.profiles;
}
const logs:string[] = [];
if(parsedData.logs !== undefined) {
parsedData.logs.forEach((log:string) => {
if(typeof log === "string") {
logs.push(log);
}
});
} else {
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
}
return {
activeProfile: catchSetting(function() {return parsedData.activeProfile;},function() {
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
return defaultSettings.activeProfile;
}),
profiles,
logs,
output: catchSetting(function() {return parsedData.output;},function() {
fetchFailed === "singleSetting"? fetchFailed = "multiSetting":fetchFailed = "singleSetting";
return defaultSettings.output;
})
}
});
if(fetchFailed !== "") {
if(fetchFailed === "fileLoadFailed") {
dialog.showMessageBox({
type: 'warning',
buttons: ['View Settings', 'Continue'],
defaultId: 1,
title: 'Warning!',
message: "Failed to load settings file. Using default settings. if you continue, the settings will be overwritten.",
}).then((result) => {
if(result.response === 0) {
ipcRenderer.send('closeApp');
app.quit();
}
});
} else if(fetchFailed === "singleSetting") {
dialog.showMessageBox({
type: 'warning',
buttons: ['View Settings', 'Continue'],
defaultId: 1,
title: 'Warning!',
message: "A setting failed to load. If you continue, the setting will be overwritten.",
}).then((result) => {
if(result.response === 0) {
ipcRenderer.send('closeApp');
app.quit();
}
});
} else if(fetchFailed === "multiSetting") {
dialog.showMessageBox({
type: 'warning',
buttons: ['View Settings', 'Continue'],
defaultId: 1,
title: 'Warning!',
message: "Multiple settings failed to load. If you continue, the settings will be overwritten.",
}).then((result) => {
if(result.response === 0) {
ipcRenderer.send('closeApp');
app.quit();
}
});
}
}
function createProfile(profileName:string, clone:boolean) { function createProfile(profileName:string, clone:boolean) {
@@ -170,9 +312,9 @@ function editProfile(optiones:{fps?:number, width?:number, stickDistance?:number
writeSettings(); writeSettings();
} }
function setInOutSettings(args:{log?:string, output?:string}) { function setInOutSettings(args:{logs?:string[], output?:string}) {
if(args.log !== undefined) { if(args.logs !== undefined) {
settingList.log = args.log; settingList.logs = args.logs;
} }
if(args.output !== undefined) { if(args.output !== undefined) {
settingList.output = args.output; settingList.output = args.output;
@@ -180,7 +322,7 @@ function setInOutSettings(args:{log?:string, output?:string}) {
writeSettings(); writeSettings();
} }
function getInOutSettings() { function getInOutSettings() {
return {log: settingList.log, output: settingList.output, logList:settingList.log.split("\"\"")}; return {logs: settingList.logs, output: settingList.output};
} }
function removeProfile(profileName?:string) { function removeProfile(profileName?:string) {
@@ -236,9 +378,7 @@ function getActiveProfile() {
} }
function getLogSize(index:number) { function getLogSize(index:number) {
const logList = settingList.log.substring(1).slice(0, -1).split('""'); return fs.statSync(settingList.logs[index]).size;
return fs.statSync(logList[index]).size;
} }
export { export {

View File

@@ -32,7 +32,7 @@ function MainPage() {
<div className="dataDiv"> <div className="dataDiv">
<button id="openLogButton" onClick={() => addLog(setLogTable)}>Add Log(s)</button> <button id="openLogButton" onClick={() => addLog(setLogTable)}>Add Log(s)</button>
<button id="deleteLogsButton" onClick={async () => { <button id="deleteLogsButton" onClick={async () => {
setInOutSettings({log:""}); setInOutSettings({logs:[]});
await reloadAllLogs(); await reloadAllLogs();
updateLogTable(setLogTable); updateLogTable(setLogTable);
}}>Delete All</button> }}>Delete All</button>
@@ -60,8 +60,8 @@ function updateLogTable(setLogTable:React.Dispatch<React.SetStateAction<JSX.Elem
fontWeight: "lighter" fontWeight: "lighter"
}}>({log.time.length.formatted})</td> }}>({log.time.length.formatted})</td>
<td><button className="listButton" onClick={async () => { <td><button className="listButton" onClick={async () => {
const newLogs = getInOutSettings().log.replace('"'+log.path+'"', ""); const newLogs = getInOutSettings().logs.filter(value => value !== log.path);
setInOutSettings({log:newLogs}); setInOutSettings({logs:newLogs});
await updateLogs(); await updateLogs();
updateLogTable(setLogTable); updateLogTable(setLogTable);
}}>Delete</button></td> }}>Delete</button></td>
@@ -69,7 +69,7 @@ function updateLogTable(setLogTable:React.Dispatch<React.SetStateAction<JSX.Elem
})); }));
} }
if(getInOutSettings().log == "") { if(getInOutSettings().logs.length === 0) {
setLogTable([]); setLogTable([]);
} else { } else {
getData(); getData();
@@ -90,17 +90,15 @@ function addLog(setLogTable:React.Dispatch<React.SetStateAction<JSX.Element[]>>)
} }
] ]
}).then(async result => { }).then(async result => {
let logStr = ""; const newLogs = getInOutSettings().logs;
result.filePaths.forEach(value => { result.filePaths.forEach(value => {
const logToAdd = "\"" + value + "\""; if(getInOutSettings().logs.includes(value)) {
if(getInOutSettings().log.includes(logToAdd)) { logger.warningMSG("Log \"" + value + "\" already added.");
logger.warningMSG("Log " + logToAdd + " already added.");
} else { } else {
logStr += "\"" + String(value) + "\""; newLogs.push(value);
} }
}); });
const newLogs = getInOutSettings().log + logStr; setInOutSettings({logs:newLogs});
setInOutSettings({log:newLogs});
await updateLogs(); await updateLogs();
updateLogTable(setLogTable); updateLogTable(setLogTable);
}).catch(err => { }).catch(err => {

View File

@@ -1,6 +1,6 @@
import React, { CSSProperties } from "react"; import React, { CSSProperties } from "react";
import {openPage, Page} from "../../renderer"; import {openPage, Page} from "../../renderer";
import {renderInfo} from "../blenderController"; import {renderInfo, outputArgs} from "../blenderController";
import openFolder from "../openFolder"; import openFolder from "../openFolder";
import {getInOutSettings, getActiveProfile} from "../settings"; import {getInOutSettings, getActiveProfile} from "../settings";
import VideoPlayer from "./videoPlayer"; import VideoPlayer from "./videoPlayer";
@@ -44,14 +44,14 @@ function RenderFinishPage() {
const [videoSource, setVideoSource] = React.useState({src: path.join(getInOutSettings().output, logPlaying+"."+getActiveProfile().videoFormat), type: 'video/'+getActiveProfile().videoFormat.toUpperCase()}); const [videoSource, setVideoSource] = React.useState({src: path.join(getInOutSettings().output, logPlaying+"."+getActiveProfile().videoFormat), type: 'video/'+getActiveProfile().videoFormat.toUpperCase()});
const OutputList = logList.map((inputLog, index) => { const OutputList = outputArgs.map((output, index) => {
const outputLogPath = path.join(getInOutSettings().output, inputLog.name+"."+getActiveProfile().videoFormat); const outputName = output.substring(output.lastIndexOf("\\")+1);
return <option key={index} value={inputLog.name} title={outputLogPath}>{inputLog.name}</option> return <option key={index} value={outputName} title={output}>{outputName}</option>
}); });
React.useEffect(() => { React.useEffect(() => {
setVideoSource({ setVideoSource({
src: path.join(getInOutSettings().output, logPlaying+"."+getActiveProfile().videoFormat), src: path.join(getInOutSettings().output, logPlaying.replace(".csv", "."+getActiveProfile().videoFormat)),
type: 'video/'+getActiveProfile().videoFormat.toUpperCase() type: 'video/'+getActiveProfile().videoFormat.toUpperCase()
}); });
}, [logPlaying]); }, [logPlaying]);

View File

@@ -34,7 +34,7 @@ function RenderingPage() {
return ( return (
<div id="content"> <div id="content">
<p>{"Log " + logNumber + "/" + getInOutSettings().logList.length}</p> <p>{"Log " + logNumber + "/" + getInOutSettings().logs.length}</p>
<p>{status}</p> <p>{status}</p>
<div className="progress"> <div className="progress">
<div className="progress-done" style={{ <div className="progress-done" style={{