Fix webvtt formatting

This commit is contained in:
WardPearce
2025-01-24 15:41:09 +13:00
parent bc64e651bc
commit 510158adf0
5 changed files with 26 additions and 7 deletions
-2
View File
@@ -47,8 +47,6 @@
- YT path redirects (So your redirect plugins should still work!)
# Support table
Heres the updated table with the "ffmpeg download merging" column completely removed:
| | Dash | HLS | Local video fallback | API-Extended | Dearrow | RYD |
|---------|------|-----|----------------------|--------------|---------|-----|
| Web | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ |
+2 -1
View File
@@ -18,6 +18,7 @@
import type { VideoPlay } from './api/model';
import {
getBestThumbnail,
padTime,
proxyVideoUrl,
pullBitratePreference,
videoLength,
@@ -223,7 +224,7 @@
endTime = data.content.timestamps[timestampIndex + 1].timePretty;
}
chapterWebVTT += `${timestamp.timePretty} --> ${endTime}\n${timestamp.title.replaceAll('-', '').trim()}\n\n`;
chapterWebVTT += `${padTime(timestamp.timePretty)} --> ${padTime(endTime)}\n${timestamp.title.replaceAll('-', '').trim()}\n\n`;
timestampIndex += 1;
});
-1
View File
@@ -13,7 +13,6 @@
let hiddenVideos: string[] = [];
let auth = get(authStore);
let largeCol = '2';
async function removePlaylistItem(indexId: string, videoId: string) {
if (!playlistId) return;
+24
View File
@@ -107,6 +107,30 @@ export interface PhasedDescription {
timestamps: { title: string; time: number; timePretty: string; }[];
}
export function padTime(time: string): string {
let timeParts = time.split(':');
if (timeParts.length < 3) {
timeParts = ('00:' + time).split(':');
}
const hours = (timeParts[0] || '0').padStart(2, '0');
const minutes = (timeParts[1] || '0').padStart(2, '0');
let seconds = timeParts[2] || '0';
let milliseconds = '';
if (seconds.includes('.')) {
const [sec, ms] = seconds.split('.');
seconds = sec.padStart(2, '0');
milliseconds = `.${ms.padStart(3, '0')}`;
} else {
seconds = seconds.padStart(2, '0');
}
return `${hours}:${minutes}:${seconds}${milliseconds}`;
}
export function decodeHtmlCharCodes(str: string): string {
const { decode } = he;
return decode(str);
-3
View File
@@ -37,9 +37,6 @@ export default defineConfig({
vidstack(),
sveltekit()
],
optimizeDeps: {
exclude: ['@ffmpeg/ffmpeg', '@ffmpeg/util'],
},
ssr: {
noExternal: ['beercss']
}