diff --git a/src/App.svelte b/src/App.svelte index 441ade0..aba8340 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -4,11 +4,13 @@ import Languages from "./lib/pickers/Languages.svelte"; import SRT from "./lib/subtitle_conversions/SRT.svelte"; import { convert_to_srt } from "./lib/subtitle_conversions/SRT.svelte"; + import { convert_to_txt } from "./lib/subtitle_conversions/TXT.svelte"; import { convert_to_webvtt, HREF, } from "./lib/subtitle_conversions/WebVTT.svelte"; import WebVtt from "./lib/subtitle_conversions/WebVTT.svelte"; + import TXT from "./lib/subtitle_conversions/TXT.svelte"; import Notifications from "./lib/components/Notifications.svelte"; import {getFinishedSeconds} from "./lib/get_seconds"; @@ -68,6 +70,7 @@ console.log(SUB_DATA); convert_to_srt(SUB_DATA); convert_to_webvtt(SUB_DATA); + convert_to_txt(SUB_DATA); // Progress Stuff PERCENTAGE_TRANSCRIBED_VIDEO = (getFinishedSeconds(SUB_DATA[SUB_DATA.length - 1]) / TOTAL_VIDEO_LENGTH) * 100; @@ -159,6 +162,7 @@ + {/if} diff --git a/src/lib/subtitle_conversions/TXT.svelte b/src/lib/subtitle_conversions/TXT.svelte new file mode 100644 index 0000000..69a4009 --- /dev/null +++ b/src/lib/subtitle_conversions/TXT.svelte @@ -0,0 +1,38 @@ + + + + + \ No newline at end of file diff --git a/src/lib/subtitle_conversions/test_data.ts b/src/lib/subtitle_conversions/test_data.ts index 52923ec..219ff77 100644 --- a/src/lib/subtitle_conversions/test_data.ts +++ b/src/lib/subtitle_conversions/test_data.ts @@ -58,4 +58,12 @@ export const SRT_OUTPUT =`1 00:00:19,760 --> 00:00:21,200 So Long, and Thanks for All the Fish +` + +export const TXT_OUTPUT = `[00:00:00.000 --> 00:00:02.560] Hello World! +[00:00:02.560 --> 00:00:07.440] This is how subtitles look like from whisper +[00:00:07.440 --> 00:00:13.160] 42 is the meaning to the life the universe and everything +[00:00:13.160 --> 00:00:17.360] And you should carry a towel everywhere +[00:00:17.360 --> 00:00:19.760] but now I have to go +[00:00:19.760 --> 00:00:21.200] So Long, and Thanks for All the Fish ` \ No newline at end of file diff --git a/src/lib/subtitle_conversions/txt.spec.ts b/src/lib/subtitle_conversions/txt.spec.ts new file mode 100644 index 0000000..e166462 --- /dev/null +++ b/src/lib/subtitle_conversions/txt.spec.ts @@ -0,0 +1,10 @@ +import {describe, test, expect, vi } from 'vitest'; +import { convert_to_txt } from './TXT.svelte'; +import {subs, TXT_OUTPUT} from './test_data'; + +describe("WebVTT Component", () => { + test("It should generate a TXT file", () => { + const result = convert_to_txt(subs) + expect(result).equal(TXT_OUTPUT); + }) +}); \ No newline at end of file