forked from DebaucheryLibrarian/traxxx
Improved duplicate handling. Added tag photos.
This commit is contained in:
10
src/media.js
10
src/media.js
@@ -605,7 +605,12 @@ async function trySource(baseSource, existingMedias, baseMedia) {
|
||||
};
|
||||
}
|
||||
|
||||
return fetchSource(extractedSource, baseMedia);
|
||||
const source = await fetchSource(extractedSource, baseMedia);
|
||||
|
||||
return {
|
||||
...source,
|
||||
entry: extractedSource.entry || existingSourceMedia,
|
||||
};
|
||||
}
|
||||
|
||||
async function fetchMedia(baseMedia, existingMedias) {
|
||||
@@ -698,9 +703,6 @@ async function storeMedias(baseMedias, options) {
|
||||
const newMediaEntries = newMediaWithEntries.filter(media => media.newEntry).map(media => media.entry);
|
||||
|
||||
try {
|
||||
// TODO: path duplicates disappear in DO NOTHING query, causing association error. source duplicate detection not working? use scene generator
|
||||
// UPDATE: cannot replicate when using the same poster and photo source in scene generator
|
||||
// await bulkInsert('media', newMediaEntries, false);
|
||||
await bulkInsert('media', newMediaEntries);
|
||||
|
||||
return [...newMediaWithEntries, ...existingHashMedias];
|
||||
|
||||
@@ -251,6 +251,8 @@ async function fetchLatest(entity, page, options) {
|
||||
.orderByRaw('random()')
|
||||
.limit(Math.floor(Math.random() * 10) + 1);
|
||||
|
||||
// const poster = 'sfw/kittens/thumbs/iNEXVlX-RLs.jpeg';
|
||||
|
||||
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()}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user