From 37ad5233e460a2fb5f8dafbf10ed3c3307f19e70 Mon Sep 17 00:00:00 2001 From: stratuma Date: Sat, 22 Jun 2024 11:46:57 +0200 Subject: [PATCH 1/4] fix: fix chapter file naming --- src/api/services/chapter.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/api/services/chapter.ts b/src/api/services/chapter.ts index f97ac70..8dacd63 100644 --- a/src/api/services/chapter.ts +++ b/src/api/services/chapter.ts @@ -40,8 +40,6 @@ export async function createChapterFile(rawchapters: VideoMetadata, dir: string, var chapters: string[] = [] chapters.push(';FFMETADATA1') - chapters.push(`title=${mediaid}`) - chapters.push(`artist=Crunchyroll`) chapters.push(``) if (rawchapters.intro && rawchapters.intro.type && rawchapters.intro.start && rawchapters.intro.end) { From 73094571039900f3c87d9579ef36d9d5b4a411a4 Mon Sep 17 00:00:00 2001 From: stratuma Date: Sat, 22 Jun 2024 13:57:02 +0200 Subject: [PATCH 2/4] fix: fix download crashing if subtitle playlist not found --- src/api/routes/service/service.service.ts | 55 +++++++++++++---------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/src/api/routes/service/service.service.ts b/src/api/routes/service/service.service.ts index 00d84ed..77d7345 100644 --- a/src/api/routes/service/service.service.ts +++ b/src/api/routes/service/service.service.ts @@ -636,36 +636,43 @@ export async function downloadCrunchyrollPlaylist( } if (!subPlaylist) { - await updatePlaylistByID(downloadID, 'failed') - console.log('Subtitle Playlist not found') - messageBox('error', ['Cancel'], 2, 'Subtitle Playlist not found', 'Subtitle Playlist not found', 'Subtitle Playlist not found') + console.log(`Subtitle Playlist for ${s} not found, skipping`) + messageBox( + 'warning', + ['Cancel'], + 2, + `Subtitle Playlist for ${s} not found`, + `Subtitle Playlist for ${s} not found`, + `Sub Playlist for ${s} not found, skipping download` + ) server.logger.log({ level: 'error', - message: 'Subtitle Playlist not found', + message: `Subtitle Playlist for ${s} not found, skipping`, timestamp: new Date().toISOString(), - section: 'crunchyrollDownloadProcess' + section: 'crunchyrollSubtitleDownloadProcess' }) - return } - const found = subPlaylist.data.subtitles.find((sub) => sub.language === s) - if (found) { - subDownloadList.push({ ...found, isDub: false }) - console.log(`Subtitle ${s}.ass found, adding to download`) - server.logger.log({ - level: 'info', - message: `Subtitle ${s}.ass found in Download ${downloadID}, adding to download`, - timestamp: new Date().toISOString(), - section: 'crunchyrollDownloadProcessSubtitles' - }) - } else { - console.warn(`Subtitle ${s}.ass not found, skipping`) - server.logger.log({ - level: 'warn', - message: `Subtitle ${s}.ass not found in Download ${downloadID}, skipping`, - timestamp: new Date().toISOString(), - section: 'crunchyrollDownloadProcessSubtitles' - }) + if (subPlaylist) { + const found = subPlaylist.data.subtitles.find((sub) => sub.language === s) + if (found) { + subDownloadList.push({ ...found, isDub: false }) + console.log(`Subtitle ${s}.ass found, adding to download`) + server.logger.log({ + level: 'info', + message: `Subtitle ${s}.ass found in Download ${downloadID}, adding to download`, + timestamp: new Date().toISOString(), + section: 'crunchyrollDownloadProcessSubtitles' + }) + } else { + console.warn(`Subtitle ${s}.ass not found, skipping`) + server.logger.log({ + level: 'warn', + message: `Subtitle ${s}.ass not found in Download ${downloadID}, skipping`, + timestamp: new Date().toISOString(), + section: 'crunchyrollDownloadProcessSubtitles' + }) + } } } From 0f086f3be0d4115597984c762b56fecbb5ec1144 Mon Sep 17 00:00:00 2001 From: stratuma Date: Sat, 22 Jun 2024 22:01:33 +0200 Subject: [PATCH 3/4] added: added chinese dub/sub selection --- components/Settings/Crunchyroll.vue | 14 ++++---- components/Settings/Main.vue | 3 +- pages/addanime.vue | 3 +- .../routes/crunchyroll/crunchyroll.service.ts | 36 +++++++++---------- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/components/Settings/Crunchyroll.vue b/components/Settings/Crunchyroll.vue index 8271da6..6c349ec 100644 --- a/components/Settings/Crunchyroll.vue +++ b/components/Settings/Crunchyroll.vue @@ -26,13 +26,13 @@ - - - - - - - + + + + + +
Fallback to non-drm stream if no widevine key provided
diff --git a/components/Settings/Main.vue b/components/Settings/Main.vue index 5ba6781..d848b62 100644 --- a/components/Settings/Main.vue +++ b/components/Settings/Main.vue @@ -113,7 +113,8 @@ const locales = ref>([ { locale: 'th-TH', name: 'TH' }, { locale: 'vi-VN', name: 'VI' }, { locale: 'id-ID', name: 'ID' }, - { locale: 'ko-KR', name: 'KO' } + { locale: 'ko-KR', name: 'KO' }, + { locale: 'zh-CN', name: 'CN' }, ]) const selectedVideoQuality = ref() diff --git a/pages/addanime.vue b/pages/addanime.vue index 94df0f7..7c9f297 100644 --- a/pages/addanime.vue +++ b/pages/addanime.vue @@ -387,7 +387,8 @@ const locales = ref>([ { locale: 'th-TH', name: 'TH' }, { locale: 'vi-VN', name: 'VI' }, { locale: 'id-ID', name: 'ID' }, - { locale: 'ko-KR', name: 'KO' } + { locale: 'ko-KR', name: 'KO' }, + { locale: 'zh-CN', name: 'CN' }, ]) const isProduction = process.env.NODE_ENV !== 'development' diff --git a/src/api/routes/crunchyroll/crunchyroll.service.ts b/src/api/routes/crunchyroll/crunchyroll.service.ts index ede9bcd..87b4d41 100644 --- a/src/api/routes/crunchyroll/crunchyroll.service.ts +++ b/src/api/routes/crunchyroll/crunchyroll.service.ts @@ -372,38 +372,38 @@ export async function crunchyGetPlaylist(q: string, geo: string | undefined) { name: 'Edge', url: `/web/edge/play` }, + // { + // id: 7, + // name: 'Safari', + // url: `/web/safari/play` + // }, { id: 7, - name: 'Safari', - url: `/web/safari/play` - }, - { - id: 8, name: 'Chrome', url: `/web/chrome/play` }, { - id: 9, + id: 8, name: 'Web Fallback', url: `/web/fallback/play` }, + // { + // id: 10, + // name: 'Iphone', + // url: `/ios/iphone/play` + // }, + // { + // id: 11, + // name: 'Ipad', + // url: `/ios/ipad/play` + // }, { - id: 10, - name: 'Iphone', - url: `/ios/iphone/play` - }, - { - id: 11, - name: 'Ipad', - url: `/ios/ipad/play` - }, - { - id: 12, + id: 9, name: 'Android', url: `/android/phone/play` }, { - id: 13, + id: 10, name: 'Samsung TV', url: `/tv/samsung/play` } From ef8fb2cb0ab61c98ff160d63f392bd2758bc13ec Mon Sep 17 00:00:00 2001 From: stratuma Date: Sat, 22 Jun 2024 22:53:32 +0200 Subject: [PATCH 4/4] added: added ass resampler map support --- src/api/services/subs.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/api/services/subs.ts b/src/api/services/subs.ts index 92428e4..f141bb6 100644 --- a/src/api/services/subs.ts +++ b/src/api/services/subs.ts @@ -134,7 +134,7 @@ function resamplePOSSubtitle(subtitle: string, ox: number, oy: number, nx: numbe } if (line.includes('\\fs')) { - let posMatches = line.matchAll(/\\fs(-?\d+(?:\.\d+)?)/g) + let posMatches = line.matchAll(/\\fs(\d+(?:\.\d+)?)/g) for (let posMatch of posMatches) { let font = parseInt(posMatch[1]) let newFontSize = Math.round((font / oy) * ny) @@ -154,6 +154,22 @@ function resamplePOSSubtitle(subtitle: string, ox: number, oy: number, nx: numbe } lines[i] = line } + + if (line.match(/m\s|l\s/)) { + let posMatches = line.matchAll(/([ml])\s*(-?\d+(?:\.\d+)?)\s*(-?\d+(?:\.\d+)?)/g) + for (let posMatch of posMatches) { + let command = posMatch[1] + let oldX = parseFloat(posMatch[2]) + let oldY = parseFloat(posMatch[3]) + + let newX = Math.round((oldX / ox) * nx) + let newY = Math.round((oldY / oy) * ny) + + let newCommand = `${command} ${newX} ${newY}` + line = line.replace(posMatch[0], newCommand) + } + lines[i] = line + } } return lines.join('\n')