Make tslint happy!

This commit is contained in:
Godzil 2018-06-01 21:23:05 +01:00
parent 849c7612aa
commit 7c04fb7282
10 changed files with 60 additions and 55 deletions

View File

@ -32,7 +32,7 @@ export default function(args: string[], done: (err?: Error) => void)
} }
catch (e) catch (e)
{ {
log.warn(`Invalid resolution ${config.resolution}p. Setting to 1080p`); log.warn('Invalid resolution ' + config.resolution + 'p. Setting to 1080p');
config.video_format = resol_table['1080'].format; config.video_format = resol_table['1080'].format;
config.video_quality = resol_table['1080'].quality; config.video_quality = resol_table['1080'].quality;
} }
@ -46,7 +46,10 @@ export default function(args: string[], done: (err?: Error) => void)
tasks(config, batchPath, (err, tasksArr) => tasks(config, batchPath, (err, tasksArr) =>
{ {
if (err) return done(err); if (err)
{
return done(err);
}
let i = 0; let i = 0;

View File

@ -8,6 +8,6 @@ batch(process.argv, (err: any) =>
console.error(err.stack || err); console.error(err.stack || err);
process.exit(-1); process.exit(-1);
} }
console.log('Done!'); console.info('Done!');
process.exit(0); process.exit(0);
}); });

View File

@ -271,7 +271,7 @@ function scrapePage(config: IConfig, address: string, done: (err: Error, page?:
const regexp = /\s*([^\n\r\t\f]+)\n?\s*[^0-9]*([0-9][\-0-9.]*)?,?\n?\s\s*[^0-9]*((PV )?[S0-9][P0-9.]*[a-fA-F]?)/; const regexp = /\s*([^\n\r\t\f]+)\n?\s*[^0-9]*([0-9][\-0-9.]*)?,?\n?\s\s*[^0-9]*((PV )?[S0-9][P0-9.]*[a-fA-F]?)/;
const look = $('#showmedia_about_media').text(); const look = $('#showmedia_about_media').text();
const seasonTitle = $('span[itemprop="title"]').text(); const seasonTitle = $('span[itemprop="title"]').text();
let episodeTitle = $('#showmedia_about_name').text().replace(/[“”]/g, ''); const episodeTitle = $('#showmedia_about_name').text().replace(/[“”]/g, '');
const data = regexp.exec(look); const data = regexp.exec(look);
if (!swf || !data) if (!swf || !data)

View File

@ -27,7 +27,7 @@ function generateDeviceId(): string
for (let i = 0; i < 32; i++) for (let i = 0; i < 32; i++)
{ {
id += possible.charAt(Math.floor(Math.random() * possible.length)); id += possible.charAt(Math.floor(Math.random() * possible.length));
} }
return id; return id;

View File

@ -2,7 +2,7 @@
import cheerio = require('cheerio'); import cheerio = require('cheerio');
import episode from './episode'; import episode from './episode';
import fs = require('fs'); import fs = require('fs');
const fse = require('fs-extra'); import fse = require('fs-extra');
import my_request = require('./my_request'); import my_request = require('./my_request');
import path = require('path'); import path = require('path');
import url = require('url'); import url = require('url');
@ -153,7 +153,7 @@ function page(config: IConfig, address: string, done: (err: Error, result?: ISer
episode: '', episode: '',
volume: 0, volume: 0,
}); });
done(null, {episodes: episodes.reverse(), series: ""}); done(null, {episodes: episodes.reverse(), series: ''});
} }
else else
{ {
@ -195,7 +195,7 @@ function page(config: IConfig, address: string, done: (err: Error, result?: ISer
}); });
if (episodeCount === 0) if (episodeCount === 0)
{ {
log.warn("No episodes found for " + title + ". Could it be a movie?"); log.warn('No episodes found for ' + title + '. Could it be a movie?');
} }
done(null, {episodes: episodes.reverse(), series: title}); done(null, {episodes: episodes.reverse(), series: title});
}); });

View File

