diff options
| author | Pitu <[email protected]> | 2020-12-24 23:45:16 +0900 |
|---|---|---|
| committer | Pitu <[email protected]> | 2020-12-24 23:45:16 +0900 |
| commit | fb2c27086f570fec60f4d52dcc9ca80e53186293 (patch) | |
| tree | 4c4fd056c293b8e0de632023ef19fdea95c009fa /src/api/utils | |
| parent | Merge pull request #228 from Zephyrrus/begone_trailing_commas (diff) | |
| download | host.fuwn.me-fb2c27086f570fec60f4d52dcc9ca80e53186293.tar.xz host.fuwn.me-fb2c27086f570fec60f4d52dcc9ca80e53186293.zip | |
Fix ESLint rules once and for all
Diffstat (limited to 'src/api/utils')
| -rw-r--r-- | src/api/utils/QueryHelper.js | 14 | ||||
| -rw-r--r-- | src/api/utils/ThumbUtil.js | 4 | ||||
| -rw-r--r-- | src/api/utils/videoPreview/FragmentPreview.js | 4 | ||||
| -rw-r--r-- | src/api/utils/videoPreview/FrameIntervalPreview.js | 8 |
4 files changed, 15 insertions, 15 deletions
diff --git a/src/api/utils/QueryHelper.js b/src/api/utils/QueryHelper.js index 7fabd06..c26c8eb 100644 --- a/src/api/utils/QueryHelper.js +++ b/src/api/utils/QueryHelper.js @@ -2,16 +2,16 @@ const chrono = require('chrono-node'); class QueryHelper { static parsers = { - before: (val) => QueryHelper.parseChronoList(val), - after: (val) => QueryHelper.parseChronoList(val), - tag: (val) => QueryHelper.sanitizeTags(val) + before: val => QueryHelper.parseChronoList(val), + after: val => QueryHelper.parseChronoList(val), + tag: val => QueryHelper.sanitizeTags(val) }; static requirementHandlers = { - album: (knex) => knex + album: knex => knex .join('albumsFiles', 'files.id', '=', 'albumsFiles.fileId') .join('albums', 'albumsFiles.albumId', '=', 'album.id'), - tag: (knex) => knex + tag: knex => knex .join('fileTags', 'files.id', '=', 'fileTags.fileId') .join('tags', 'fileTags.tagId', '=', 'tags.id') } @@ -93,11 +93,11 @@ class QueryHelper { } static parseChronoList(list) { - return list.map((e) => chrono.parse(e)); + return list.map(e => chrono.parse(e)); } static sanitizeTags(list) { - return list.map((e) => e.replace(/\s/g, '_')); + return list.map(e => e.replace(/\s/g, '_')); } static generateInclusionForTags(db, knex, list) { diff --git a/src/api/utils/ThumbUtil.js b/src/api/utils/ThumbUtil.js index 10a7cd9..254090d 100644 --- a/src/api/utils/ThumbUtil.js +++ b/src/api/utils/ThumbUtil.js @@ -53,7 +53,7 @@ class ThumbUtil { folder: ThumbUtil.squareThumbPath, size: '64x64' }) - .on('error', (error) => log.error(error.message)); + .on('error', error => log.error(error.message)); ffmpeg(filePath) .thumbnail({ @@ -62,7 +62,7 @@ class ThumbUtil { folder: ThumbUtil.thumbPath, size: '150x?' }) - .on('error', (error) => log.error(error.message)); + .on('error', error => log.error(error.message)); try { await previewUtil({ diff --git a/src/api/utils/videoPreview/FragmentPreview.js b/src/api/utils/videoPreview/FragmentPreview.js index 4f681fa..1d1ee02 100644 --- a/src/api/utils/videoPreview/FragmentPreview.js +++ b/src/api/utils/videoPreview/FragmentPreview.js @@ -25,7 +25,7 @@ const getStartTime = (vDuration, fDuration, ignoreBeforePercent, ignoreAfterPerc return getRandomInt(ignoreBeforePercent * safeVDuration, ignoreAfterPercent * safeVDuration); }; -module.exports = async (opts) => { +module.exports = async opts => { const { log = noop, @@ -78,7 +78,7 @@ module.exports = async (opts) => { .outputOptions([`-t ${fragmentDurationSecond}`]) .noAudio() .output(output) - .on('start', (cmd) => log && log({ cmd })) + .on('start', cmd => log && log({ cmd })) .on('end', resolve) .on('error', reject) .run(); diff --git a/src/api/utils/videoPreview/FrameIntervalPreview.js b/src/api/utils/videoPreview/FrameIntervalPreview.js index 8bb9836..96c6e3a 100644 --- a/src/api/utils/videoPreview/FrameIntervalPreview.js +++ b/src/api/utils/videoPreview/FrameIntervalPreview.js @@ -4,7 +4,7 @@ const probe = require('ffmpeg-probe'); const noop = () => {}; -module.exports = async (opts) => { +module.exports = async opts => { const { log = noop, @@ -22,7 +22,7 @@ module.exports = async (opts) => { const info = await probe(input); // const numFramesTotal = parseInt(info.streams[0].nb_frames, 10); const { avg_frame_rate: avgFrameRate, duration } = info.streams[0]; - const [frames, time] = avgFrameRate.split('/').map((e) => parseInt(e, 10)); + const [frames, time] = avgFrameRate.split('/').map(e => parseInt(e, 10)); const numFramesTotal = (frames / time) * duration; @@ -63,9 +63,9 @@ module.exports = async (opts) => { .noAudio() .outputFormat('webm') .output(output) - .on('start', (cmd) => log && log({ cmd })) + .on('start', cmd => log && log({ cmd })) .on('end', () => resolve()) - .on('error', (err) => reject(err)) + .on('error', err => reject(err)) .run(); }); |