fix: --rolling
This commit is contained in:
3 files changed
+26
-10
No files matched your search
@@ -1,12 +1,14 @@
|
||||
import yargs from 'yargs'
|
||||
import { readFileSync } from 'fs'
|
||||
|
||||
import web from './src/web.js'
|
||||
import cache from './src/cache.js'
|
||||
import schedule from './src/schedule.js'
|
||||
import standalone from './src/standalone.js'
|
||||
import test from './src/test.js'
|
||||
import words, { one } from './src/words.js'
|
||||
|
||||
import { logTrack } from './src/modules/log.js'
|
||||
import { logAction, logTrack } from './src/modules/log.js'
|
||||
import { convert } from './src/modules/youtube.js'
|
||||
|
||||
// Check Node version
|
||||
@@ -54,6 +56,10 @@ const args = yargs(process.argv.slice(2))
|
||||
type: 'array',
|
||||
default: [],
|
||||
})
|
||||
.option('playlist', {
|
||||
alias: 'p',
|
||||
type: 'string',
|
||||
})
|
||||
.option('artists', {
|
||||
alias: 'a',
|
||||
type: 'array',
|
||||
@@ -64,13 +70,13 @@ const args = yargs(process.argv.slice(2))
|
||||
|
||||
switch (args._[0]) {
|
||||
default:
|
||||
console.log('Defaulting to Web module')
|
||||
console.log('Defaulting to standalone')
|
||||
case 'standalone':
|
||||
standalone({ rolling: args.r })
|
||||
break
|
||||
case 'web':
|
||||
web()
|
||||
break
|
||||
case 'standalone':
|
||||
standalone()
|
||||
break
|
||||
case 'lyrics':
|
||||
if (args.T || args.t.length > 0 || args.a.length > 0) {
|
||||
let tid = args.T,
|
||||
@@ -101,4 +107,9 @@ switch (args._[0]) {
|
||||
break
|
||||
case 'test':
|
||||
test()
|
||||
case 'playlist':
|
||||
logAction('Reading playlist', args.p)
|
||||
const tids = JSON.parse(readFileSync(`./${args.p}.json`))
|
||||
standalone({ tids })
|
||||
break
|
||||
}
|
||||
+7
-4
@@ -7,15 +7,18 @@ import { parse, cache, scheduler } from './modules/parse.js'
|
||||
import { logAction, logSchedule, logTrack, logValue } from './modules/log.js'
|
||||
import { local } from './modules/playback.js'
|
||||
|
||||
export default async function standalone() {
|
||||
export default async function standalone({ tids, rolling } = {}) {
|
||||
logValue('Volume', defaultVolume)
|
||||
logValue('Offset', offset)
|
||||
logValue('Verbose', verbose)
|
||||
logValue('Limit', process.env.LIMIT)
|
||||
console.log(rolling)
|
||||
const _tids = (tids ?? (await getTop(rolling ? 'rolling' : 'once'))).slice(
|
||||
0,
|
||||
limit
|
||||
) // tids
|
||||
|
||||
const { schedule, tracks, ends } = await getTop() // tids
|
||||
.then((tids) => tids.slice(0, limit))
|
||||
.then(convert) // Tracks
|
||||
const { schedule, tracks, ends } = await convert(_tids) // Tracks
|
||||
.then(parse) // chart
|
||||
.then(cache)
|
||||
.then(scheduler) // schedule
|
||||
|
||||
+3
-1
@@ -1 +1,3 @@
|
||||
export default function web() {}
|
||||
export default function web() {
|
||||
console.log('to be implemented')
|
||||
}
|
||||
Reference in new issue
Block a user