« get me outta code hell

thumbs: pass paths through sortByName before printing - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-11-02 13:38:46 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-11-02 13:38:46 -0300
commit0dcb532eaac79e5a3d2f8f633c967c3a7b80788c (patch)
tree0c80c462e74f75175331dbd2005b3859c84cba6c /src
parentc1f93e2d270292bca7e991c180db618f4902a3f9 (diff)
thumbs: pass paths through sortByName before printing
Diffstat (limited to 'src')
-rw-r--r--src/gen-thumbs.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gen-thumbs.js b/src/gen-thumbs.js
index a61baea7..1bbcb9c1 100644
--- a/src/gen-thumbs.js
+++ b/src/gen-thumbs.js
@@ -103,6 +103,7 @@ import dimensionsOf from 'image-size';
 
 import {delay, empty, queue, unique} from '#sugar';
 import {CacheableObject} from '#things';
+import {sortByName} from '#wiki-data';
 
 import {
   colors,
@@ -769,7 +770,7 @@ export default async function genThumbs({
 export function getExpectedImagePaths(mediaPath, {urls, wikiData}) {
   const fromRoot = urls.from('media.root');
 
-  return [
+  const paths = [
     wikiData.albumData
       .flatMap(album => [
         album.hasCoverArt && fromRoot.to('media.albumCover', album.directory, album.coverArtFileExtension),
@@ -789,6 +790,10 @@ export function getExpectedImagePaths(mediaPath, {urls, wikiData}) {
     wikiData.flashData
       .map(flash => fromRoot.to('media.flashArt', flash.directory, flash.coverArtFileExtension)),
   ].flat();
+
+  sortByName(paths, {getName: path => path});
+
+  return paths;
 }
 
 export function checkMissingMisplacedMediaFiles(expectedImagePaths, extantImagePaths) {
@@ -954,7 +959,7 @@ export async function traverseSourceImagePaths(mediaPath, {target}) {
     throw new Error(`Expected target to be 'verify' or 'generate', got ${target}`);
   }
 
-  return await traverse(mediaPath, {
+  const paths = await traverse(mediaPath, {
     pathStyle: (target === 'verify' ? 'posix' : 'device'),
     prefixPath: '',
 
@@ -984,6 +989,10 @@ export async function traverseSourceImagePaths(mediaPath, {target}) {
       return true;
     },
   });
+
+  sortByName(paths, {getName: path => path});
+
+  return paths;
 }
 
 export function isThumb(file) {