From 5a43b4ba993e687c3d9cb2c82090bb95e242d533 Mon Sep 17 00:00:00 2001 From: dilgenfritz Date: Mon, 1 Dec 2025 21:39:50 -0600 Subject: [PATCH] cleanup library --- README.md | 650 ++---------------------------- index.html | 12 +- library.html | 12 + src/utils/desktop-file-manager.js | 264 +----------- src/utils/libraryManager.js | 159 +++++++- 5 files changed, 225 insertions(+), 872 deletions(-) diff --git a/README.md b/README.md index 6ad94ab..34ab328 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ๐ŸŽฎ Gooner Training Academy# ๐ŸŽฎ Gooner Training Academy# ๐ŸŽฎ Gooner Training Academy# Gooner Training Academy +# ๐ŸŽฎ Gooner Training Academy @@ -6,7 +6,7 @@ -A comprehensive adult edging training application featuring three specialized game modes, an advanced XP progression system, and professional media library management.*Master Your Dedication Through Advanced Training Systems* +A comprehensive adult edging training application featuring three specialized game modes, an advanced XP progression system, and professional media library management. @@ -14,7 +14,7 @@ A comprehensive adult edging training application featuring three specialized ga -## ๐Ÿš€ Quick StartA comprehensive adult edging training application featuring three specialized game modes, an advanced XP progression system, and professional media library management.*Master Your Dedication Through Advanced Training Systems**How long can you last?* +## ๐Ÿš€ Quick Start @@ -70,21 +70,6 @@ The Training Academy offers structured training programs through branching narra **Fast-start training with customizable sessions** -### ๐ŸŽฌ Training Academy - -Quick Play provides immediate access to task-based gameplay with streamlined setup and maximum customization control. - -**Immersive scenario-based training with progressive storylines** - -**Session Setup:** - -**Fast-start training with customizable sessions** - -### ๐ŸŽฌ Training Academy - -Quick Play provides immediate access to task-based gameplay with streamlined setup and maximum customization control. - -**Immersive scenario-based training with progressive storylines** **Session Setup:** @@ -207,7 +192,7 @@ The Library system provides centralized management for all your media content ac -### ๐Ÿ“ Library Organization### +### ๐Ÿ“ Library Organization - **Video Directories**- Real-time task filtering with persistent settings @@ -219,18 +204,14 @@ The Library system provides centralized management for all your media content ac - **Cross-Mode Access**: Available in all game modes- Session cleanup and statistics tracking - - - **Photo Collections**: Webcam integration for photo capture Content Management - **Upload System**: High-quality image upload (1600x1200 resolution) -- **Smart Categorization**: Tasks vs Consequences automatic sorting- Punishment system with consequence images - - **Gallery Management**: Pinterest-style layout with aspect ratio optimization -Dedicated video player system designed for focused media consumption with comprehensive viewing analytics.**Session Setup:**- **Custom Images**: Upload and categorize adult content (tasks vs consequences) + #### **Advanced Management** @@ -238,15 +219,20 @@ Dedicated video player system designed for focused media consumption with compre - **Dynamic Themes**: Library theme adapts to your uploaded content -- **Smart Compression**: Optimized storage without quality loss**Player Features:**- โฐ Flexible Duration: 15 minutes to 4+ hours- **Video Integration**: Link external video directories for seamless playback +- **Smart Compression**: Optimized storage without quality loss + +- **Video Integration**: Link external video directories for seamless playback - **Usage Analytics**: Track which content is most accessed -- ๐ŸŽฌ Professional Video Interface: Full-screen theater mode #### **Integration Across Modes** -- **Quick Play**: Background video selection and task images- ๐Ÿ“‹ Playlist Management: Organize viewing sessions- ๐ŸŽฌ Background Video Integration: 40+ videos available- **High-Quality Processing**: 1600x1200 resolution with smart compression +- **Quick Play**: + - Background video selection and task images + - ๐Ÿ“‹ Playlist Management: Organize viewing sessions + - ๐ŸŽฌ Background Video Integration: 40+ videos available + - **High-Quality Processing**: 1600x1200 resolution with smart compression - **Training Academy**: Scenario content and photo sessions @@ -254,7 +240,8 @@ Dedicated video player system designed for focused media consumption with compre - **Punishment System**: Consequence image selection -- ๐Ÿ”„ Multi-Screen Mode: 4-video grid for intensive sessions- ๐ŸŽ›๏ธ Individual Task Controls: Enable/disable specific tasks- **Storage Management**: 50 image limit with usage monitoring +- ๐Ÿ”„ Multi-Screen Mode: 4-video grid for intensive sessions- ๐ŸŽ›๏ธ Individual Task Controls: Enable/disable specific tasks + ### ๐Ÿ“Š Library Analytics @@ -262,23 +249,14 @@ Dedicated video player system designed for focused media consumption with compre - **๐Ÿ’พ Storage Monitoring**: Space usage and optimization suggestions -- **๐Ÿ”„ Sync Status**: Real-time directory scanning results- ๐ŸŽฏ Custom Task Creation: Add personalized challenges- **Bulk Operations**: Select, enable/disable, and delete multiple images +- **๐Ÿ”„ Sync Status**: Real-time directory scanning results - **๐Ÿ“‹ Content Health**: Missing files and broken links detection -**XP Rewards:** - ---- - -- โฑ๏ธ Viewing Time: **1 XP per 5 minutes** of active viewing - -## ๐ŸŽ›๏ธ Key Features - -- โœ… Video Completion: **Bonus XP** for 90%+ completion ### ๐Ÿ”’ Data Protection -- **Automatic Backups**: Every 30 minutes during active sessions- ๐Ÿ“Š Binge Sessions: **Additional rewards** for extended viewing**XP Rewards:**## ๏ฟฝ Quick Start +- **Automatic Backups**: Every 30 minutes during active sessions - **Manual Backup/Restore**: Full control over your data @@ -310,39 +288,32 @@ Dedicated video player system designed for focused media consumption with compre - **Professional UI**: Responsive, modern design -npm install - ---- - ---- ## ๐ŸŽฏ Controls & Navigation -**Features:**npm start | Control | Action | Mode Availability | -|---------|--------|-------------------|## โญ XP System Explained +|---------|--------|-------------------| | **Enter** | Complete current task | All modes | -| **Ctrl** | Skip task (triggers punishment) | Training, Quick Play |- Real-time task filtering with persistent settings``` +| **Ctrl** | Skip task (triggers punishment) | Training, Quick Play | | **Space/P** | Pause/Resume session | All modes | -| **M** | Toggle background music | All modes |### ๐Ÿ“ˆ Experience Points (XP) Overview +| **M** | Toggle background music | All modes | | **H** | Show help menu | All modes | -| **Escape** | Close dialogs/return to menu | All modes |The XP system tracks your dedication and progress across all training modes, providing a unified progression metric.- Background video with floating opacity controls - +| **Escape** | Close dialogs/return to menu | All modes | --- -## ๐Ÿ› ๏ธ Technical Architecture### ๐ŸŽฏ XP Sources by Mode- Session cleanup and statistics tracking### Web Browser +## ๐Ÿ› ๏ธ Technical Architecture @@ -390,39 +361,37 @@ webGame/| Mode | Activity | XP Reward | Notes |- Webcam integration for photo ca โ””โ”€โ”€ videos/ # Linked video directories -```### ๐ŸŽญ Porn Cinema## ๐ŸŽฏ Key Controls +``` - -### ๐Ÿ”ง Development Requirements### ๐Ÿ“Š Progression Levels +### ๐Ÿ“Š Progression Levels - **Node.js 16+**: For Electron desktop application -- **Modern Browser**: Chrome 90+, Firefox 88+, Safari 14+- **๐ŸŒฑ Beginner (0-100 XP)**: Learning the basics**Professional video viewing experience** +- **Modern Browser**: Chrome 90+, Firefox 88+, Safari 14+ - **Desktop Features**: File system access for media linking -- **Storage**: Minimum 100MB for application and user content- **๐Ÿ“ˆ Intermediate (100-500 XP)**: Building consistency +- **Storage**: Minimum 100MB for application and user content ----- **๐ŸŽฏ Advanced (500-1500 XP)**: Mastering techniques- **Enter** - Complete task -## ๐Ÿ“‹ Recent Major Updates- **๐Ÿ† Expert (1500+ XP)**: Peak dedication +## ๐Ÿ“‹ Recent Major Updates -### v4.0 - Comprehensive Backup System (November 12, 2025)Dedicated video player system designed for focused media consumption with comprehensive viewing analytics.- **Ctrl** - Skip task (triggers punishment) +### v4.0 - Comprehensive Backup System (November 12, 2025) - โœ… **Automatic Data Protection**: 30-minute backup intervals -- โœ… **Manual Backup Controls**: User-initiated backup/restore### ๐Ÿ” XP Tracking +- โœ… **Manual Backup Controls**: User-initiated backup/restore - โœ… **Export/Import System**: Portable data management -- โœ… **Emergency Backup Hooks**: Before reset operations- **Real-time Display**: Live XP counter in all game modes- **Space/P** - Pause/resume +- โœ… **Emergency Backup Hooks**: Before reset operations - โœ… **Data Loss Recovery**: Complete incident prevention system @@ -467,562 +436,3 @@ The Library system provides centralized management for all your media content ac --- - -## ๐ŸŽ“ Getting Started Guide - -### ๐Ÿ“ Library Organization- ๐ŸŽ›๏ธ Advanced Controls: Speed, volume, seeking, and more - -### 1. **First Launch** - - - Run the application via desktop app or open `index.html` - - - Complete the initial setup and library configuration - - - Link your video directories for enhanced experience#### **Video Directories**### Requirements - - - -### 2. **Library Setup**- **Automatic Discovery**: Scans linked directories for video files - - - Upload task and consequence images via Image Management - - - Link video directories for background content- **Format Support**: MP4, WebM, MOV, AVI, and more**XP Rewards:**- Modern web browser with webcam support - - - Organize content for optimal gameplay experience - -- **Smart Indexing**: Automatic categorization and metadata - -### 3. **Choose Your Path** - - - **New to Training**: Start with **Quick Play** for immediate access- **Cross-Mode Access**: Available in all game modes- โฑ๏ธ Viewing Time: **1 XP per 5 minutes** of active viewing- Local storage for saves and images - - - **Structured Learning**: Begin with **Training Academy** scenarios - - - **Media Focus**: Explore **Porn Cinema** for dedicated viewing - - - -### 4. **Progress Tracking**#### **Photo Collections**- โœ… Video Completion: **Bonus XP** for 90%+ completion- 50MB+ available storage for custom content - - - Monitor XP growth across all modes - - - Check statistics dashboard for detailed analytics- **Upload System**: High-quality image upload (1600x1200 resolution) - - - Use player profile to track achievements and milestones - -- **Smart Categorization**: Tasks vs Consequences automatic sorting- ๐Ÿ“Š Binge Sessions: **Additional rewards** for extended viewing - ---- - -- **Gallery Management**: Pinterest-style layout with aspect ratio optimization - -## ๐Ÿ“„ License - -- **Storage Limits**: 50 image maximum with usage monitoring### File Structure - -This project is licensed under the MIT License - see the LICENSE file for details. - - - -**Note**: This is adult content software intended for personal use by consenting adults. Please use responsibly and in accordance with local laws and regulations. -### ๐Ÿ”ง Library Features**Features:**``` - - - -#### **Media Linking**- Seamless integration with linked video directorieswebGame/ - -``` - -๐Ÿ“ Linked Directories:- Watch time and completion analyticsโ”œโ”€โ”€ index.html # Main interface - -โ”œโ”€โ”€ /videos/mainstream/ # General video content - -โ”œโ”€โ”€ /videos/specialized/ # Category-specific content - Favorite video trackingโ”œโ”€โ”€ porn-cinema.html # Professional video player - -โ”œโ”€โ”€ /images/tasks/ # Task-related images - -โ””โ”€โ”€ /images/consequences/ # Punishment images- Theater mode for distraction-free viewingโ”œโ”€โ”€ player-stats.html # Statistics dashboard - -``` - -- Multi-format video supportโ”œโ”€โ”€ user-profile.html # User profile and achievements - -#### **Advanced Management** - -- **Bulk Operations**: Select, enable/disable, delete multiple filesโ”œโ”€โ”€ src/ - -- **Dynamic Themes**: Library theme adapts to your uploaded content - -- **Smart Compression**: Optimized storage without quality loss---โ”‚ โ”œโ”€โ”€ core/ # Game engine and mode management - -- **Usage Analytics**: Track which content is most accessed - -โ”‚ โ”œโ”€โ”€ data/modes/ # Game mode data files - -#### **Integration Across Modes** - -- **Quick Play**: Background video selection and task images## โญ XP System Explainedโ”‚ โ”œโ”€โ”€ features/ - -- **Training Academy**: Scenario content and photo sessions - -- **Porn Cinema**: Full video library access with playlistsโ”‚ โ”‚ โ”œโ”€โ”€ media/ # Video players and cinema system - -- **Punishment System**: Consequence image selection - -### ๐Ÿ“ˆ Experience Points (XP) Overviewโ”‚ โ”‚ โ”œโ”€โ”€ stats/ # Player statistics tracking - -### ๐Ÿ“Š Library Analytics - -- **๐Ÿ“ˆ Content Usage**: Most viewed/used media trackingThe XP system tracks your dedication and progress across all training modes, providing a unified progression metric.โ”‚ โ”‚ โ”œโ”€โ”€ tasks/ # Interactive task management - -- **๐Ÿ’พ Storage Monitoring**: Space usage and optimization suggestions - -- **๐Ÿ”„ Sync Status**: Real-time directory scanning resultsโ”‚ โ”‚ โ””โ”€โ”€ ... # Audio, webcam, UI features - -- **๐Ÿ“‹ Content Health**: Missing files and broken links detection - -### ๐ŸŽฏ XP Sources by Modeโ”‚ โ””โ”€โ”€ styles/ # CSS and themes - ---- - -โ”œโ”€โ”€ images/ # Image storage - -## ๐ŸŽ›๏ธ Key Features - -| Mode | Activity | XP Reward | Notes |โ”œโ”€โ”€ audio/ # Background music - -### ๐Ÿ”’ Data Protection - -- **Automatic Backups**: Every 30 minutes during active sessions|------|----------|-----------|-------|โ”œโ”€โ”€ videos/ # Video file organization - -- **Manual Backup/Restore**: Full control over your data - -- **Export/Import**: Portable data management| **Training Academy** | Time Training | 1 XP / 2 minutes | Passive time-based reward |โ””โ”€โ”€ package.json # Electron app config - -- **Emergency Backups**: Before any reset operations - -| | Webcam Activity | 1 XP / minute | Active engagement bonus |``` - -### ๐ŸŽจ Customization - -- **6 Visual Themes**: Including dynamic Library theme| | Photo Session | 2 XP / photo | Achievement-based reward | - -- **Task Disable Toggles**: Individual control in Quick Play - -- **Adaptive Difficulty**: Progressive timer scaling| **Quick Play** | Task Completion | 1-3 XP | Speed-based scaling |### Features - -- **Personal Content**: Upload and organize your media - -| | Session Bonus | 2 XP / 15 min | Consistency reward |- **Cross-Platform**: Windows, Mac, Linux via Electron - -### ๐Ÿ–ฅ๏ธ Technical Excellence - -- **Cross-Platform**: Windows, Mac, Linux support| | Recording Bonus | +1 XP | Additional engagement |- **Responsive Design**: Works on desktop and mobile - -- **Electron Desktop App**: Native OS integration - -- **Web Browser Compatible**: No installation required| **Porn Cinema** | Video Viewing | 1 XP / 5 minutes | Engagement tracking |- **Local Storage**: All data stays on your device - -- **Professional UI**: Responsive, modern design - -| | Video Completion | Bonus XP | 90%+ completion required |- **Privacy-First**: No data sent to servers - ---- - - - -## ๐ŸŽฏ Controls & Navigation - -### ๐Ÿ“Š Progression Levels## ๐Ÿ“‹ Recent Updates - -| Control | Action | Mode Availability | - -|---------|--------|-------------------|- **๐ŸŒฑ Beginner (0-100 XP)**: Learning the basics - -| **Enter** | Complete current task | All modes | - -| **Ctrl** | Skip task (triggers punishment) | Training, Quick Play |- **๐Ÿ“ˆ Intermediate (100-500 XP)**: Building consistency ### v3.3 - Media Library Consolidation & Theme System (November 11, 2025) - -| **Space/P** | Pause/Resume session | All modes | - -| **M** | Toggle background music | All modes |- **๐ŸŽฏ Advanced (500-1500 XP)**: Mastering techniques- โœ… **Complete Media Library Cleanup**: 3-phase consolidation removing 500+ lines of duplicate code - -| **H** | Show help menu | All modes | - -| **Escape** | Close dialogs/return to menu | All modes |- **๐Ÿ† Expert (1500+ XP)**: Peak dedication - Phase 1: Unified video gallery system (lib-video-gallery) - - - ---- - Phase 2: Consolidated image management (lib-image-gallery) - - - -## ๐Ÿ› ๏ธ Technical Architecture### ๐Ÿ” XP Tracking - Phase 3: Streamlined audio system (lib-audio-gallery) - - - -### ๐Ÿ“‚ Core Structure- **Real-time Display**: Live XP counter in all game modes- โœ… **Advanced Theme System**: 6 visual themes (hentai, pornstars, BBC, feet, library, none) - -``` - -webGame/- **Session Summaries**: XP earned per session with breakdowns- โœ… **Dynamic Library Theme**: Pinterest-style layout using user's personal image collection - -โ”œโ”€โ”€ index.html # Main hub and library management - -โ”œโ”€โ”€ quick-play.html # Quick Play game mode- **Statistics Dashboard**: Comprehensive XP analytics- โœ… **Smart Image Layout**: Dynamic container sizing based on aspect ratios with gap-free stacking - -โ”œโ”€โ”€ training-academy.html # Training Academy mode - -โ”œโ”€โ”€ porn-cinema.html # Video player system- **Progress Visualization**: Charts and progression metrics- โœ… **Enhanced File Handling**: Proper URI encoding for special characters in file paths - -โ”œโ”€โ”€ player-stats.html # Statistics dashboard - -โ”œโ”€โ”€ user-profile.html # Profile and achievements - -โ”œโ”€โ”€ src/ - -โ”‚ โ”œโ”€โ”€ core/ # Game engine and state management---### v3.2 - Task Management & Session Cleanup (November 6, 2025) - -โ”‚ โ”œโ”€โ”€ data/modes/ # Game mode configurations - -โ”‚ โ”œโ”€โ”€ features/ # Modular feature systems- โœ… **Task Disable Toggles**: Individual task control with persistent localStorage settings - -โ”‚ โ”‚ โ”œโ”€โ”€ media/ # Video players and media management - -โ”‚ โ”‚ โ”œโ”€โ”€ stats/ # XP and statistics tracking## ๐Ÿ“š Library System Explained- โœ… **Consequence System Integration**: Disabled tasks filtered from consequence selection - -โ”‚ โ”‚ โ”œโ”€โ”€ tasks/ # Interactive task system - -โ”‚ โ”‚ โ””โ”€โ”€ ui/ # User interface components- โœ… **ID Consistency**: Fixed task ID generation to handle both numeric and generated IDs - -โ”‚ โ”œโ”€โ”€ styles/ # CSS themes and styling - -โ”‚ โ””โ”€โ”€ utils/ # Utility functions and helpers### ๐ŸŽฌ Video Library Management- โœ… **Session Cleanup**: Comprehensive endGame cleanup stopping videos and periodic popups - -โ”œโ”€โ”€ images/ # User-uploaded image library - -โ”œโ”€โ”€ audio/ # Background music collectionThe Library system provides centralized management for all your media content across game modes.- โœ… **Debug System**: Extensive console logging for task state tracking and troubleshooting - -โ””โ”€โ”€ videos/ # Linked video directories - -``` - - - -### ๐Ÿ”ง Development Requirements### ๐Ÿ“ Library Organization### v3.1 - Quick Play Background Video System (November 3, 2025) - -- **Node.js 16+**: For Electron desktop application - -- **Modern Browser**: Chrome 90+, Firefox 88+, Safari 14+- โœ… **Quick Play Mode**: New fast-start game mode with streamlined interface - -- **Desktop Features**: File system access for media linking - -- **Storage**: Minimum 100MB for application and user content#### **Video Directories**- โœ… **Background Video Integration**: Independent video system with 46+ videos detected - - - ----- **Automatic Discovery**: Scans linked directories for video files- โœ… **Compact Video Controls**: Floating controls with opacity cycling (hidden/dim/normal/bright) - - - -## ๐Ÿ“‹ Recent Major Updates- **Format Support**: MP4, WebM, MOV, AVI, and more- โœ… **Video Visibility Toggle**: Quick on/off button with eye icon for instant control - - - -### v4.0 - Comprehensive Backup System (November 12, 2025)- **Smart Indexing**: Automatic categorization and metadata- โœ… **Independent Game Logic**: Isolated Quick Play mode preventing main game interference - -- โœ… **Automatic Data Protection**: 30-minute backup intervals - -- โœ… **Manual Backup Controls**: User-initiated backup/restore- **Cross-Mode Access**: Available in all game modes- โœ… **Real Task Integration**: Full integration with 17 mainGameData tasks and 60 task images - -- โœ… **Export/Import System**: Portable data management - -- โœ… **Emergency Backup Hooks**: Before reset operations- โœ… **VideoLibrary Scanning**: Custom video detection system using existing linked directories - -- โœ… **Data Loss Recovery**: Complete incident prevention system - -#### **Photo Collections**- โœ… **Enhanced Timer System**: Fixed countdown functionality with proper Quick Play isolation - -### v3.3 - Media Library Consolidation (November 11, 2025) - -- โœ… **Unified Gallery System**: Single media management interface- **Upload System**: High-quality image upload (1600x1200 resolution) - -- โœ… **Dynamic Library Theme**: User content-based theming - -- โœ… **Pinterest Layout**: Aspect ratio-optimized image display- **Smart Categorization**: Tasks vs Consequences automatic sorting### v3.0 - Professional Media System (October 31, 2025) - -- โœ… **Advanced Organization**: Smart categorization and bulk operations - -- **Gallery Management**: Pinterest-style layout with aspect ratio optimization- โœ… **Complete Porn Cinema**: Professional video player with playlists, progress bars, and theater mode - -### v3.2 - Quick Play Enhancement (November 6, 2025) - -- โœ… **Task Disable Toggles**: Individual task control system- **Storage Limits**: 50 image maximum with usage monitoring- โœ… **Multi-Screen Quad Player**: 4-video grid layout for intensive training with minimize/restore functionality - -- โœ… **Persistent Settings**: Configuration memory across sessions - -- โœ… **Real-time Filtering**: Dynamic task exclusion- โœ… **BaseVideoPlayer Architecture**: Reusable video components across all game modes - -- โœ… **Enhanced Debugging**: Comprehensive logging system - -### ๐Ÿ”ง Library Features- โœ… **Video Library Integration**: Seamless access to external video directories - -### v3.1 - Background Video Integration (November 3, 2025) - -- โœ… **Seamless Video Playback**: Background videos during gameplay- โœ… **Player Statistics & Profiles**: Watch time tracking, achievements, and user progression - -- โœ… **Opacity Controls**: Floating video control system - -- โœ… **40+ Video Integration**: Comprehensive video library access#### **Media Linking**- โœ… **Focus Video Interruptions**: Video overlays during training scenarios - -- โœ… **Multi-Mode Support**: Video features across all game modes - -```- โœ… **Enhanced Training Integration**: Multi-screen mode button in interactive tasks - ---- - -๐Ÿ“ Linked Directories: - -## ๐ŸŽ“ Getting Started Guide - -โ”œโ”€โ”€ /videos/mainstream/ # General video content### v2.0 - Major Content Update - -### 1. **First Launch** - - - Run the application via desktop app or open `index.html`โ”œโ”€โ”€ /videos/specialized/ # Category-specific content - โœ… Added 7 specialized game modes with rich content - - - Complete the initial setup and library configuration - - - Link your video directories for enhanced experienceโ”œโ”€โ”€ /images/tasks/ # Task-related images- โœ… Implemented progressive endurance training system - - - -### 2. **Library Setup**โ””โ”€โ”€ /images/consequences/ # Punishment images- โœ… Enhanced interactive task management - - - Upload task and consequence images via Image Management - - - Link video directories for background content```- โœ… Webcam integration for mirror and photography tasks - - - Organize content for optimal gameplay experience - -- โœ… Modular data system for better organization - -### 3. **Choose Your Path** - - - **New to Training**: Start with **Quick Play** for immediate access#### **Advanced Management**- โœ… Removed deprecated scenario mode - - - **Structured Learning**: Begin with **Training Academy** scenarios - - - **Media Focus**: Explore **Porn Cinema** for dedicated viewing- **Bulk Operations**: Select, enable/disable, delete multiple files - - - -### 4. **Progress Tracking**- **Dynamic Themes**: Library theme adapts to your uploaded content### v1.4 - Enhanced Image System - - - Monitor XP growth across all modes - - - Check statistics dashboard for detailed analytics- **Smart Compression**: Optimized storage without quality loss- โœ… Categorized image management (tasks vs consequences) - - - Use player profile to track achievements and milestones - -- **Usage Analytics**: Track which content is most accessed- โœ… High-quality compression and processing - ---- - -- โœ… Storage quota management - -## ๐Ÿ“„ License - -#### **Integration Across Modes**- โœ… Bulk operations and selection - -This project is licensed under the MIT License - see the LICENSE file for details. - -- **Quick Play**: Background video selection and task images - -**Note**: This is adult content software intended for personal use by consenting adults. Please use responsibly and in accordance with local laws and regulations. -- **Training Academy**: Scenario content and photo sessions## License - -- **Porn Cinema**: Full video library access with playlists - -- **Punishment System**: Consequence image selection[Add your preferred license here] - -### ๐Ÿ“Š Library Analytics -- **๐Ÿ“ˆ Content Usage**: Most viewed/used media tracking -- **๐Ÿ’พ Storage Monitoring**: Space usage and optimization suggestions -- **๐Ÿ”„ Sync Status**: Real-time directory scanning results -- **๐Ÿ“‹ Content Health**: Missing files and broken links detection - ---- - -## ๐ŸŽ›๏ธ Key Features - -### ๐Ÿ”’ Data Protection -- **Automatic Backups**: Every 30 minutes during active sessions -- **Manual Backup/Restore**: Full control over your data -- **Export/Import**: Portable data management -- **Emergency Backups**: Before any reset operations - -### ๐ŸŽจ Customization -- **6 Visual Themes**: Including dynamic Library theme -- **Task Disable Toggles**: Individual control in Quick Play -- **Adaptive Difficulty**: Progressive timer scaling -- **Personal Content**: Upload and organize your media - -### ๐Ÿ–ฅ๏ธ Technical Excellence -- **Cross-Platform**: Windows, Mac, Linux support -- **Electron Desktop App**: Native OS integration -- **Web Browser Compatible**: No installation required -- **Professional UI**: Responsive, modern design - ---- - -## ๐ŸŽฏ Controls & Navigation - -| Control | Action | Mode Availability | -|---------|--------|-------------------| -| **Enter** | Complete current task | All modes | -| **Ctrl** | Skip task (triggers punishment) | Training, Quick Play | -| **Space/P** | Pause/Resume session | All modes | -| **M** | Toggle background music | All modes | -| **H** | Show help menu | All modes | -| **Escape** | Close dialogs/return to menu | All modes | - ---- - -## ๐Ÿ› ๏ธ Technical Architecture - -### ๐Ÿ“‚ Core Structure -``` -webGame/ -โ”œโ”€โ”€ index.html # Main hub and library management -โ”œโ”€โ”€ quick-play.html # Quick Play game mode -โ”œโ”€โ”€ training-academy.html # Training Academy mode -โ”œโ”€โ”€ porn-cinema.html # Video player system -โ”œโ”€โ”€ hypno-gallery.html # Immersive slideshow system -โ”œโ”€โ”€ player-stats.html # Statistics dashboard -โ”œโ”€โ”€ user-profile.html # Profile and achievements -โ”œโ”€โ”€ scripts/ # Installation and launch scripts -โ”‚ โ”œโ”€โ”€ setup.bat # Windows installer -โ”‚ โ”œโ”€โ”€ setup.sh # Mac/Linux installer -โ”‚ โ”œโ”€โ”€ Start-webgame.bat # Windows launcher -โ”‚ โ””โ”€โ”€ create-distribution.* # Distribution builders -โ”œโ”€โ”€ docs/ # Documentation and guides -โ”‚ โ”œโ”€โ”€ HYPNO-GALLERY-README.md # Hypno Gallery documentation -โ”‚ โ”œโ”€โ”€ INSTALLATION_GUIDE.md # Setup instructions -โ”‚ โ”œโ”€โ”€ TESTER_GUIDE.md # Testing instructions -โ”‚ โ”œโ”€โ”€ ROADMAP.md # Development roadmap -โ”‚ โ””โ”€โ”€ archive/ # Archived documentation -โ”œโ”€โ”€ src/ -โ”‚ โ”œโ”€โ”€ core/ # Game engine and state management -โ”‚ โ”œโ”€โ”€ data/modes/ # Game mode configurations -โ”‚ โ”œโ”€โ”€ features/ # Modular feature systems -โ”‚ โ”‚ โ”œโ”€โ”€ media/ # Video players and media management -โ”‚ โ”‚ โ”œโ”€โ”€ stats/ # XP and statistics tracking -โ”‚ โ”‚ โ”œโ”€โ”€ tasks/ # Interactive task system -โ”‚ โ”‚ โ””โ”€โ”€ ui/ # User interface components -โ”‚ โ”œโ”€โ”€ styles/ # CSS themes and styling -โ”‚ โ””โ”€โ”€ utils/ # Utility functions and helpers -โ”œโ”€โ”€ images/ # User-uploaded image library -โ”œโ”€โ”€ audio/ # Background music collection -โ””โ”€โ”€ videos/ # Linked video directories -``` - -### ๐Ÿ”ง Development Requirements -- **Node.js 16+**: For Electron desktop application -- **Modern Browser**: Chrome 90+, Firefox 88+, Safari 14+ -- **Desktop Features**: File system access for media linking -- **Storage**: Minimum 100MB for application and user content - ---- - -## ๐Ÿ“‹ Recent Major Updates - -### v4.1 - Critical Stability & Performance Update (November 26, 2025) -- โœ… **Quick Play Session Cleanup**: Complete timer and video cleanup on end session - - Fixed timers continuing after end session (taskTimer, gameTimerInterval, xpDisplayInterval, recordingTimerInterval) - - Enhanced video stopping with comprehensive cleanup (pause, mute, reset, clear source) - - Added debug logging to track timer IDs and video element cleanup -- โœ… **Function Spam Prevention**: Added game state guards to prevent functions running after session ends - - Guards in syncTaskWithOverlay(), updateRecordingOverlay(), updateTimerDisplay() - - Checks `!isGameRunning || window.isEndingGame` before execution - - Eliminated console spam and unnecessary processing -- โœ… **Porn Cinema Memory Leak Fix**: CRITICAL fix preventing crashes from event listener accumulation - - Changed from individual button listeners to event delegation pattern - - Single parent listener handles all playlist button clicks via event bubbling - - Prevents exponential memory growth during extended sessions -- โœ… **Porn Cinema Error Handling**: User-friendly error recovery system - - Try-catch wrapper for initialization with styled error overlay - - Retry and home buttons for crash recovery - - Null checks for missing DOM elements (theater mode buttons) -- โœ… **Porn Cinema Cleanup System**: Comprehensive destroy() method for proper resource cleanup - - Removes event listeners, stops and unloads videos, clears playlist data - - Window close handlers (beforeunload, pagehide) trigger automatic cleanup - - Prevents memory leaks when closing porn cinema window -- โœ… **Enhanced Theme System**: 6 visual themes with dynamic Library theme option - - Static themes: Hentai, Pornstars, BBC, Feet - - Dynamic Library theme: Pinterest-style layout using user's personal image collection - - Theme customization via dropdown in Options menu - - None option to disable all background images -- โœ… **Desktop Photo Storage**: Webcam photos now saved to file system in desktop app - - Photos saved to `photos/captured/` directory - - Organized by session type (training-academy, dress-up, etc.) - - File-based storage instead of localStorage for better performance - - Automatic fallback to data URLs in browser mode - - Photo gallery access with download and management options - -### v4.0 - Comprehensive Backup System (November 12, 2025) -- โœ… **Automatic Data Protection**: 30-minute backup intervals -- โœ… **Manual Backup Controls**: User-initiated backup/restore -- โœ… **Export/Import System**: Portable data management -- โœ… **Emergency Backup Hooks**: Before reset operations -- โœ… **Data Loss Recovery**: Complete incident prevention system - -### v3.3 - Media Library Consolidation (November 11, 2025) -- โœ… **Unified Gallery System**: Single media management interface -- โœ… **Dynamic Library Theme**: User content-based theming -- โœ… **Pinterest Layout**: Aspect ratio-optimized image display -- โœ… **Advanced Organization**: Smart categorization and bulk operations - -### v3.2 - Quick Play Enhancement (November 6, 2025) -- โœ… **Task Disable Toggles**: Individual task control system -- โœ… **Persistent Settings**: Configuration memory across sessions -- โœ… **Real-time Filtering**: Dynamic task exclusion -- โœ… **Enhanced Debugging**: Comprehensive logging system - -### v3.1 - Background Video Integration (November 3, 2025) -- โœ… **Seamless Video Playback**: Background videos during gameplay -- โœ… **Opacity Controls**: Floating video control system -- โœ… **40+ Video Integration**: Comprehensive video library access -- โœ… **Multi-Mode Support**: Video features across all game modes - ---- - -## ๐ŸŽ“ Getting Started Guide - -### 1. **First Launch** - - Run the application via desktop app or open `index.html` - - Complete the initial setup and library configuration - - Link your video directories for enhanced experience - -### 2. **Library Setup** - - Upload task and consequence images via Image Management - - Link video directories for background content - - Organize content for optimal gameplay experience - -### 3. **Choose Your Path** - - **New to Training**: Start with **Quick Play** for immediate access - - **Structured Learning**: Begin with **Training Academy** scenarios - - **Media Focus**: Explore **Porn Cinema** for dedicated viewing - -### 4. **Progress Tracking** - - Monitor XP growth across all modes - - Check statistics dashboard for detailed analytics - - Use player profile to track achievements and milestones - ---- - -## ๐Ÿ“„ License - -This project is licensed under the MIT License - see the LICENSE file for details. - -**Note**: This is adult content software intended for personal use by consenting adults. Please use responsibly and in accordance with local laws and regulations. \ No newline at end of file diff --git a/index.html b/index.html index 52d6b7b..ce1dec2 100644 --- a/index.html +++ b/index.html @@ -3669,8 +3669,18 @@ // Initialize desktop file manager if in Electron environment if (window.electronAPI && typeof DesktopFileManager !== 'undefined') { window.desktopFileManager = new DesktopFileManager(window.game?.dataManager); - console.log('? Desktop File Manager initialized for video management'); + console.log('๐Ÿ“ Desktop File Manager initialized for video management'); + // Clean up legacy localStorage video directories + const legacyDirs = localStorage.getItem('linkedVideoDirectories'); + const legacyIndividual = localStorage.getItem('linkedIndividualVideos'); + if (legacyDirs || legacyIndividual) { + console.log('๐Ÿงน Cleaning up legacy localStorage video directories...'); + localStorage.removeItem('linkedVideoDirectories'); + localStorage.removeItem('linkedIndividualVideos'); + console.log('โœ… Legacy video directory storage cleared'); + } + // Initialize the new unified video system setTimeout(() => { updateDirectoryList(); diff --git a/library.html b/library.html index 529ca54..587797d 100644 --- a/library.html +++ b/library.html @@ -773,6 +773,8 @@

