Extended and improved transfer tool. Moved scenes up on movie page.
This commit is contained in:
20
src/media.js
20
src/media.js
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user