Skip to content

Commit

Permalink
Intelligent time conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
dinoosauro authored Sep 2, 2023
1 parent 7281159 commit a676602
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/out.js

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,19 @@ function getFfmpegItem() { // The function that will manage the start and the en
if (conversionOptions.output.custom) { // If this is used in a custom script, fetch the final extension
tempOptions.fileExtension = tempOptions.ffmpegArray[tempOptions.ffmpegArray.length - 1].substring(tempOptions.ffmpegArray[tempOptions.ffmpegArray.length - 1].lastIndexOf("."));
}
return cutTimestamp;
return intelligentTime(cutTimestamp);
}
function intelligentTime(timeArray) {
for (let i = 0; i < timeArray.length; i++) {
if (timeArray[i] === "" && i === 0) timeArray = "00:00:00"; else if (timeArray[i] === "") continue;
timeArray[i] = timeArray[i].replaceAll(".", ":");
let splitArray = timeArray[i].split(":");
for (let x = 0; x < splitArray.length; x++) if (splitArray[x].length === 1) splitArray[x] = `0${splitArray[x]}`;
if (splitArray.length === 1) splitArray.unshift("00", "00"); else if (splitArray.length === 2) splitArray.unshift("00");
timeArray[i] = splitArray.join(":");
}
console.warn(timeArray);
return timeArray;
}
async function ffmpegStart(skipImport) { // The function that manages most of the ffmpeg conversions
let finalScript = [];
Expand Down

0 comments on commit a676602

Please sign in to comment.