Compare commits

..

No commits in common. "89c0776045ff76c5d985219034ad22e8b52fc5f4" and "6b493f11d7df84082b2a3173559ad8fad0b88a89" have entirely different histories.

4 changed files with 32 additions and 52 deletions

View File

@ -442,12 +442,10 @@ 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
// await scrapebasicactors(),
return;
await Promise.all([
knex('releases_actors').insert(associations.filter(association => association).flat()),
scrapeBasicActors(),
]);
}
module.exports = {

View File

@ -37,8 +37,7 @@ function pluckPhotos(photos, specifiedLimit) {
}
async function createThumbnail(buffer) {
try {
const thumbnail = sharp(buffer)
return sharp(buffer)
.resize({
height: config.media.thumbnailSize,
withoutEnlargement: true,
@ -47,12 +46,6 @@ async function createThumbnail(buffer) {
quality: config.media.thumbnailQuality,
})
.toBuffer();
return thumbnail;
} catch (error) {
logger.error(`Failed to create thumbnail: ${error.message}`);
throw error;
}
}
async function createMediaDirectory(domain, subpath) {
@ -145,7 +138,6 @@ async function savePhotos(files, {
naming = 'index',
}) {
return Promise.map(files, async (file, index) => {
try {
const timestamp = new Date().getTime();
const thumbnail = await createThumbnail(file.photo);
@ -167,10 +159,6 @@ async function savePhotos(files, {
filepath,
thumbpath,
};
} catch (error) {
logger.error(`Failed to store ${domain} ${role} to ${subpath}: ${error.message}`);
return null;
}
});
}
@ -205,7 +193,7 @@ async function storePhotos(photos, {
naming,
});
const curatedPhotoEntries = curatePhotoEntries(savedPhotos.filter(Boolean), domain, role, targetId);
const curatedPhotoEntries = curatePhotoEntries(savedPhotos, domain, role, targetId);
const newPhotos = await knex('media').insert(curatedPhotoEntries).returning('*');
const photoEntries = Array.isArray(newPhotos)

View File

@ -8,7 +8,7 @@ const knex = require('./knex');
const argv = require('./argv');
const whereOr = require('./utils/where-or');
const { associateTags } = require('./tags');
const { associateActors, scrapeBasicActors } = require('./actors');
const { associateActors } = require('./actors');
const {
createMediaDirectory,
storePhotos,
@ -425,8 +425,6 @@ async function storeReleases(releases) {
storeReleaseAssets(storedReleases),
]);
await scrapeBasicActors(),
return {
releases: storedReleases,
actors,

View File

@ -131,11 +131,7 @@ async function scrapeScene(html, url, site) {
}
async function fetchLatest(site, page = 1) {
console.time('dogfart');
console.log('scraping...', site.name);
const res = await bhttp.get(`https://dogfartnetwork.com/tour/scenes/?p=${page}`);
console.timeEnd('dogfart');
console.log('done!', site.name);
return scrapeLatest(res.body.toString(), site);
}