@ -33,10 +33,10 @@ export default function(input: string|Buffer, done: (err: Error, subtitle?: stri
*/ */
function event(block: ISubtitleEvent): string function event(block: ISubtitleEvent): string
{ {
var format = 'Layer,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text'; const format = 'Layer,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text';
return '[Events]\n' + return '[Events]\n' +
'Format: ' + format + '\n' + [].concat(block.event).map(style => ('Dialogue: 0,' + 'Format: ' + format + '\n' + [].concat(block.event).map((style) => ('Dialogue: 0,' +
style.$.start + ',' + style.$.start + ',' +
style.$.end + ',' + style.$.end + ',' +
style.$.style + ',' + style.$.style + ',' +
@ -70,13 +70,13 @@ function script(block: ISubtitle): string
*/ */
function style(block: ISubtitleStyle): string function style(block: ISubtitleStyle): string
{ {
var format = 'Name,Fontname,Fontsize,PrimaryColour,SecondaryColour,' + const format = 'Name,Fontname,Fontsize,PrimaryColour,SecondaryColour,' +
'OutlineColour,BackColour,Bold,Italic,Underline,StrikeOut,ScaleX,' + 'OutlineColour,BackColour,Bold,Italic,Underline,StrikeOut,ScaleX,' +
'ScaleY,Spacing,Angle,BorderStyle,Outline,Shadow,Alignment,' + 'ScaleY,Spacing,Angle,BorderStyle,Outline,Shadow,Alignment,' +
'MarginL,MarginR,MarginV,Encoding'; 'MarginL,MarginR,MarginV,Encoding';
return '[V4+ Styles]\n' + return '[V4+ Styles]\n' +
'Format: ' + format + '\n' + [].concat(block.style).map(style => 'Style: ' + 'Format: ' + format + '\n' + [].concat(block.style).map((style) => 'Style: ' +
style.$.name + ',' + style.$.name + ',' +
style.$.font_name + ',' + style.$.font_name + ',' +
style.$.font_size + ',' + style.$.font_size + ',' +

View File

@ -2,7 +2,7 @@
import ass from './ass'; import ass from './ass';
import srt from './srt'; import srt from './srt';
export default <IFormatterTable> { export default {
ass: ass, ass,
srt: srt srt
}; } as IFormatterTable;

View File

@ -17,7 +17,7 @@ export default function(config: IConfig, isSubtitled: boolean, rtmpInputPath: st
if (streamMode === 'RTMP') if (streamMode === 'RTMP')
{ {
videoPath += path.extname(rtmpInputPath); videoPath += path.extname(rtmpInputPath);
} }
else else
{ {

View File

@ -11,30 +11,31 @@ import log = require('../log');
export default function(rtmpUrl: string, rtmpInputPath: string, swfUrl: string, filePath: string, export default function(rtmpUrl: string, rtmpInputPath: string, swfUrl: string, filePath: string,
fileExt: string, mode: string, done: (err: Error) => void) fileExt: string, mode: string, done: (err: Error) => void)
{ {
if (mode === 'RTMP') if (mode === 'RTMP')
{ {
childProcess.exec(command('rtmpdump') + ' ' + childProcess.exec(command('rtmpdump') + ' ' +
'-r "' + rtmpUrl + '" ' + '-r "' + rtmpUrl + '" ' +
'-y "' + rtmpInputPath + '" ' + '-y "' + rtmpInputPath + '" ' +
'-W "' + swfUrl + '" ' + '-W "' + swfUrl + '" ' +
'-o "' + filePath + fileExt + '"', { '-o "' + filePath + fileExt + '"', {
maxBuffer: Infinity, maxBuffer: Infinity,
}, done); }, done);
} }
else if (mode === 'HLS') else if (mode === 'HLS')
{ {
const cmd = command('ffmpeg') + ' ' + const cmd = command('ffmpeg') + ' ' +
'-i "' + rtmpInputPath + '" ' + '-i "' + rtmpInputPath + '" ' +
'-c copy -bsf:a aac_adtstoasc ' + '-c copy -bsf:a aac_adtstoasc ' +
'"' + filePath + '.mp4"'; '"' + filePath + '.mp4"';
childProcess.exec(cmd, { childProcess.exec(cmd,
maxBuffer: Infinity, {
}, done); maxBuffer: Infinity,
} }, done);
else }
{ else
log.error('No such mode: ' + mode); {
} log.error('No such mode: ' + mode);
}
} }
/** /**
@ -44,7 +45,7 @@ function command(exe: string): string
{ {
if (os.platform() !== 'win32') if (os.platform() !== 'win32')
{ {
return exe; return exe;
} }
return '"' + path.join(__dirname, '../../bin/' + exe + '.exe') + '"'; return '"' + path.join(__dirname, '../../bin/' + exe + '.exe') + '"';

View File

@ -17,11 +17,12 @@
"member-ordering": false, "member-ordering": false,
"no-shadowed-variable": false, "no-shadowed-variable": false,
"array-type": [true, "array"], "array-type": [true, "array"],
"object-literal-sort-keys": false,
"trailing-comma": false, "trailing-comma": false,
"no-any": false, "no-any": false,
"no-arg": true, "no-arg": true,
"no-bitwise": true, "no-bitwise": true,
"space-within-parens": false,
"no-object-literal-type-assertion": false,
"no-console": [true, "no-console": [true,
"debug", "debug",
"time", "time",