Make the code compile again.

This commit is contained in:
Godzil 2020-04-13 20:09:30 +01:00
parent 3f2a920e1e
commit 7926b2fd9a
3 changed files with 13 additions and 11 deletions

View File

@ -366,6 +366,6 @@ function parse(args: string[]): IConfigLine
.option('--verbose', 'Make tool verbose') .option('--verbose', 'Make tool verbose')
.option('--debug', 'Create a debug file. Use only if requested!') .option('--debug', 'Create a debug file. Use only if requested!')
.option('--rebuildcrp', 'Rebuild the crpersistant file.') .option('--rebuildcrp', 'Rebuild the crpersistant file.')
.option('--retry <i>', 'Number or time to retry fetching an episode.', 5) .option('--retry <i>', 'Number or time to retry fetching an episode.', '5')
.parse(args); .parse(args);
} }

View File

@ -72,7 +72,7 @@ function sanitiseFileName(str: string)
/** /**
* Downloads the subtitle and video. * Downloads the subtitle and video.
*/ */
function download(config: IConfig, page: IEpisodePage, player: IEpisodePlayer, done: (err: Error, ign: boolean) => void) function download(config: IConfig, page: IEpisodePage, player: IEpisodePlayer, done: (err: Error | string, ign: boolean) => void)
{ {
const serieFolder = sanitiseFileName(config.series || page.series); const serieFolder = sanitiseFileName(config.series || page.series);
@ -109,14 +109,9 @@ function download(config: IConfig, page: IEpisodePage, player: IEpisodePlayer, d
return done(null, true); return done(null, true);
} }
mkdirp(path.dirname(filePath), (errM: Error) => const ret = mkdirp(path.dirname(filePath));
if (ret)
{ {
if (errM)
{
log.dispEpisode(fileName, 'Error...', true);
return done(errM, false);
}
log.dispEpisode(fileName, 'Fetching...', false); log.dispEpisode(fileName, 'Fetching...', false);
downloadSubtitle(config, player, filePath, (errDS) => downloadSubtitle(config, player, filePath, (errDS) =>
{ {
@ -164,13 +159,18 @@ function download(config: IConfig, page: IEpisodePage, player: IEpisodePlayer, d
done(null, true); done(null, true);
} }
}); });
}); }
else
{
log.dispEpisode(fileName, 'Error creating folder \'" + filePath + "\'...', true);
return done('Cannot create folder', false);
}
} }
/** /**
* Saves the subtitles to disk. * Saves the subtitles to disk.
*/ */
function downloadSubtitle(config: IConfig, player: IEpisodePlayer, filePath: string, done: (err?: Error) => void) function downloadSubtitle(config: IConfig, player: IEpisodePlayer, filePath: string, done: (err?: Error | string) => void)
{ {
const enc = player.subtitle; const enc = player.subtitle;

View File

@ -1,3 +1,5 @@
interface IAuthError extends Error { interface IAuthError extends Error {
name: string;
message: string;
authError: boolean; authError: boolean;
} }