diff --git a/fetchImages.js b/fetchImages.js index 0fbc567..e805e8f 100644 --- a/fetchImages.js +++ b/fetchImages.js @@ -62,12 +62,20 @@ async function getAlbumAssets() { const fileName = `${asset.id}_${asset.originalFileName || 'untitled'}`; const outputPath = path.join(config.outputDir, fileName); + // Add debug logging to understand the state + console.log(`Checking asset ${asset.id}:`); + console.log(`- Expected path: ${outputPath}`); + // Check if file already exists and is in our metadata const existingImage = existingImages.find(img => img.id === asset.id); - if (existingImage && fs.existsSync(existingImage.localPath)) { - console.log(`Skipping existing file: ${fileName}`); - images.push(existingImage); - continue; + if (existingImage) { + console.log(`- Found in metadata: ${existingImage.localPath}`); + if (fs.existsSync(existingImage.localPath)) { + console.log(`- File exists on disk, skipping download`); + images.push(existingImage); + continue; + } + console.log(`- File not found on disk at ${existingImage.localPath}`); } console.log(`Downloading: ${fileName}`);