Added log to give insight about media insert failures.

This commit is contained in:
DebaucheryLibrarian
2021-02-08 04:29:12 +01:00
parent 38f53d8de8
commit a04c7dda37
2 changed files with 13 additions and 15 deletions

View File

@@ -240,23 +240,15 @@ async function fetchLatest(entity, page, options) {
release.photos = Array.from({ length: Math.floor(Math.random() * 10) + 1 }, () => `${options.source}?id=${nanoid()}`); // ensure source is unique
} else {
// select from local SFW database
const [/* poster */, ...photos] = await knex('media')
const [poster, ...photos] = await knex('media')
.select('path')
.where('is_sfw', true)
.pluck('path')
.orderByRaw('random()')
.limit(Math.floor(Math.random() * 10) + 1);
const [poster] = await knex('media')
.select('path')
.where('is_sfw', true)
.pluck('path')
.limit(1);
// release.poster = `http://${config.web.host}:${config.web.port}/img/${poster}?id=${nanoid()}`; // ensure source is unique
release.poster = `http://${config.web.host}:${config.web.port}/img/${poster}`; // ensure source is unique
// release.photos = photos.map(photo => `http://${config.web.host}:${config.web.port}/img/${photo}?id=${nanoid()}`);
release.photos = [release.poster];
release.poster = `http://${config.web.host}:${config.web.port}/img/${poster}?id=${nanoid()}`; // ensure source is unique
release.photos = photos.map(photo => `http://${config.web.host}:${config.web.port}/img/${photo}?id=${nanoid()}`);
}
release.tags = await knex('tags')