269 lines
8.3 KiB
Markdown
269 lines
8.3 KiB
Markdown
# encoderPro Dashboard - New Features Summary
|
|
|
|
## Overview
|
|
|
|
This document summarizes the new features added to the encoderPro dashboard to enable profile selection and individual movie re-encoding.
|
|
|
|
---
|
|
|
|
## Feature 1: Encoding Profile Selection in Settings
|
|
|
|
### What It Does
|
|
Users can now select the default encoding profile directly from the dashboard's Encoding Settings panel, without manually editing the YAML configuration file.
|
|
|
|
### User Interface Changes
|
|
- **Encoding Settings Panel** (formerly "Quality Settings")
|
|
- New section: "📹 Encoding Profile"
|
|
- Profile dropdown with all available profiles
|
|
- Profile description area showing encoder, quality (CRF), preset, and description
|
|
- Combined save button for both profile and quality check settings
|
|
|
|
### How It Works
|
|
1. Dashboard loads available profiles from `/api/profiles` on page load
|
|
2. Populates dropdown with profile names
|
|
3. Shows default profile as pre-selected
|
|
4. When profile is selected, displays detailed information about:
|
|
- Encoder (e.g., `cpu_x265`, `nvidia_nvenc_h265`)
|
|
- Quality (CRF value)
|
|
- Preset (e.g., `slow`, `medium`, `fast`)
|
|
- Description (if available)
|
|
5. Clicking "💾 Save All Settings" updates the config file with the new default profile
|
|
|
|
### API Endpoint Used
|
|
- `GET /api/profiles` - Get available profiles
|
|
- `POST /api/config` - Save updated configuration
|
|
|
|
### Code Location
|
|
- **Frontend:** `templates/dashboard.html` lines 411-480 (HTML), lines 927-968 (JavaScript)
|
|
- **Backend:** Existing `/api/profiles` and `/api/config` endpoints
|
|
|
|
---
|
|
|
|
## Feature 2: Individual Movie Selection and Re-Encoding
|
|
|
|
### What It Does
|
|
Users can select specific movies from the file quality table and queue them for re-encoding with a chosen profile. This allows targeted re-processing without re-encoding the entire library.
|
|
|
|
### User Interface Changes
|
|
|
|
#### File Quality Analysis Table
|
|
- **New checkbox column** (first column)
|
|
- "Select All" checkbox in header
|
|
- Individual checkboxes for each file
|
|
- Disabled for files currently processing
|
|
|
|
#### Selection Controls (above table)
|
|
- **Selection counter:** Shows "X files selected"
|
|
- **Profile dropdown:** Select encoding profile for re-encoding
|
|
- **Re-encode button:** "🎬 Re-encode Selected"
|
|
- Disabled when no files selected or no profile chosen
|
|
- Enabled when both conditions are met
|
|
|
|
### How It Works
|
|
|
|
#### Selection Flow
|
|
1. User views files in the quality table
|
|
2. Can filter by state (all, pending, completed, failed)
|
|
3. Checks boxes next to files they want to re-encode
|
|
4. Selection count updates in real-time
|
|
5. Uses "Select All" to select all visible files at once
|
|
|
|
#### Re-Encoding Flow
|
|
1. User selects one or more files
|
|
2. Chooses encoding profile from dropdown
|
|
3. Clicks "🎬 Re-encode Selected"
|
|
4. Confirmation dialog shows:
|
|
- Number of files
|
|
- Selected profile
|
|
- Warning that state will be reset
|
|
5. On confirmation:
|
|
- Files reset from `completed`/`failed` to `pending`
|
|
- Profile name assigned to each file
|
|
- Success message shown
|
|
- Table refreshes to show updated states
|
|
|
|
#### Background Process
|
|
1. API endpoint `/api/jobs/reencode-selected` receives request
|
|
2. Updates database:
|
|
```sql
|
|
UPDATE files
|
|
SET state = 'pending',
|
|
profile_name = ?,
|
|
updated_at = CURRENT_TIMESTAMP
|
|
WHERE id IN (...)
|
|
```
|
|
3. Files are now queued for processing
|
|
4. When user starts the encoding job, these files will be processed with their assigned profiles
|
|
|
|
### Use Cases
|
|
- **Quality Upgrade:** Re-encode completed files with higher quality profile (lower CRF)
|
|
- **Failed File Recovery:** Re-process failed files with different encoder or settings
|
|
- **Profile Testing:** Test new profiles on specific files before batch processing
|
|
- **Selective Compression:** Re-encode only large files with more aggressive compression
|
|
- **Format Change:** Switch from CPU to GPU encoding for specific files
|
|
|
|
### API Endpoint
|
|
**New Endpoint:** `POST /api/jobs/reencode-selected`
|
|
|
|
**Request:**
|
|
```json
|
|
{
|
|
"file_ids": [1, 5, 12, 23],
|
|
"profile": "quality_cpu"
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```json
|
|
{
|
|
"success": true,
|
|
"message": "4 files queued for re-encoding",
|
|
"count": 4
|
|
}
|
|
```
|
|
|
|
### Code Location
|
|
- **Frontend HTML:** `templates/dashboard.html` lines 482-531 (table structure)
|
|
- **Frontend JavaScript:** `templates/dashboard.html` lines 1033-1189 (selection logic)
|
|
- **Backend API:** `dashboard.py` lines 575-615 (new endpoint)
|
|
- **Documentation:** `DASHBOARD-API.md` lines 310-340
|
|
|
|
---
|
|
|
|
## Technical Implementation Details
|
|
|
|
### JavaScript State Management
|
|
```javascript
|
|
let selectedFiles = new Set(); // Tracks selected file IDs
|
|
let availableProfiles = {}; // Caches profile definitions
|
|
```
|
|
|
|
### Key Functions
|
|
|
|
#### `loadEncodingProfiles()`
|
|
- Fetches profiles from API
|
|
- Populates both dropdowns (settings and re-encode)
|
|
- Updates profile description
|
|
|
|
#### `toggleFileSelection(fileId)`
|
|
- Adds/removes file ID from selection set
|
|
- Updates selection counter
|
|
|
|
#### `toggleSelectAll()`
|
|
- Selects/deselects all non-disabled checkboxes
|
|
- Updates selection set
|
|
|
|
#### `updateSelectedCount()`
|
|
- Updates "X files selected" text
|
|
- Enables/disables re-encode button based on:
|
|
- At least one file selected
|
|
- Profile chosen
|
|
|
|
#### `reencodeSelected()`
|
|
- Validates selection and profile
|
|
- Confirms with user
|
|
- Calls API endpoint
|
|
- Refreshes table on success
|
|
|
|
### Database Changes
|
|
The `/api/jobs/reencode-selected` endpoint updates the `files` table:
|
|
- Sets `state` to `pending`
|
|
- Sets `profile_name` to chosen profile
|
|
- Updates `updated_at` timestamp
|
|
|
|
This allows the main encoding script to pick up these files and process them with the specified profile.
|
|
|
|
---
|
|
|
|
## User Workflow Example
|
|
|
|
### Scenario: Re-encode low-quality files with better settings
|
|
|
|
1. **Filter Files**
|
|
- Select "Completed Only" from filter dropdown
|
|
- Table shows all completed encodes
|
|
|
|
2. **Review Results**
|
|
- User notices some files have poor quality scores
|
|
- Or some files have large file sizes despite encoding
|
|
|
|
3. **Select Files**
|
|
- Click checkboxes next to files needing re-encoding
|
|
- Or click "Select All" to choose all visible files
|
|
- Counter shows "5 files selected"
|
|
|
|
4. **Choose Profile**
|
|
- Select "quality_cpu" from profile dropdown
|
|
- (This profile uses CRF 19 for higher quality)
|
|
|
|
5. **Queue Re-Encoding**
|
|
- Click "🎬 Re-encode Selected"
|
|
- Confirm dialog: "Re-encode 5 file(s) using profile 'quality_cpu'?"
|
|
- Click OK
|
|
|
|
6. **Processing**
|
|
- Success message: "✅ 5 file(s) queued for re-encoding!"
|
|
- Files now show as "pending" in table
|
|
- User clicks "▶️ Start Processing" to begin encoding
|
|
|
|
7. **Monitoring**
|
|
- Files process with new profile
|
|
- Statistics update in real-time
|
|
- Activity log shows progress
|
|
|
|
---
|
|
|
|
## Benefits
|
|
|
|
### For Users
|
|
- **No YAML editing required** - Configure profiles through UI
|
|
- **Granular control** - Re-encode specific files, not entire library
|
|
- **Flexibility** - Test different profiles on different files
|
|
- **Recovery** - Easy to retry failed files with different settings
|
|
- **Efficiency** - No need to re-encode entire library to change quality
|
|
|
|
### For Workflow
|
|
- **Iterative improvement** - Test and refine encoding settings
|
|
- **Quality assurance** - Upgrade files that didn't meet quality standards
|
|
- **Resource optimization** - Use GPU profiles for some files, CPU for others
|
|
- **Error recovery** - Quickly retry failed encodes with different encoders
|
|
|
|
---
|
|
|
|
## Future Enhancements
|
|
|
|
Potential improvements for future versions:
|
|
|
|
1. **Bulk Profile Assignment**
|
|
- Apply different profiles to different groups of files
|
|
- Profile recommendations based on file characteristics
|
|
|
|
2. **Quality Preview**
|
|
- Show estimated file size before re-encoding
|
|
- Compare current vs. target quality scores
|
|
|
|
3. **Scheduled Re-Encoding**
|
|
- Queue files for processing during off-peak hours
|
|
- Priority queue for urgent re-encodes
|
|
|
|
4. **Batch Operations**
|
|
- Reset multiple files to different states
|
|
- Bulk delete from database
|
|
- Export selection to CSV
|
|
|
|
5. **Advanced Filtering**
|
|
- Filter by quality score, file size, encoder used
|
|
- Save custom filter presets
|
|
- Search by filename patterns
|
|
|
|
---
|
|
|
|
## Summary
|
|
|
|
These two features provide users with:
|
|
1. **Easy profile management** through the UI
|
|
2. **Precise control** over which files to re-encode
|
|
3. **Flexible workflows** for quality improvement and error recovery
|
|
|
|
The implementation is fully integrated with the existing encoderPro system and requires no changes to the core encoding logic.
|