« get me outta code hell

upd8: add determineMediaCachePath to stepStatusSummary - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-10-30 17:11:04 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-10-30 17:11:04 -0300
commit8978169af6529321e2db6193bc5fe193126e8258 (patch)
treee1d5e66a777c4a05f333ee2dcd84b81d30f125fe
parent803413839d644cca0a14c2958c46d6ebe8f57e68 (diff)
upd8: add determineMediaCachePath to stepStatusSummary
-rwxr-xr-xsrc/upd8.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/upd8.js b/src/upd8.js
index 869d732..2318277 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -114,6 +114,9 @@ async function main() {
   Error.stackTraceLimit = Infinity;
 
   stepStatusSummary = {
+    determineMediaCachePath:
+      {...defaultStepStatus, name: `determine media cache path`},
+
     migrateThumbnails:
       {...defaultStepStatus, name: `migrate thumbnails`},
 
@@ -485,6 +488,8 @@ async function main() {
     });
   }
 
+  stepStatusSummary.determineMediaCachePath.status = STATUS_STARTED_NOT_DONE;
+
   const {mediaCachePath, annotation: mediaCachePathAnnotation} =
     await determineMediaCachePath({
       mediaPath,
@@ -496,6 +501,7 @@ async function main() {
 
   if (!mediaCachePath) {
     logError`Couldn't determine a media cache path. (${mediaCachePathAnnotation})`;
+
     switch (mediaCachePathAnnotation) {
       case 'inferred path does not have cache':
         logError`If you're certain this is the right path, you can provide it via`;
@@ -513,11 +519,22 @@ async function main() {
         logError`Make sure one of these is actually pointing to a path that exists.`;
         break;
     }
+
+    Object.assign(stepStatusSummary.determineMediaCachePath, {
+      status: STATUS_FATAL_ERROR,
+      annotation: mediaCachePathAnnotation,
+    });
+
     return false;
   }
 
   logInfo`Using media cache at: ${mediaCachePath} (${mediaCachePathAnnotation})`;
 
+  Object.assign(stepStatusSummary.determineMediaCachePath, {
+    status: STATUS_DONE_CLEAN,
+    annotation: mediaCachePathAnnotation,
+  });
+
   if (migrateThumbs) {
     stepStatusSummary.migrateThumbnails.status = STATUS_STARTED_NOT_DONE;