Refactor Dockerfile to execute start.sh and update .gitignore to exclude *.png files. Enhance fetchImages.js with improved path normalization and debug logging for asset checks, ensuring more reliable image fetching and processing.

This commit is contained in:
2024-12-28 10:56:15 -05:00
parent 09a34e2f38
commit ba39cb4af7
8 changed files with 16 additions and 11 deletions

View File

@@ -62,20 +62,22 @@ 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) {
console.log(`- Found in metadata: ${existingImage.localPath}`);
if (fs.existsSync(existingImage.localPath)) {
console.log(`- File exists on disk, skipping download`);
// Normalize the paths to ensure consistent comparison
const normalizedExistingPath = path.normalize(existingImage.localPath);
const normalizedOutputPath = path.normalize(outputPath);
console.log(`Checking paths:`);
console.log(`- Current path: ${normalizedOutputPath}`);
console.log(`- Existing path: ${normalizedExistingPath}`);
if (fs.existsSync(normalizedOutputPath)) {
console.log(`File exists, skipping: ${fileName}`);
images.push(existingImage);
continue;
}
console.log(`- File not found on disk at ${existingImage.localPath}`);
}
console.log(`Downloading: ${fileName}`);