fix: some cli arguments

This commit is contained in:
Mateusz Pstrucha committed 2021-12-01 01:16:49 +01:00
1 parent 26f85420c1
commit 79140b5a51
3 files changed
+15 -5

No files matched your search

+6 -1
View File
@@ -25,6 +25,10 @@ if (major < minMajor || (major == minMajor && minor < minMinor)) {
// Parse arguments
const args = yargs(process.argv.slice(2))
.option('rolling', {
alias: 'r',
type: 'boolean',
})
.option('missing', {
alias: 'm',
type: 'boolean',
@@ -32,6 +36,7 @@ const args = yargs(process.argv.slice(2))
.option('cache', {
alias: 'c',
type: 'boolean',
default: false,
})
.option('tid', {
alias: 'T',
@@ -92,7 +97,7 @@ switch (args._[0]) {
cache({ missingOnly: args.m })
break
case 'schedule':
schedule({ checkCache: args.c })
schedule({ checkCache: args.c, rolling: args.r })
break
case 'test':
test()
+8 -3
View File
@@ -5,8 +5,11 @@ import { logSchedule, logTrack } from './modules/log.js'
import { parse, scheduler } from './modules/parse.js'
import { check, convert } from './modules/youtube.js'
export default async function schedule({ checkCache }) {
const { schedule, tracks, ends } = await getTop() // tids
export default async function schedule({
checkCache = false,
rolling = false,
}) {
const { schedule, tracks, ends } = await getTop(rolling ? 'rolling' : 'once') // tids
.then((tids) => tids.slice(0, limit))
.then(convert) // Tracks
.then(parse) // chart
@@ -24,7 +27,9 @@ export default async function schedule({ checkCache }) {
if (checkCache) var { size } = check(`cache/${track.tid}.mp4`)
logSchedule(starts)
logTrack(track, { color: size ? undefined : 'red' })
logTrack(track, {
color: checkCache ? (size ? undefined : 'red') : undefined,
})
}
logSchedule(end, `#${przerwa} End`)
+1 -1
View File
@@ -55,7 +55,7 @@ async function one({ title, artists, tid }) {
export { one }
export default function words({ sus: susOnly, rolling }) {
export default function words({ susOnly, rolling }) {
return getTop(rolling ? 'rolling' : 'once').then(async (top) => {
for (let tid of top.slice(20)) {
const { title, artists } = await getTrack(tid)