Update playlist/generate.js

This commit is contained in:
Aleksandr Statciuk 2022-02-12 04:09:21 +03:00
parent e2046899e9
commit 90aaf7f1c7
2 changed files with 4 additions and 4 deletions

View File

@ -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())

View File

@ -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' }
)
})