parent
6fe11be108
commit
4a91a96e5a
@ -0,0 +1,27 @@ |
|||||||
|
const chalk = require('chalk'); |
||||||
|
|
||||||
|
module.exports = async (app, spinner) => { |
||||||
|
const Series = app.db.models.ani.series; |
||||||
|
|
||||||
|
return new Promise(async resolve => { |
||||||
|
const st = new Date().getTime(); |
||||||
|
|
||||||
|
let amount = 1; |
||||||
|
|
||||||
|
for await (const series of Series.find()) { |
||||||
|
let {id, name, romaji, kanji, altNames, genres, tags} = series; |
||||||
|
app.cache.series[series.id] = {id, name, romaji, kanji, altNames, genres, tags}; //keep an in-memory index of series' searchable items
|
||||||
|
app.cache.series[series.id].synopsis = series.synopsis.synopsis; |
||||||
|
console.log(app.cache.series[series.id]); |
||||||
|
spinner.update({text: `${chalk.gray('[PROC]')} >> ${chalk.blueBright(`Cached`)} ${chalk.white(`${amount}`)} ${chalk.blueBright(`ani DB series.`)}`}); |
||||||
|
app.cache.seriesCount++; |
||||||
|
amount++; |
||||||
|
} |
||||||
|
|
||||||
|
const cacheTime = new Date().getTime() - st; |
||||||
|
spinner.update({text: `${spinner.options.text.slice(0, 19).trim()} ${chalk.gray(`${cacheTime}ms >>`.padStart(8, '0').padStart(7, '0'))} ${spinner.options.text.slice(19).trim()}`}); |
||||||
|
spinner.status('non-spinnable'); |
||||||
|
|
||||||
|
resolve(0); |
||||||
|
}); |
||||||
|
} |
Loading…
Reference in new issue