๐ŸŽต Audio Library Management

+

WORK IN PROGRESS - FEATURE TO COME

+

Organize your background music and ambient sounds

@@ -1124,6 +1126,16 @@ console.log('๐Ÿ“ธ isElectron:', window.desktopFileManager?.isElectron); console.log('๐Ÿ“ธ photoDirectory:', window.desktopFileManager?.photoDirectory); console.log('๐Ÿ“ธ Linked video directories:', window.desktopFileManager?.externalVideoDirectories?.length); + + // Clean up legacy localStorage video directories + const legacyDirs = localStorage.getItem('linkedVideoDirectories'); + const legacyIndividual = localStorage.getItem('linkedIndividualVideos'); + if (legacyDirs || legacyIndividual) { + console.log('๐Ÿงน Cleaning up legacy localStorage video directories...'); + localStorage.removeItem('linkedVideoDirectories'); + localStorage.removeItem('linkedIndividualVideos'); + console.log('โœ… Legacy video directory storage cleared'); + } } updateProgress(30, 'Loading image library...'); diff --git a/src/utils/desktop-file-manager.js b/src/utils/desktop-file-manager.js index ebe5516..9f8c662 100644 --- a/src/utils/desktop-file-manager.js +++ b/src/utils/desktop-file-manager.js @@ -3,20 +3,6 @@ class DesktopFileManager { constructor(dataManager) { this.dataManager = dataManager; this.appPath = null; - this.imageDirectories = { - tasks: null, - consequences: null - }; - this.audioDirectories = { - background: null, - ambient: null - }; - this.videoDirectories = { - background: null, - tasks: null, - rewards: null, - punishments: null - }; this.photoDirectory = null; // Directory for captured photos this.videoRecordingDirectory = null; // Directory for recorded videos @@ -42,27 +28,10 @@ class DesktopFileManager { try { this.appPath = await window.electronAPI.getAppPath(); if (this.appPath) { - this.imageDirectories.tasks = await window.electronAPI.pathJoin(this.appPath, 'images', 'tasks'); - this.imageDirectories.consequences = await window.electronAPI.pathJoin(this.appPath, 'images', 'consequences'); - - this.audioDirectories.background = await window.electronAPI.pathJoin(this.appPath, 'audio', 'background'); - this.audioDirectories.ambient = await window.electronAPI.pathJoin(this.appPath, 'audio', 'ambient'); - - this.videoDirectories.background = await window.electronAPI.pathJoin(this.appPath, 'videos', 'background'); - this.videoDirectories.tasks = await window.electronAPI.pathJoin(this.appPath, 'videos', 'tasks'); - this.videoDirectories.rewards = await window.electronAPI.pathJoin(this.appPath, 'videos', 'rewards'); - this.videoDirectories.punishments = await window.electronAPI.pathJoin(this.appPath, 'videos', 'punishments'); - this.photoDirectory = await window.electronAPI.pathJoin(this.appPath, 'photos', 'captured'); this.videoRecordingDirectory = await window.electronAPI.pathJoin(this.appPath, 'videos', 'recorded'); // Ensure directories exist - await window.electronAPI.createDirectory(this.imageDirectories.tasks); - await window.electronAPI.createDirectory(this.imageDirectories.consequences); - - await window.electronAPI.createDirectory(this.audioDirectories.background); - await window.electronAPI.createDirectory(this.audioDirectories.ambient); - await window.electronAPI.createDirectory(this.photoDirectory); await window.electronAPI.createDirectory(this.videoRecordingDirectory); @@ -71,8 +40,6 @@ class DesktopFileManager { console.log('Desktop file manager initialized'); console.log('App path:', this.appPath); - console.log('Image directories:', this.imageDirectories); - console.log('Audio directories:', this.audioDirectories); console.log('Photo directory:', this.photoDirectory); console.log('Video recording directory:', this.videoRecordingDirectory); @@ -94,132 +61,17 @@ class DesktopFileManager { } async selectAndImportImages(category = 'task') { - if (!this.isElectron) { - this.showNotification('File import only available in desktop version', 'warning'); - return []; - } - - try { - // Open file dialog - const filePaths = await window.electronAPI.selectImages(); - - if (filePaths.length === 0) { - return []; - } - - const importedImages = []; - const targetDir = category === 'task' ? this.imageDirectories.tasks : this.imageDirectories.consequences; - - if (!targetDir) { - console.error('Target directory not initialized'); - this.showNotification('Directory not initialized', 'error'); - return []; - } - - for (const filePath of filePaths) { - const fileName = filePath.split(/[\\/]/).pop(); - const targetPath = await window.electronAPI.pathJoin(targetDir, fileName); - - // Copy file to app directory - const success = await window.electronAPI.copyImage(filePath, targetPath); - - if (success) { - importedImages.push({ - name: fileName, - path: targetPath, - category: category - }); - console.log(`Imported: ${fileName} to ${category}`); - } else { - console.error(`Failed to import: ${fileName}`); - } - } - - if (importedImages.length > 0) { - // Update the game's image storage - await this.updateImageStorage(importedImages); - this.showNotification(`Imported ${importedImages.length} image(s) to ${category}!`, 'success'); - } - - return importedImages; - - } catch (error) { - console.error('Error importing images:', error); - this.showNotification('Failed to import images', 'error'); - return []; - } + // Legacy method - no longer supported (use linked directories instead) + console.warn('selectAndImportImages is deprecated - images should come from linked directories'); + this.showNotification('Image import not supported - use linked directories', 'warning'); + return []; } async selectAndImportAudio(category = 'background') { - if (!this.isElectron) { - this.showNotification('Audio import only available in desktop version', 'warning'); - return []; - } - - try { - // Open file dialog for audio files - const filePaths = await window.electronAPI.selectAudio(); - - if (filePaths.length === 0) { - return []; - } - - const importedAudio = []; - let targetDir; - - switch(category) { - case 'background': - targetDir = this.audioDirectories.background; - break; - case 'ambient': - targetDir = this.audioDirectories.ambient; - break; - case 'effects': - targetDir = this.audioDirectories.effects; - break; - default: - targetDir = this.audioDirectories.background; - } - - if (!targetDir) { - console.error('Target audio directory not initialized'); - this.showNotification('Audio directory not initialized', 'error'); - return []; - } - - for (const filePath of filePaths) { - const fileName = filePath.split(/[\\/]/).pop(); - const targetPath = await window.electronAPI.pathJoin(targetDir, fileName); - - // Copy file to app directory - const success = await window.electronAPI.copyAudio(filePath, targetPath); - - if (success) { - importedAudio.push({ - name: fileName, - path: targetPath, - category: category, - title: this.getAudioTitle(fileName) - }); - console.log(`Imported audio: ${fileName} to ${category}`); - } else { - console.error(`Failed to import audio: ${fileName}`); - } - } - - if (importedAudio.length > 0) { - // Update the game's audio storage - await this.updateAudioStorage(importedAudio); - this.showNotification(`Imported ${importedAudio.length} audio file(s) to ${category}!`, 'success'); - } - - return importedAudio; - - } catch (error) { - console.error('Error importing audio:', error); - this.showNotification('Failed to import audio files', 'error'); - return []; - } + // Legacy method - no longer supported + console.warn('selectAndImportAudio is deprecated'); + this.showNotification('Audio import not supported', 'warning'); + return []; } async selectAndImportVideos(category = 'background') { @@ -689,30 +541,9 @@ class DesktopFileManager { } async scanDirectoryForImages(category = 'task') { - if (!this.isElectron) { - return []; - } - - try { - const targetDir = category === 'task' ? this.imageDirectories.tasks : this.imageDirectories.consequences; - - if (!targetDir) { - console.error(`Target directory not initialized for ${category}`); - return []; - } - - const images = await window.electronAPI.readDirectory(targetDir); - - console.log(`Found ${images.length} images in ${category} directory`); - return images.map(img => ({ - ...img, - category: category - })); - - } catch (error) { - console.error(`Error scanning ${category} directory:`, error); - return []; - } + // Legacy method - no longer used (images now come from linked directories) + console.warn('scanDirectoryForImages is deprecated - use linked directories instead'); + return []; } async updateImageStorage(images) { @@ -810,67 +641,15 @@ class DesktopFileManager { } async scanDirectoryForAudio(category = 'background') { - if (!this.isElectron) { - return []; - } - - try { - let targetDir; - - switch(category) { - case 'background': - targetDir = this.audioDirectories.background; - break; - case 'ambient': - targetDir = this.audioDirectories.ambient; - break; - case 'effects': - targetDir = this.audioDirectories.effects; - break; - default: - targetDir = this.audioDirectories.background; - } - - if (!targetDir) { - console.error(`Target audio directory not initialized for ${category}`); - return []; - } - - const audioFiles = await window.electronAPI.readAudioDirectory(targetDir); - - console.log(`Found ${audioFiles.length} audio files in ${category} directory`); - return audioFiles.map(audio => ({ - ...audio, - category: category, - title: this.getAudioTitle(audio.name) - })); - - } catch (error) { - console.error(`Error scanning ${category} audio directory:`, error); - return []; - } + // Legacy method - no longer supported + console.warn('scanDirectoryForAudio is deprecated'); + return []; } async scanAllAudioDirectories() { - if (!this.isElectron) { - this.showNotification('Audio directory scanning only available in desktop version', 'warning'); - return { background: [], ambient: [] }; - } - - const backgroundAudio = await this.scanDirectoryForAudio('background'); - const ambientAudio = await this.scanDirectoryForAudio('ambient'); - - const results = { - background: backgroundAudio, - ambient: ambientAudio - }; - - // Update game audio storage - if (backgroundAudio.length > 0 || ambientAudio.length > 0) { - await this.updateAudioStorage([...backgroundAudio, ...ambientAudio]); - } - - return results; + // Legacy method - no longer supported + console.warn('scanAllAudioDirectories is deprecated'); + return { background: [], ambient: [] }; } async updateAudioStorage(audioFiles) { @@ -987,12 +766,9 @@ class DesktopFileManager { } getImagePath(imageName, category = 'task') { - if (!this.isElectron) { - return `images/${category}s/${imageName}`; - } - - const dir = this.imageDirectories[category === 'task' ? 'tasks' : 'consequences']; - return `${dir}/${imageName}`; + // Legacy method - return web path + console.warn('getImagePath is deprecated'); + return `images/${category}s/${imageName}`; } getVideoTitle(fileName) { diff --git a/src/utils/libraryManager.js b/src/utils/libraryManager.js index 44eacf2..4336e93 100644 --- a/src/utils/libraryManager.js +++ b/src/utils/libraryManager.js @@ -1447,6 +1447,83 @@ function handleVideoDirectoryResult(result) { } function addVideoDirectory(directoryPath) { + // Use desktopFileManager if available (preferred method) + if (window.desktopFileManager && window.electronAPI) { + console.log('๐Ÿ“ Adding directory via desktopFileManager:', directoryPath); + + // Check if already exists + if (window.desktopFileManager.externalVideoDirectories.some(dir => dir.path === directoryPath)) { + if (window.game && window.game.showNotification) { + window.game.showNotification('Directory already linked', 'warning'); + } + return; + } + + // Scan directory and add it manually + (async () => { + try { + if (window.game && window.game.showNotification) { + window.game.showNotification('๐Ÿ” Scanning directory for videos...', 'info'); + } + + const videoFiles = await window.electronAPI.readVideoDirectoryRecursive(directoryPath); + console.log(`Found ${videoFiles.length} video files in ${directoryPath}`); + + if (videoFiles.length === 0) { + if (window.game && window.game.showNotification) { + window.game.showNotification('No video files found in directory', 'warning'); + } + return; + } + + const dirName = directoryPath.split('\\').pop() || directoryPath.split('/').pop(); + const directoryObj = { + id: Date.now(), + name: dirName, + path: directoryPath, + videoCount: videoFiles.length, + dateAdded: new Date().toISOString(), + isRecursive: true + }; + + // Process videos + const videoExtensions = /\.(mp4|webm|mov|avi|mkv|m4v)$/i; + const linkedVideos = videoFiles + .filter(file => videoExtensions.test(file.name || file)) + .map(file => ({ + path: file.path || file, + name: file.name || (typeof file === 'string' ? file.split(/[\\\/]/).pop() : 'unknown'), + directoryId: directoryObj.id, + directoryName: dirName + })); + + // Add to desktopFileManager + window.desktopFileManager.externalVideoDirectories.push(directoryObj); + window.desktopFileManager.allLinkedVideos.push(...linkedVideos); + + // Save to storage + await window.desktopFileManager.saveLinkedDirectories(); + await window.desktopFileManager.updateUnifiedVideoStorage(); + + // Refresh UI + updateVideoDirectoriesList(); + loadLinkedVideos(); + + if (window.game && window.game.showNotification) { + window.game.showNotification(`โœ… Added ${dirName} (${videoFiles.length} videos)`, 'success'); + } + } catch (error) { + console.error('Error adding directory:', error); + if (window.game && window.game.showNotification) { + window.game.showNotification('โŒ Failed to add directory', 'error'); + } + } + })(); + return; + } + + // Fallback to localStorage (legacy method) + console.log('๐Ÿ“ Adding directory via localStorage (legacy):', directoryPath); let linkedDirs; try { linkedDirs = JSON.parse(localStorage.getItem('linkedVideoDirectories') || '[]'); @@ -1500,6 +1577,21 @@ function handleRefreshVideoDirectories() { window.game.showNotification('๐Ÿ”„ Refreshing video directories...', 'info'); } + // Use desktopFileManager refresh if available + if (window.desktopFileManager && window.desktopFileManager.refreshAllDirectories) { + console.log('๐Ÿ“ Refreshing via desktopFileManager...'); + window.desktopFileManager.refreshAllDirectories().then(() => { + updateVideoDirectoriesList(); + loadLinkedVideos(); + + if (window.game && window.game.showNotification) { + window.game.showNotification('โœ… Video directories refreshed!', 'success'); + } + }); + return; + } + + // Fallback to just reloading loadLinkedVideos(); if (window.game && window.game.showNotification) { @@ -1512,6 +1604,26 @@ function handleClearVideoDirectories() { return; } + // Use desktopFileManager if available + if (window.desktopFileManager) { + console.log('๐Ÿ“ Clearing directories via desktopFileManager'); + (async () => { + window.desktopFileManager.externalVideoDirectories = []; + window.desktopFileManager.allLinkedVideos = []; + await window.desktopFileManager.saveLinkedDirectories(); + await window.desktopFileManager.updateUnifiedVideoStorage(); + + updateVideoDirectoriesList(); + loadLinkedVideos(); + + if (window.game && window.game.showNotification) { + window.game.showNotification('๐Ÿ—‘๏ธ All video directories unlinked', 'info'); + } + })(); + return; + } + + // Fallback to localStorage (legacy) localStorage.removeItem('linkedVideoDirectories'); localStorage.removeItem('linkedIndividualVideos'); @@ -1594,6 +1706,23 @@ function updateVideoDirectoriesList() { } function removeVideoDirectory(directoryId) { + // Use desktopFileManager if available + if (window.desktopFileManager && window.desktopFileManager.removeVideoDirectory) { + console.log('๐Ÿ“ Removing directory via desktopFileManager:', directoryId); + window.desktopFileManager.removeVideoDirectory(directoryId).then(() => { + updateVideoDirectoriesList(); + loadLinkedVideos(); + + if (window.game && window.game.showNotification) { + window.game.showNotification('๐Ÿ—‘๏ธ Video directory unlinked', 'info'); + } + }).catch(error => { + console.error('Error removing directory:', error); + }); + return; + } + + // Fallback to localStorage (legacy) let linkedDirs; try { linkedDirs = JSON.parse(localStorage.getItem('linkedVideoDirectories') || '[]'); @@ -1643,16 +1772,32 @@ async function loadVideosFromDesktopFileManager() { } async function loadLinkedVideos() { - let linkedDirs; - try { - linkedDirs = JSON.parse(localStorage.getItem('linkedVideoDirectories') || '[]'); - if (!Array.isArray(linkedDirs)) { + let linkedDirs = []; + + // Try to get from desktopFileManager first (preferred method) + if (window.desktopFileManager && window.desktopFileManager.externalVideoDirectories) { + linkedDirs = window.desktopFileManager.externalVideoDirectories; + console.log(`๐ŸŽฌ Got ${linkedDirs.length} linked directories from desktopFileManager`); + } else { + // Fallback to localStorage (legacy support) + try { + const rawData = localStorage.getItem('linkedVideoDirectories'); + if (rawData) { + const parsed = JSON.parse(rawData); + + // Handle both formats: direct array or object with directories property + if (Array.isArray(parsed)) { + linkedDirs = parsed; + } else if (parsed && parsed.directories && Array.isArray(parsed.directories)) { + linkedDirs = parsed.directories; + } + } + } catch (e) { + console.error('Error parsing linkedVideoDirectories:', e); linkedDirs = []; } - } catch (e) { - console.error('Error parsing linkedVideoDirectories:', e); - linkedDirs = []; } + let allVideos = []; console.log(`๐ŸŽฌ Loading videos from ${linkedDirs.length} linked directories...`);