fix: fix download crashing if subtitle playlist not found

This commit is contained in:
stratuma 2024-06-22 13:57:02 +02:00
parent 37ad5233e4
commit 7309457103

View File

@ -636,18 +636,24 @@ 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
}
if (subPlaylist) {
const found = subPlaylist.data.subtitles.find((sub) => sub.language === s)
if (found) {
subDownloadList.push({ ...found, isDub: false })
@ -668,6 +674,7 @@ export async function downloadCrunchyrollPlaylist(
})
}
}
}
await updatePlaylistByID(downloadID, 'waiting for dub playlist')