Extended and improved transfer tool. Moved scenes up on movie page.

This commit is contained in:
DebaucheryLibrarian
2023-06-03 02:51:42 +02:00
parent 62617ec6bf
commit 4b9a0e6bab
10 changed files with 314 additions and 102 deletions

View File

@@ -997,16 +997,20 @@ async function flushOrphanedMedia() {
.returning(['media.id', 'media.is_s3', 'media.path', 'media.thumbnail', 'media.lazy'])
.delete();
await Promise.all(orphanedMedia.filter((media) => !media.is_s3).map((media) => Promise.all([
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 */ }),
])));
if (argv.flushMediaFiles) {
await Promise.all(orphanedMedia.filter((media) => !media.is_s3).map((media) => Promise.all([
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 storage`);
if (config.s3.enabled) {
await deleteS3Objects(orphanedMedia.filter((media) => media.is_s3));
}
if (config.s3.enabled) {
await deleteS3Objects(orphanedMedia.filter((media) => media.is_s3));
logger.info(`Removed ${orphanedMedia.length} media files from database and storage`);
} else {
logger.info(`Removed ${orphanedMedia.length} media files from database, but not from storage`);
}
try {