diff --git a/@types/crunchyTypes.d.ts b/@types/crunchyTypes.d.ts index c9b49e1..9110c90 100644 --- a/@types/crunchyTypes.d.ts +++ b/@types/crunchyTypes.d.ts @@ -44,7 +44,8 @@ export type CrunchyMultiDownload = { dubLang: string[], all?: boolean, but?: boolean, - e?: string + e?: string, + s?: string } export type CrunchyMuxOptions = { diff --git a/crunchy.ts b/crunchy.ts index 2bb9fc4..ade1d62 100644 --- a/crunchy.ts +++ b/crunchy.ts @@ -2166,7 +2166,7 @@ export default class Crunchy implements ServiceClass { merger.cleanUp(); } - public async listSeriesID(id: string): Promise<{ list: Episode[], data: Record}> { @@ -2183,6 +2183,7 @@ export default class Crunchy implements ServiceClass { for(const season of Object.keys(result) as unknown as number[]) { for (const key of Object.keys(result[season])) { const s = result[season][key]; + if (data?.s && s.id !== data.s) continue; (await this.getSeasonDataById(s))?.data?.forEach(episode => { //TODO: Make sure the below code is ok //Prepare the episode array @@ -2274,7 +2275,7 @@ export default class Crunchy implements ServiceClass { } public async downloadFromSeriesID(id: string, data: CrunchyMultiDownload) : Promise> { - const { data: episodes } = await this.listSeriesID(id); + const { data: episodes } = await this.listSeriesID(id, data); console.info(''); console.info('-'.repeat(30)); console.info(''); @@ -2313,6 +2314,7 @@ export default class Crunchy implements ServiceClass { item.season_title = 'NO_TITLE'; item.series_title = 'NO_TITLE'; } + const epNum = key.startsWith('E') ? key.slice(1) : key; // set data const images = (item.images.thumbnail ?? [[ { source: '/notFound.png' } ]])[0]; diff --git a/modules/widevine.ts b/modules/widevine.ts index 62d9f8b..8e21e07 100644 --- a/modules/widevine.ts +++ b/modules/widevine.ts @@ -14,7 +14,7 @@ try { files.forEach(function(file) { file = path.join(workingDir, 'widevine', file); const stats = fs.statSync(file); - if (stats.size < 1024*8 && stats.isFile()) { + if (stats.size < 1024*8) { const fileContents = fs.readFileSync(file, {'encoding': 'utf8'}); if (fileContents.includes('-BEGIN RSA PRIVATE KEY-')) { privateKey = fs.readFileSync(file);