Skip to content

Complete Video Support + Major Refactoring + Security Fixes#59

Open
Gotcha26 wants to merge 54 commits intoPiwigo:mainfrom
Gotcha26:main
Open

Complete Video Support + Major Refactoring + Security Fixes#59
Gotcha26 wants to merge 54 commits intoPiwigo:mainfrom
Gotcha26:main

Conversation

@Gotcha26
Copy link
Copy Markdown
Contributor

@Gotcha26 Gotcha26 commented Mar 6, 2026

PR #4: Complete Video Support + Major Refactoring + Security Fixes

Summary

This PR represents a major integration of the video publishing toolkit (vtk) and includes 46 significant commits from the dev branch. It consolidates multiple feature implementations, security fixes, and code quality improvements that were in flight during the upstream merge process.

Key Achievement: Lightroom Classic can now publish videos to Piwigo with full metadata preservation, hardware acceleration support, and quality presets.


What's Included

🎬 Video Publishing Support (Complete)

  • vtk_core.lua + vtk_ui.lua — Video toolkit integration within Lightroom plugin
  • video-toolkit/ — Standalone Python utility (FFmpeg-based, no external dependencies)
    • Supports H.264, H.265, VP9, AV1 encoding
    • Hardware acceleration (NVIDIA NVENC, Intel QSV, AMD VCE)
    • Quality presets (Portrait, Landscape, Documentary, HDR → SDR tonemap)
    • Automatic resolution optimization (no upscaling)
    • Metadata preservation (EXIF, XMP)
  • Pre-scan detection in PublishTask.lua — identifies videos before rendering
  • Metadata-only mode.vtk file format for video info storage
  • Companion plugin — Piwigo-side support for video metadata (pwg.companion.setVideoInfo)

Security Fixes

  • Log Anonymisation Restored (commit 1aa717b)
    • Credentials (host, username, password, tokens) now redacted in logs
    • Function utils.anonymisePropertyTable() re-applied to sensitive log dumps

🔧 Keyword Filtering Improvements

  • Better UX messaging (commit 1aa717b)
    • Photos rejected by keyword filters show "Skipped (keyword filter)" instead of generic "failed"
    • Clearer feedback to user about why photos weren't uploaded

📝 Code Quality & Internationalization

  • Apostrophe Standardization (commit 6f516cf)

    • Single quotes replaced with double quotes in translatable strings
    • Enables proper string capture for i18n workflows
  • Multi-language Support

    • Companion plugin updated with localization (commit e599f72)
    • Better integration with Piwigo Dark theme
  • Refactoring & Warning Fixes

    • UIHelpers.lua simplified (removed dead code, unused parameters)
    • PiwigoAPI.lua refactored for maintainability
    • Function signatures cleaned up

🎯 Feature Implementations

🐛 Bug Fixes


Files Changed

Core Plugin Files

  • PublishTask.lua — +1196 lines (major refactoring)
  • PiwigoAPI.lua — +843 lines (new video support APIs, security improvements)
  • UIHelpers.lua — -686 lines (simplification, removed dead code)
  • utils.lua — +656 lines (helper functions for video, metadata handling)
  • PublishDialogSections.lua — +963 lines (new video options UI)

New Files (Video Support)

  • vtk_core.lua — Video toolkit core (679 lines)
  • vtk_ui.lua — Video UI components (365 lines)
  • video-toolkit/ — Complete Python toolkit
    • cli.py, config.py, ffmpeg.py, ffprobe.py, hasher.py, hwaccel.py, metadata.py, presets.py, processor.py, status.py, ui.py
    • 3,500+ lines of video processing code
    • Comprehensive test suite (test_hasher.py, test_presets.py, test_status.py)

Supporting Updates

  • PluginInfoDialogSections.lua — New video settings
  • CustomMetadata.lua — Video metadata definitions
  • Init.lua — VTK module loading (vtk_core, vtk_ui)
  • Info.lua — Version updates
  • icons/ — New email/GitHub social icons
  • .gitignore — Updated for toolkit artifacts

Breaking Changes & Improvements

UI Simplifications (Last Commit)

Removed incomplete "Refresh from Piwigo" button feature:

  • Simplified createPiwigoAlbumSettingsUI() signature (6 → 4 parameters)
  • Removed per-collection sync override settings (deferred to future PR)
  • Focused on core sync via global settings + publish-time reconcile dialog

Rationale: The feature required non-trivial album ID storage and metadata retrieval. Instead, the existing global albumDescSyncMode setting + publish-time reconcile dialog (Test 4 in CHECKLIST_PRE_MERGE.md) provides sufficient control without UI complexity.


Testing Completed ✅

All 5 regression tests passed (per CHECKLIST_PRE_MERGE.md):

  • Test 1: Basic publish (5 photos)
  • Test 2: Keyword filtering (3 landscape + 2 portrait, include="landscape")
  • Test 3: Multi-album dedup (Photo A → Album 1 & 2)
  • Test 4: Album metadata conflict reconciliation
  • Test 5: Video processing (1 video + 2 photos)

Security Considerations

Log Data Protection

  • Credentials are now redacted in all log outputs
  • Sensitive data: host, username, password, tokens, cookies
  • Pattern: utils.anonymisePropertyTable() applied to property table dumps

