Fixed CzechAV to accomodate teasers instead of photos. Fixed error trying to flush non-existent media file.
This commit is contained in:
10
src/media.js
10
src/media.js
@@ -200,8 +200,6 @@ async function findSourceDuplicates(baseMedias) {
|
||||
knex('media').whereIn('source_page', extractUrls),
|
||||
]);
|
||||
|
||||
console.log(sourceUrls, existingSourceMedia);
|
||||
|
||||
const existingSourceMediaByUrl = itemsByKey(existingSourceMedia, 'source');
|
||||
const existingExtractMediaByUrl = itemsByKey(existingExtractMedia, 'source_page');
|
||||
|
||||
@@ -776,12 +774,12 @@ async function flushOrphanedMedia() {
|
||||
.delete();
|
||||
|
||||
await Promise.all(orphanedMedia.map(media => Promise.all([
|
||||
fsPromises.unlink(path.join(config.media.path, media.path)).catch(() => { /* probably file not found */ }),
|
||||
fsPromises.unlink(path.join(config.media.path, media.thumbnail)).catch(() => { /* probably file not found */ }),
|
||||
fsPromises.unlink(path.join(config.media.path, media.lazy)).catch(() => { /* probably file not found */ }),
|
||||
media.path && fsPromises.unlink(path.join(config.media.path, media.path)).catch(() => { /* probably file not found */ }),
|
||||
media.thumbnail && fsPromises.unlink(path.join(config.media.path, media.thumbnail)).catch(() => { /* probably file not found */ }),
|
||||
media.lazy && fsPromises.unlink(path.join(config.media.path, media.lazy)).catch(() => { /* probably file not found */ }),
|
||||
])));
|
||||
|
||||
logger.info(`Removed ${orphanedMedia.length} media files from database and disk`);
|
||||
logger.info(`Removed ${orphanedMedia.length} media files from database and storage`);
|
||||
|
||||
await fsPromises.rmdir(path.join(config.media.path, 'temp'), { recursive: true });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user