Entity refactor. Facilitating channels without parent.

This commit is contained in:
2020-06-28 00:15:13 +02:00
parent 0e8b4caac3
commit 3462d7af2a
50 changed files with 934 additions and 1964 deletions

View File

@@ -165,7 +165,7 @@ async function scrapeChannelReleases(scraper, channelEntity, preData) {
: [],
]);
logger.info(`Fetching ${latestReleases.length} latest and ${upcomingReleases.length} upcoming updates for '${channelEntity.name}' (${channelEntity.parent.name})`);
logger.info(`Fetching ${latestReleases.length} latest and ${upcomingReleases.length} upcoming updates for '${channelEntity.name}' (${channelEntity.parent?.name})`);
return [...latestReleases, ...upcomingReleases];
}
@@ -176,7 +176,7 @@ async function scrapeChannel(channelEntity, accNetworkReleases) {
|| scrapers.releases[channelEntity.parent?.parent?.slug];
if (!scraper) {
logger.warn(`No scraper found for '${channelEntity.name}' (${channelEntity.parent.name})`);
logger.warn(`No scraper found for '${channelEntity.name}' (${channelEntity.parent?.name})`);
return [];
}
@@ -201,7 +201,7 @@ async function scrapeNetworkSequential(networkEntity) {
networkEntity.children,
async (chain, channelEntity) => {
const accNetworkReleases = await chain;
const channelReleases = await scrapeChannel(channelEntity, networkEntity, accNetworkReleases);
const channelReleases = await scrapeChannel(channelEntity, accNetworkReleases);
return accNetworkReleases.concat(channelReleases);
},