Added separate force media argument.

This commit is contained in:
DebaucheryLibrarian
2023-07-02 21:06:38 +02:00
parent a858b2409a
commit 61c84e18e4
4 changed files with 30 additions and 11 deletions

View File

@@ -556,7 +556,7 @@ async function storeFile(media, options) {
const filedir = config.s3.enabled ? media.role : path.join(media.role, hashDir, hashSubDir);
const filepath = path.join(filedir, filename);
if (argv.force) {
if (argv.forceMedia) {
try {
// remove old file to in case rename() does not overwrite (possibly on NFS setups)
await fsPromises.unlink(path.join(config.media.path, filepath));
@@ -739,14 +739,14 @@ async function trySource(baseSource, existingMedias, baseMedia) {
const extractedSource = await extractSource(baseSource, existingMedias);
const existingSourceMedia = existingMedias.existingSourceMediaByUrl[extractedSource.src];
if (!argv.force && extractedSource.entry) {
if (!argv.forceMedia && extractedSource.entry) {
logger.silly(`Media page URL already in database, not extracting ${baseSource.url}`);
// media entry found during extraction, don't fetch
return extractedSource;
}
if (!argv.force && existingSourceMedia) {
if (!argv.forceMedia && existingSourceMedia) {
logger.silly(`Media source URL already in database, skipping ${baseSource.src}`);
// media entry found by source URL, don't fetch
@@ -843,7 +843,7 @@ async function storeMedias(baseMedias, options) {
{ concurrency: 100 }, // don't overload disk
);
if (argv.force) {
if (argv.forceMedia) {
// overwrite files in case image processing was changed
await Promise.map(
existingHashMedias,