MCPcopy
hub / github.com/ollm/OpenComic / validateThumbnails

Function validateThumbnails

scripts/cache.js:737–772  ·  view source on GitHub ↗
(images, type = '')

Source from the content-addressed store, hash-verified

735}
736
737function validateThumbnails(images, type = '')
738{
739 const correct = [];
740 const errorOnlyFile = [];
741 const errorOnlyData = [];
742 const notThumbnails = [];
743
744 const size = Math.round(window.devicePixelRatio * 150);
745
746 for(let i = 0, len = images.length; i < len; i++)
747 {
748 const image = images[i];
749 const sha = image.sha || sha1(image.path);
750 const imgCache = data[sha];
751
752 const exists = fs.existsSync(p.join(cacheFolder, sha+'.jpg'));
753
754 if(typeof imgCache != 'undefined' && exists)
755 correct.push(image.path);
756 else if(typeof imgCache != 'undefined')
757 errorOnlyData.push(image.path);
758 else if(exists)
759 errorOnlyFile.push(image.path);
760 else
761 notThumbnails.push(image.path);
762 }
763
764 console.log('Correct: '+correct.length+'\nError only file: '+errorOnlyFile.length+'\nError only data: '+errorOnlyData.length+'\nNot Thumbnails: '+notThumbnails.length);
765 console.log({
766 correct: correct,
767 errorOnlyFile: errorOnlyFile,
768 errorOnlyData: errorOnlyData,
769 notThumbnails: notThumbnails,
770 });
771 console.log(' ');
772}
773
774function validate()
775{

Callers 1

validateFunction · 0.85

Calls 1

sha1Function · 0.85

Tested by

no test coverage detected