tvcl
Version:
A simple CLI for show tracking
29 lines (25 loc) • 637 B
JavaScript
const {bold, gray} = require('chalk')
const {pr} = require('./utils')
function printOverview(s) {
let overview = s['Overview'] && s['Overview'][0]
if (overview) {
if (overview.length > 256) {
overview = overview.substring(0, 256) + '...'
}
pr(gray(overview))
}
}
function printSeries(s, overview = true, noSpace = false) {
const id = s['seriesid'] || s['id'][0]
const name = bold(s['SeriesName'])
const aired = s['FirstAired'] || '?'
const resLine = `${id} ${name} (since ${aired})`
pr(resLine)
if (overview) {
printOverview(s)
}
if (!noSpace) {
pr()
}
}
module.exports = printSeries