...
 
Commits (3)
# CHANGELOG
## 1.0.5
## 1.0.7
- Do not add \k100 on first line if song begins at 00:00:00
- Correctly guess fps within ffmpeg output
## 1.0.6
- Forgot to modify findFPS type
## 1.0.5
- Made findFPS function accept a ffmpegPath parameter (defaults to 'ffmpeg')
......
{
"name": "toyunda2ass",
"version": "1.0.6",
"version": "1.0.7",
"description": "Convert Epitanime Toyunda karaoke files to ASS files",
"main": "dist/index.js",
"bin": {
......
......@@ -44,7 +44,7 @@ export async function findFPS(videoFile: string, ffmpegPath = 'ffmpeg'): Promise
try {
const result = await execa(ffmpegPath, ['-i', videoFile, '-vn', '-f','null', '-'], { encoding : 'utf8' });
const outputArray = result.stderr.split(' ');
const indexFPS = outputArray.indexOf('fps');
const indexFPS = outputArray.indexOf('fps,');
let fps = 0;
if (indexFPS > -1) {
fps = parseFloat(outputArray[indexFPS - 1]);
......@@ -97,13 +97,20 @@ export function convertToASS(time: ToyundaData, fps: number): string {
const dialogue = clone(ass.dialogue);
const comment = clone(ass.dialogue);
let dialogueScript = ass.dialogueScript;
let commentScript = ass.commentScript;
if (startMs === 0) {
// if song starts at the beginning, remove the \k100 delay
dialogueScript = dialogueScript.replace(/\\k100/,'');
commentScript = '';
}
dialogue.value.Start = comment.value.Start = msToAss(startMs);
dialogue.value.End = comment.value.End = msToAss(stopMs);
dialogue.value.Text = ass.dialogueScript + ASSLine.join('');
dialogue.value.Text = dialogueScript + ASSLine.join('');
dialogue.value.Effect = 'karaoke';
comment.value.Effect = 'fx';
comment.key = 'Comment';
comment.value.Text = ass.commentScript + ASSLine.join('');
comment.value.Text = commentScript + ASSLine.join('');
// Add it to our kara
dialogues.push(clone(dialogue));
comments.push(clone(comment));
......