Fix Porn Cinema to use unified video library

- Updated VideoLibrary.loadVideoLibrary() to read from unifiedVideoLibrary storage
- Added fallback to legacy system if unified library not available
- Convert unified library format to VideoLibrary format properly
- Map video.source to category (individual vs directory)
- Should now show all 60 videos from unified library instead of just 6 individual files
This commit is contained in:
dilgenfritz 2025-11-03 16:06:27 -06:00
parent 4b16ce8ff2
commit 285bce4dac
1 changed files with 44 additions and 0 deletions

View File

@ -77,6 +77,50 @@ class VideoLibrary {
}
async loadVideoLibrary() {
try {
// First try to get from unified video library (new system)
const unifiedLibrary = JSON.parse(localStorage.getItem('unifiedVideoLibrary') || '{}');
if (unifiedLibrary.allVideos && unifiedLibrary.allVideos.length > 0) {
console.log(`📁 Loading from unified video library: ${unifiedLibrary.allVideos.length} videos`);
// Convert unified library format to VideoLibrary format
const allVideos = unifiedLibrary.allVideos.map(video => ({
name: video.name,
path: video.path,
size: video.size || 0,
duration: video.duration || 0,
thumbnail: video.thumbnail || null,
resolution: video.resolution || 'Unknown',
format: video.format || this.getFormatFromPath(video.path),
bitrate: video.bitrate || 0,
dateAdded: video.dateAdded || new Date().toISOString(),
category: video.source === 'individual' ? 'individual' : 'directory',
directory: video.directory || video.source || 'Unknown'
}));
console.log(`📁 Total videos loaded: ${allVideos.length}`);
console.log(`📁 From directories: ${allVideos.filter(v => v.category === 'directory').length}`);
console.log(`📁 Individual files: ${allVideos.filter(v => v.category === 'individual').length}`);
// Process video data with enhanced metadata
this.videos = allVideos;
console.log(`📁 Final total videos loaded: ${this.videos.length}`);
if (this.videos.length === 0) {
this.displayEmptyLibrary('No videos found. Add video directories or files in the main library first!');
return;
}
this.displayLibrary();
return;
}
} catch (e) {
console.warn('Error loading unified video library, falling back to legacy system:', e);
}
// Fallback to legacy system if unified library not available
console.log('📁 Falling back to legacy video loading system...');
try {
// Use the same video loading logic as the main library interface
let linkedDirs;