2019-03-03 03:18:33 +00:00
|
|
|
'use strict';
|
|
|
|
|
2019-03-18 03:46:53 +00:00
|
|
|
const argv = require('./argv');
|
2019-11-16 02:33:36 +00:00
|
|
|
const knex = require('./knex');
|
2019-05-06 00:01:57 +00:00
|
|
|
const initServer = require('./web/server');
|
2019-03-23 21:48:39 +00:00
|
|
|
|
2019-11-16 02:33:36 +00:00
|
|
|
const scrapeSites = require('./scrape-sites');
|
2020-01-02 23:59:02 +00:00
|
|
|
const { scrapeReleases } = require('./scrape-releases');
|
2019-11-19 03:36:15 +00:00
|
|
|
const { scrapeActors, scrapeBasicActors } = require('./actors');
|
2019-03-11 03:19:36 +00:00
|
|
|
|
2019-03-04 03:19:03 +00:00
|
|
|
async function init() {
|
2019-12-13 02:28:52 +00:00
|
|
|
if (argv.scene) {
|
2020-01-02 23:59:02 +00:00
|
|
|
await scrapeReleases(argv.scene, null, 'scene');
|
2019-11-16 02:33:36 +00:00
|
|
|
}
|
2019-04-10 02:44:36 +00:00
|
|
|
|
2019-12-13 02:28:52 +00:00
|
|
|
if (argv.movie) {
|
2020-01-02 23:59:02 +00:00
|
|
|
await scrapeReleases(argv.movie, null, 'movie');
|
2019-12-13 02:28:52 +00:00
|
|
|
}
|
2019-05-06 00:01:57 +00:00
|
|
|
|
2019-11-16 22:37:33 +00:00
|
|
|
if (argv.scrape || argv.networks || argv.sites) {
|
2019-11-16 02:33:36 +00:00
|
|
|
await scrapeSites();
|
2019-03-18 03:46:53 +00:00
|
|
|
}
|
2019-11-16 02:33:36 +00:00
|
|
|
|
2019-11-19 03:36:15 +00:00
|
|
|
if (argv.actors && argv.actors.length > 0) {
|
2019-11-17 02:56:45 +00:00
|
|
|
await scrapeActors();
|
|
|
|
}
|
|
|
|
|
2019-11-19 03:36:15 +00:00
|
|
|
if (argv.actors) {
|
|
|
|
await scrapeBasicActors();
|
2019-12-13 02:28:52 +00:00
|
|
|
}
|
2019-11-19 03:36:15 +00:00
|
|
|
|
2019-12-13 02:28:52 +00:00
|
|
|
if (argv.server) {
|
|
|
|
await initServer();
|
2019-11-19 03:36:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-12-13 02:28:52 +00:00
|
|
|
knex.destroy();
|
2019-03-03 03:18:33 +00:00
|
|
|
}
|
|
|
|
|
2019-12-09 04:00:49 +00:00
|
|
|
module.exports = init;
|