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:
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user