Skip to content

Commit 79ceda8

Browse files
committed
chore: minor log improvements
1 parent bbd30ea commit 79ceda8

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/utils/ffmpeg.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,27 +203,30 @@ export async function runFFmpeg(args: string[]): Promise<{ success: boolean, out
203203
progressCompleted = true
204204

205205
if (code === 0) {
206-
// This is where the duplicate message happens
207-
// Set to 100% first and only then finish with message
208-
progressBar.update(100)
209-
const barRef = progressBar // Store reference to avoid null issues
210-
setTimeout(() => {
211-
if (barRef)
212-
barRef.finish('Conversion completed successfully!')
213-
}, 50)
206+
// At 100%, show the total time as both current and total time
207+
const finalMessage = bookDuration
208+
? `Converting ${formatTime(bookDuration)} / ${formatTime(bookDuration)} (${currentSpeed}) - Size: ${currentSize}`
209+
: 'Conversion complete'
210+
211+
// Don't use the finish method at all - just update to 100% with a message
212+
progressBar.update(100, finalMessage)
213+
214+
// Don't call progressBar.finish() - this causes the duplicate message
215+
// Instead, let the logger in converter.ts show the single success message
214216
}
215217
else {
218+
// For errors, we still use the interrupt method
216219
progressBar.interrupt('Conversion failed', 'error')
217220
}
218221
}
219222

220-
// Give a small delay to allow the progress bar to finish properly
223+
// Give a small delay to allow the progress bar to clean up
221224
setTimeout(() => {
222225
resolve({
223226
success: code === 0,
224227
output,
225228
})
226-
}, 100)
229+
}, 50)
227230
})
228231
})
229232
}

0 commit comments

Comments
 (0)