mirror of
https://github.com/p-stream/p-stream.git
synced 2026-03-11 17:55:33 +00:00
Merge branch 'substranslate' of https://github.com/vlOd2/p-stream into substranslate
This commit is contained in:
commit
49f956918d
1 changed files with 7 additions and 7 deletions
|
|
@ -76,11 +76,11 @@ async function translateCaption(
|
|||
for (let i = 0; i < RETRY_COUNT; i += 1) {
|
||||
try {
|
||||
text = await translateText(
|
||||
caption.text.replace("\n", "<br>"),
|
||||
caption.text.replaceAll("\n", "<br>"),
|
||||
targetLang,
|
||||
);
|
||||
if (text) {
|
||||
text = text.replace("<br>", "\n");
|
||||
text = text.replaceAll("<br>", "\n");
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
@ -108,18 +108,18 @@ async function translateCaptions(
|
|||
|
||||
const successCount = results.filter((v) => v).length;
|
||||
const failedCount = results.length - successCount;
|
||||
const successPercentange = (successCount / results.length) * 100;
|
||||
const failedPercentange = (failedCount / results.length) * 100;
|
||||
const successPercentage = (successCount / results.length) * 100;
|
||||
const failedPercentage = (failedCount / results.length) * 100;
|
||||
// console.log(
|
||||
// "Done translating captions",
|
||||
// results.length,
|
||||
// successCount,
|
||||
// failedCount,
|
||||
// successPercentange,
|
||||
// failedPercentange,
|
||||
// successPercentage,
|
||||
// failedPercentage,
|
||||
// );
|
||||
|
||||
if (failedPercentange > successPercentange) {
|
||||
if (failedPercentage > successPercentage) {
|
||||
throw new Error("Success percentage is not acceptable");
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue