Added basic filename copy. Added HTTP helper to q. Fetching all actor release pages from Naughty America. Added various high res network logos.
This commit is contained in:
@@ -437,19 +437,18 @@ async function scrapeBasicActors() {
|
||||
}
|
||||
|
||||
async function associateActors(mappedActors, releases) {
|
||||
const actorNames = Object.keys(mappedActors);
|
||||
const actorSlugs = actorNames.map(name => slugify(name));
|
||||
const actorMap = Object.keys(mappedActors).reduce((acc, actorName) => ({ ...acc, [actorName]: slugify(actorName) }), {});
|
||||
|
||||
const [existingActorEntries, existingAssociationEntries] = await Promise.all([
|
||||
knex('actors')
|
||||
.whereIn('name', actorNames)
|
||||
.orWhereIn('slug', actorSlugs),
|
||||
.whereIn('name', Object.keys(actorMap))
|
||||
.orWhereIn('slug', Object.values(actorMap)),
|
||||
knex('releases_actors').whereIn('release_id', releases.map(release => release.id)),
|
||||
]);
|
||||
|
||||
const associations = await Promise.map(Object.entries(mappedActors), async ([actorName, releaseIds]) => {
|
||||
try {
|
||||
const actorEntry = existingActorEntries.find(actor => actor.name === actorName)
|
||||
const actorEntry = existingActorEntries.find(actor => actor.slug === actorMap[actorName])
|
||||
|| await storeActor({ name: actorName });
|
||||
|
||||
return releaseIds
|
||||
@@ -469,7 +468,7 @@ async function associateActors(mappedActors, releases) {
|
||||
|
||||
await knex('releases_actors').insert(associations.filter(association => association).flat());
|
||||
|
||||
// basic actor scraping is failure prone, don't together with actor association
|
||||
// basic actor scraping is failure prone, don't run together with actor association
|
||||
// await scrapebasicactors(),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user