From 90aaf7f1c74580419c39c6c98e6623972bb98924 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sat, 12 Feb 2022 04:09:21 +0300 Subject: [PATCH] Update playlist/generate.js --- scripts/commands/playlist/generate.js | 4 ++-- tests/commands/playlist/generate.test.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/commands/playlist/generate.js b/scripts/commands/playlist/generate.js index 71d19da9b5..d8e3a689c2 100644 --- a/scripts/commands/playlist/generate.js +++ b/scripts/commands/playlist/generate.js @@ -32,9 +32,9 @@ main() async function loadStreams() { await db.streams.load() let streams = await db.streams.find({ is_broken: false }) - streams = _.orderBy( + streams = orderBy( streams, - ['channel_name', 'status.level', 'resolution.height', 'url'], + ['channel_name', i => i.status.level, i => i.resolution.height, 'url'], ['asc', 'asc', 'desc', 'asc'] ) streams = _.uniqBy(streams, stream => stream.channel_id || _.uniqueId()) diff --git a/tests/commands/playlist/generate.test.js b/tests/commands/playlist/generate.test.js index 055b84e0c2..8582a9efb4 100644 --- a/tests/commands/playlist/generate.test.js +++ b/tests/commands/playlist/generate.test.js @@ -6,12 +6,12 @@ const glob = require('glob') beforeEach(() => { fs.emptyDirSync('tests/__data__/output') fs.copyFileSync( - 'tests/__data__/input/database/playlist-generate.streams.db', + 'tests/__data__/input/database/playlist_generate.streams.db', 'tests/__data__/output/streams.db' ) const stdout = execSync( - 'DB_DIR=tests/__data__/output DATA_DIR=tests/__data__/input/data PUBLIC_DIR=tests/__data__/output/.gh-pages LOGS_DIR=tests/__data__/output/logs/generators node --trace-warnings scripts/commands/playlist/generate.js', + 'DB_DIR=tests/__data__/output DATA_DIR=tests/__data__/input/data PUBLIC_DIR=tests/__data__/output/.gh-pages LOGS_DIR=tests/__data__/output/logs/generators npm run playlist:generate', { encoding: 'utf8' } ) })