Attach base actor to scenes scraped from profile.
This commit is contained in:
parent
6ed02933a6
commit
cc83b832f1
|
@ -290,7 +290,7 @@ function curateProfileEntry(profile) {
|
|||
return curatedProfileEntry;
|
||||
}
|
||||
|
||||
async function curateProfile(profile) {
|
||||
async function curateProfile(profile, actor) {
|
||||
if (!profile) {
|
||||
return null;
|
||||
}
|
||||
|
@ -404,7 +404,18 @@ async function curateProfile(profile) {
|
|||
}).filter(Boolean)
|
||||
: [];
|
||||
|
||||
curatedProfile.scenes = toBaseReleases(profile.scenes || profile.releases, profile.entity);
|
||||
curatedProfile.scenes = toBaseReleases(profile.scenes || profile.releases, profile.entity, actor)
|
||||
// attach actor to base scene, in case it was not scraped
|
||||
.map((scene) => {
|
||||
if (actor && !scene.actors?.find(sceneActor => slugify(sceneActor) === actor.slug || slugify(sceneActor.name) === actor.slug)) {
|
||||
return {
|
||||
...scene,
|
||||
actors: [actor, ...(scene.actors || [])],
|
||||
};
|
||||
}
|
||||
|
||||
return scene;
|
||||
});
|
||||
|
||||
if (profile.ethnicity && !curatedProfile.ethnicity) logger.warn(`Unrecognized ethnicity returned by '${profile.entity.name}' scraper: ${profile.ethnicity}`);
|
||||
if ((profile.hairColor || profile.hair) && !curatedProfile.hairColor) logger.warn(`Unrecognized hair color returned by '${profile.entity.name}' scraper: ${profile.hairColor || profile.hair}`);
|
||||
|
@ -617,7 +628,7 @@ async function scrapeProfiles(actor, sources, entitiesBySlug, existingProfilesBy
|
|||
...profile,
|
||||
entity,
|
||||
update: existingProfile?.id || false,
|
||||
});
|
||||
}, actor);
|
||||
} catch (error) {
|
||||
if (error.code !== 'PROFILE_NOT_AVAILABLE') {
|
||||
logger.error(`Failed to fetch profile for '${actor.name}' from '${scraperSlug}': ${error.message}`);
|
||||
|
|
Loading…
Reference in New Issue