[CR] Fix issue with too many streams when novids and noaudio

Fixes issue where you would have too many active streams if using no videos and no audio downloading
This commit is contained in:
AnimeDL 2024-06-29 07:49:13 -07:00
parent c14a963024
commit 8d59666a6c

View file

@ -1584,6 +1584,14 @@ export default class Crunchy implements ServiceClass {
let tsFile = undefined;
// Delete the stream if it's not needed
if (options.novids && options.noaudio) {
if (playStream) {
await this.refreshToken(true, true);
await this.req.getData(`https://cr-play-service.prd.crunchyrollsvc.com/v1/token/${currentVersion ? currentVersion.guid : currentMediaId}/${playStream.token}`, {...{method: 'DELETE'}, ...AuthHeaders});
}
}
if(!dlFailed && curStream !== undefined && !(options.novids && options.noaudio)){
const streamPlaylistsReq = await this.req.getData(curStream.url, AuthHeaders);
if(!streamPlaylistsReq.ok || !streamPlaylistsReq.res){