Improve video detection and fix image loading errors

- Add comprehensive video extension list and debugging to scanVideoDirectory
- Add missing createPlaceholderImage method to prevent image loading errors
- Enhanced logging to show raw file counts and sample files during video scanning
- Fix infinite error spam when images fail to load
This commit is contained in:
dilgenfritz 2025-11-03 19:49:04 -06:00
parent 0f0147db2a
commit 58a2ec0ab2
2 changed files with 42 additions and 2 deletions

View File

@ -4611,6 +4611,33 @@ ${usagePercent > 85 ? '⚠️ Storage getting full - consider deleting some imag
}, 3000);
}
createPlaceholderImage(text = 'Image Not Found') {
// Create a data URL for a simple placeholder image
const canvas = document.createElement('canvas');
canvas.width = 400;
canvas.height = 300;
const ctx = canvas.getContext('2d');
// Fill background
ctx.fillStyle = '#1a1a1a';
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Add border
ctx.strokeStyle = '#00d4ff';
ctx.lineWidth = 2;
ctx.strokeRect(1, 1, canvas.width - 2, canvas.height - 2);
// Add text
ctx.fillStyle = '#00d4ff';
ctx.font = '16px Arial';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.fillText(text, canvas.width / 2, canvas.height / 2 - 10);
ctx.fillText('📷', canvas.width / 2, canvas.height / 2 + 20);
return canvas.toDataURL();
}
startGame() {
// Clean up any existing interactive resources before starting new game
if (this.interactiveTaskManager) {

View File

@ -604,10 +604,23 @@ class DesktopFileManager {
return [];
}
const videoExtensions = ['.mp4', '.avi', '.mov', '.wmv', '.flv', '.webm', '.mkv', '.m4v'];
console.log(`🎬 Raw files found in ${directoryPath}:`, files.length);
// More comprehensive video extensions list
const videoExtensions = ['.mp4', '.avi', '.mov', '.wmv', '.flv', '.webm', '.mkv', '.m4v', '.mpg', '.mpeg', '.3gp', '.asf', '.rm', '.rmvb', '.vob', '.ts', '.mts', '.m2ts'];
// Debug: log first few files to see what we're working with
if (files.length > 0) {
console.log(`🎬 Sample files:`, files.slice(0, 5).map(f => ({ name: f.name, size: f.size })));
}
const videoFiles = files.filter(file => {
const ext = file.name.toLowerCase().substring(file.name.lastIndexOf('.'));
return videoExtensions.includes(ext);
const isVideo = videoExtensions.includes(ext);
if (isVideo) {
console.log(`🎬 Found video file: ${file.name} (${ext})`);
}
return isVideo;
});
console.log(`🎬 Found ${videoFiles.length} video files in ${directoryPath}`);