Video File Handling

  • All temporary files cleaned up after processing
  • No stored credentials in video metadata
  • File validation before upload

Known Limitations & Future Work

Per-Collection Sync Settings (Q2 — Option D)

Status: Deferred to future PR

  • Currently: Global albumDescSyncMode applies to all collections
  • Planned: Per-collection override with 3 modes (always/never/ask)
  • Benefit: Fine-grained control without UI cluttering

"Refresh from Piwigo" Button (Removed)

Rationale: Requires persistent album ID storage; global sync + publish-time dialog sufficient for current use case


Commits Included

This PR contains 46 commits across multiple phases:

Foundation (Infrastructure & Video Basics)

  • Phase 1A-1D: Core VTK integration
  • Phase 2-5: Feature completion & optimization

Features

Fixes

Cleanup

  • Apostrophe standardization for i18n
  • Dead code removal
  • UI simplification

See full commit log:

git log main..dev --oneline

Related Documentation

  • CHECKLIST_PRE_MERGE.md — Regression tests (all passed)
  • REVUE_SYNTHESE.md — Detailed analysis of Q1/Q2/Q3 decisions
  • PR_CODE_ANALYSIS.md — Technical breakdown of all changes
  • video-toolkit/INSTALL.md — Setup instructions
  • video-toolkit/VIDEO-TOOLKIT-USER-GUIDE.md — Usage documentation

Next Steps

  1. Code Review — Review the 46 commits, particularly video integration
  2. Security Review — Verify log anonymisation and credential handling
  3. Testing — All 5 regression tests passed locally
  4. Merge to Main — Once approved
  5. Merge to Upstream — After validating no conflicts with upstream main

Created: 2026-03-06
Base Branch: main
Head Branch: dev
Commits: 46
Files Changed: 43
+Insertions: 8,745
-Deletions: 2,028

Gotcha26 and others added 24 commits February 18, 2026 00:03
- ffprobe.py: VideoInfo gains is_hdr property and color_transfer field
  (detects smpte2084/PQ, arib-std-b67/HLG, smpte428, bt2020-10/12)
- ffmpeg.py: HDR sources automatically get zscale tonemap filter (SDR out)
  when preset is not origin; origin preset always does stream copy
- processor.py: SDR sources auto-downgraded to origin (remux, no transcode)
  while preserving the requested preset suffix for output filename naming
- cli.py, status.py: minor improvements from previous session

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
En republication avec même preset, PublishTask lit le fichier .vtk/<stem>.json
pour récupérer les dimensions (width×height) et la taille de la variante déjà
transcodée, puis appelle PiwigoAPI.setVideoInfo pour mettre à jour Piwigo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- LrTasks.execute via temporary .bat file to avoid nested quotes issue
  on Windows (cmd /c + multiple quoted paths = silent failure)
- Delete stale VTK log before launch to prevent reading old results
- Remove metadata_only mode: republish always triggers VTK (cache decides)
- Use publishedCollection:addPhotoByRemoteId to mark videos as published
  (works for both new and existing photos, unlike getPublishedPhotos loop)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- PiwigoAPI.lua: new setVideoInfo(propertyTable, imageId, w, h, filesize)
  calls pwg.companion.setVideoInfo to store video dimensions in Piwigo DB
- lightroom-companion/main.inc.php: new API method companion_set_video_info
  updates width, height, filesize (KB) in images table for a given image_id

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- processor.py: thumbnail extracted from transcoded variant (SDR colors)
  instead of HDR source — avoids washed-out colors in poster image
- PublishTask.lua: LrDialogs.message informs user before VTK launch
  that transcoding may take several minutes and Lightroom will be frozen

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…anion plugin update

- Refactor: extract VTK logic into vtk_core.lua and vtk_ui.lua
- Add hwaccel support (NVIDIA/AMD/Intel) with auto-detection
- Reorganize lightroom-companion plugin structure (lightroom_companion/)
- Add VIDEO-TOOLKIT-USER-GUIDE documentation
- Improve video processing pipeline with metadata handling
- Update icon assets (email, github)
- Remove requirements.txt (Python 3.8+ stdlib only)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The function was accidentally removed but is still used in
PublishTaskImageProcessing.lua (6 calls for resize validation).

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- utils.lua: Restore utils.anonymisePropertyTable() (removed by refactor)
- PiwigoAPI.lua: Re-apply anonymisePropertyTable() on all propertyTable/
  publishSettings log calls (deletePhoto x2, addComment x3)
- PublishTask.lua: Change keyword block message from 'Blocked by' to
  'Skipped (keyword filter):' to avoid confusion with upload errors

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Remove 'Refresh from Piwigo' button (not functional in edit context)
- Simplify createPiwigoAlbumSettingsUI() signature (no remoteId/publishSettings)
- Remove per-collection sync overrides from defaults
- Keep global albumDescSyncMode/albumStatusSyncMode for conflict resolution
- Update buildCommonCollectionUI() calls in both viewForCollectionSettings

This reverts the incomplete per-collection override feature.
Album metadata sync now relies on global settings + reconcile dialog during publish.
Fix: Secure logging and improve keyword filter UX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor the Main Page GPS metadata aren't updated New "private" album aren't private. Refactor viewForCollectionSettings

1 participant