diff --git a/src/episode.ts b/src/episode.ts index f3e1829..25a47e4 100644 --- a/src/episode.ts +++ b/src/episode.ts @@ -65,8 +65,7 @@ function fileExist(path: string) function sanitiseFileName(str: string) { - return str.replace('/', '_').replace('\'', '_').replace(':', '_').replace('?', '_') - .replace('*', '_').replace('\"', '_').replace('<', '_').replace('>', '_'); + return str.replace(/[\/':\?\*"<>\.]/g, '_'); } /** @@ -102,6 +101,7 @@ function download(config: IConfig, page: IEpisodePage, player: IEpisodePlayer, d return done(errM, false); } + log.dispEpisode(fileName, 'Fetching...', false); downloadSubtitle(config, player, filePath, (errDS) => { if (errDS) @@ -112,7 +112,7 @@ function download(config: IConfig, page: IEpisodePage, player: IEpisodePlayer, d const now = Date.now(); if (player.video.file !== undefined) { - log.dispEpisode(fileName, 'Fetching...', false); + log.dispEpisode(fileName, 'Fetching video...', false); downloadVideo(config, page, player, filePath, (errDV) => { if (errDV) @@ -127,6 +127,7 @@ function download(config: IConfig, page: IEpisodePage, player: IEpisodePlayer, d const isSubtited = Boolean(player.subtitle); + log.dispEpisode(fileName, 'Merging...', false); video.merge(config, isSubtited, player.video.file, filePath, player.video.mode, (errVM) => { if (errVM) diff --git a/src/log.ts b/src/log.ts index 4d0a70b..022c274 100644 --- a/src/log.ts +++ b/src/log.ts @@ -28,10 +28,10 @@ export function warn(str: string) export function dispEpisode(name: string, status: string, addNL: boolean) { /* Do fancy output */ - process.stdout.write(' \x1B[1;33m> \x1B[37m' + name + '\x1B[0m : \x1B[33m' + status + '\x1B[0m\x1B[0G'); + process.stdout.write('\x1B[K \x1B[1;33m> \x1B[37m' + name + '\x1B[0m : \x1B[33m' + status + '\x1B[0m\x1B[0G'); if (addNL) { console.log(''); } -} \ No newline at end of file +}