mirror of
https://github.com/OpenSTDL/CrunchyDL.git
synced 2024-10-18 14:05:08 +02:00
fixed versions not found triggering if no dubs
This commit is contained in:
parent
c46f7d902c
commit
9292746580
@ -232,7 +232,6 @@ async function crunchyLoginFetch(user: string, passw: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function crunchyVersionsFetch(q: string) {
|
export async function crunchyVersionsFetch(q: string) {
|
||||||
|
|
||||||
const account = await loggedInCheck('CR')
|
const account = await loggedInCheck('CR')
|
||||||
|
|
||||||
if (!account) return
|
if (!account) return
|
||||||
@ -257,13 +256,13 @@ export async function crunchyVersionsFetch(q: string) {
|
|||||||
data: {
|
data: {
|
||||||
episode_metadata: {
|
episode_metadata: {
|
||||||
versions: {
|
versions: {
|
||||||
audio_locale: string,
|
audio_locale: string
|
||||||
guid: string,
|
guid: string
|
||||||
is_premium_only: boolean,
|
is_premium_only: boolean
|
||||||
media_guid: string,
|
media_guid: string
|
||||||
original: boolean,
|
original: boolean
|
||||||
season_guid: string,
|
season_guid: string
|
||||||
variant: string,
|
variant: string
|
||||||
geo: string
|
geo: string
|
||||||
}[]
|
}[]
|
||||||
}
|
}
|
||||||
|
@ -538,17 +538,6 @@ export async function downloadCrunchyrollPlaylist(
|
|||||||
|
|
||||||
const versions = await crunchyVersionsFetch(e)
|
const versions = await crunchyVersionsFetch(e)
|
||||||
|
|
||||||
if (!versions) {
|
|
||||||
messageBox('error', ['Cancel'], 2, 'Failed to get versions', 'Failed to get versions', 'Failed to get versions')
|
|
||||||
server.logger.log({
|
|
||||||
level: 'error',
|
|
||||||
message: `Failed to get versions ${downloadID}`,
|
|
||||||
timestamp: new Date().toISOString(),
|
|
||||||
section: 'crunchyrollDownloadProcess'
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var playlist = await crunchyGetPlaylist(e, geo)
|
var playlist = await crunchyGetPlaylist(e, geo)
|
||||||
|
|
||||||
if (!playlist) {
|
if (!playlist) {
|
||||||
@ -688,7 +677,7 @@ export async function downloadCrunchyrollPlaylist(
|
|||||||
for (const s of subs) {
|
for (const s of subs) {
|
||||||
var subPlaylist
|
var subPlaylist
|
||||||
|
|
||||||
if (playlist.data.audioLocale !== 'ja-JP') {
|
if (playlist.data.audioLocale !== 'ja-JP' && versions) {
|
||||||
const foundStream = versions.find((v) => v.audio_locale === 'ja-JP')
|
const foundStream = versions.find((v) => v.audio_locale === 'ja-JP')
|
||||||
if (foundStream) {
|
if (foundStream) {
|
||||||
subPlaylist = await crunchyGetPlaylist(foundStream.guid, foundStream.geo)
|
subPlaylist = await crunchyGetPlaylist(foundStream.guid, foundStream.geo)
|
||||||
@ -758,7 +747,7 @@ export async function downloadCrunchyrollPlaylist(
|
|||||||
}
|
}
|
||||||
dubDownloadList.push(found)
|
dubDownloadList.push(found)
|
||||||
console.log(`Audio ${d}.aac found, adding to download`)
|
console.log(`Audio ${d}.aac found, adding to download`)
|
||||||
} else if (versions.length === 0) {
|
} else if (!versions) {
|
||||||
const foundSub = playlist.data.subtitles.find((sub) => sub.language === d)
|
const foundSub = playlist.data.subtitles.find((sub) => sub.language === d)
|
||||||
if (foundSub) {
|
if (foundSub) {
|
||||||
subDownloadList.push({ ...foundSub, isDub: true })
|
subDownloadList.push({ ...foundSub, isDub: true })
|
||||||
@ -780,7 +769,7 @@ export async function downloadCrunchyrollPlaylist(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dubDownloadList.length === 0) {
|
if (dubDownloadList.length === 0 && versions) {
|
||||||
const jpVersion = versions.find((v) => v.audio_locale === 'ja-JP')
|
const jpVersion = versions.find((v) => v.audio_locale === 'ja-JP')
|
||||||
|
|
||||||
if (jpVersion) {
|
if (jpVersion) {
|
||||||
@ -1012,7 +1001,7 @@ export async function downloadCrunchyrollPlaylist(
|
|||||||
|
|
||||||
var hardsubGEO: string | undefined
|
var hardsubGEO: string | undefined
|
||||||
|
|
||||||
if (hardsub.format === 'dub') {
|
if (hardsub.format === 'dub' && versions) {
|
||||||
const found = versions.find((h) => h.audio_locale === hardsub.locale)
|
const found = versions.find((h) => h.audio_locale === hardsub.locale)
|
||||||
if (!found) {
|
if (!found) {
|
||||||
hardsubURL = undefined
|
hardsubURL = undefined
|
||||||
@ -1028,7 +1017,7 @@ export async function downloadCrunchyrollPlaylist(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hardsub.format === 'sub') {
|
if (hardsub.format === 'sub' && versions) {
|
||||||
const found = versions.find((h) => h.audio_locale === 'ja-JP')
|
const found = versions.find((h) => h.audio_locale === 'ja-JP')
|
||||||
if (!found) {
|
if (!found) {
|
||||||
hardsubURL = undefined
|
hardsubURL = undefined
|
||||||
|
Loading…
Reference in New Issue
Block a user