diff --git a/porn-cinema.html b/porn-cinema.html index e673693..a02760d 100644 --- a/porn-cinema.html +++ b/porn-cinema.html @@ -191,6 +191,7 @@ + @@ -200,6 +201,28 @@ document.addEventListener('DOMContentLoaded', function() { console.log('🎬 Initializing Porn Cinema...'); + // Initialize desktop file manager if in Electron environment + if (window.electronAPI && typeof DesktopFileManager !== 'undefined') { + // Create a minimal data manager for the cinema (since we don't have the full game instance) + const minimalDataManager = { + get: (key) => { + try { + return JSON.parse(localStorage.getItem(key)); + } catch { + return null; + } + }, + set: (key, value) => { + localStorage.setItem(key, JSON.stringify(value)); + } + }; + + window.desktopFileManager = new DesktopFileManager(minimalDataManager); + console.log('🖥️ Desktop File Manager initialized for porn cinema'); + } else if (!window.electronAPI) { + console.warn('⚠️ Running in browser mode - video management limited'); + } + // Initialize the cinema window.pornCinema = new PornCinema(); window.pornCinema.initialize(); diff --git a/src/features/media/videoLibrary.js b/src/features/media/videoLibrary.js index 91f50a5..fb38433 100644 --- a/src/features/media/videoLibrary.js +++ b/src/features/media/videoLibrary.js @@ -60,26 +60,51 @@ class VideoLibrary { return; } - // Get video files from the desktop file manager - const videoData = await window.desktopFileManager.getVideoList(); + // Get video files from all categories + let allVideos = []; - if (!videoData || !videoData.videos) { + try { + const backgroundVideos = await window.desktopFileManager.scanDirectoryForVideos('background'); + const taskVideos = await window.desktopFileManager.scanDirectoryForVideos('tasks'); + const rewardVideos = await window.desktopFileManager.scanDirectoryForVideos('rewards'); + const punishmentVideos = await window.desktopFileManager.scanDirectoryForVideos('punishments'); + + allVideos = [ + ...backgroundVideos, + ...taskVideos, + ...rewardVideos, + ...punishmentVideos + ]; + + console.log(`📁 Found ${allVideos.length} videos total`); + } catch (error) { + console.error('Error scanning video directories:', error); + + // Fallback to localStorage + const storedVideos = JSON.parse(localStorage.getItem('videoFiles') || '{}'); + console.log('📁 Falling back to stored videos'); + + allVideos = Object.values(storedVideos).flat(); + } + + if (!allVideos || allVideos.length === 0) { console.log('No videos found'); - this.displayEmptyLibrary('No videos found'); + this.displayEmptyLibrary('No videos found. Upload some videos first!'); return; } // Process video data - this.videos = videoData.videos.map(video => ({ - name: video.name, - path: video.path, + this.videos = allVideos.map(video => ({ + name: video.title || video.name || 'Unknown Video', + path: video.path || video.filePath, size: video.size || 0, duration: video.duration || 0, thumbnail: video.thumbnail || null, resolution: video.resolution || 'Unknown', - format: video.format || 'mp4', + format: video.format || this.getFormatFromPath(video.path || video.filePath), bitrate: video.bitrate || 0, dateAdded: video.dateAdded || new Date().toISOString(), + category: video.category || 'unknown', qualities: this.detectVideoQualities(video) })); @@ -352,10 +377,22 @@ class VideoLibrary { displayEmptyLibrary(message) { this.libraryContent.innerHTML = `
${message}
- +To add videos to your library:
+