Skip to content

Fix: skip video server check on photo-only batches; degrade gracefully without Companion plugin#64

Open
Gotcha26 wants to merge 55 commits into
Piwigo:mainfrom
Gotcha26:fix/video-check-no-companion
Open

Fix: skip video server check on photo-only batches; degrade gracefully without Companion plugin#64
Gotcha26 wants to merge 55 commits into
Piwigo:mainfrom
Gotcha26:fix/video-check-no-companion

Conversation

@Gotcha26

@Gotcha26 Gotcha26 commented May 1, 2026

Copy link
Copy Markdown
Contributor

Problem

Two related bugs involving the Lightroom Companion plugin being absent from the Piwigo server:

Bug 1 — Spurious error on photo-only publish
vtk_core.checkServerSupport was called unconditionally regardless of whether the export batch contained any video files. When the Lightroom Companion plugin was absent, this always triggered a "Video Upload Blocked" critical dialog — even when the user was publishing photos only (0 videos in the batch).

Bug 2 — Hard block when Companion is absent and videos are present
When videos were in the batch and Companion was absent, the upload was blocked entirely. This was unnecessarily strict: PiwigoAPI.updateGallery already handles all video MIME types (mp4, m4v, mov, avi, webm, etc.), and the three Companion-specific enrichment calls (setRepresentative, setVideoInfo, setVideoMeta) in vtk_core.uploadVariants are already individually guarded by if companionAvailable then. The fallback path was therefore already in place — it just was never reached.

Fix

PublishTask.lua — Guard checkServerSupport with if batchVideoCount > 0. When no videos are in the batch, the server video check is skipped entirely and publication proceeds without any dialog.

vtk_core.lua — Replace the hard block (when Companion is absent) with a non-critical warning. Videos are uploaded via the standard pwg.images.addSimple API. Companion-specific enrichment (custom thumbnail, video dimensions, codec/fps/bitrate metadata) is silently skipped. If the server is not configured to accept video file types, the existing "forbidden file type" error handler surfaces the rejection naturally.

Behaviour after fix

Scenario Before After
Photo-only batch, Companion absent Critical error dialog No dialog, publish proceeds normally
Videos present, Companion absent, VTK off Videos blocked, error dialog Non-critical warning, direct upload via updateGallery
Videos present, Companion absent, VTK on Videos blocked, error dialog Non-critical warning, VTK transcode + upload, enrichment skipped
Companion present (any scenario) Unchanged Unchanged

Test plan

  • Publish a photo-only batch with Companion plugin not installed → no dialog, photos publish normally
  • Publish a batch containing videos with Companion not installed, server configured for video → warning dialog shown, videos uploaded, no thumbnail/dimensions metadata
  • Publish a batch containing videos with Companion not installed, server NOT configured for video → warning dialog, then upload rejected with existing "forbidden file type" error
  • Publish with Companion installed and active → full existing behaviour preserved

Gotcha26 and others added 25 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
…lly without Companion

Two related issues:

1. `vtk_core.checkServerSupport` was called unconditionally even when
   the export batch contained zero video files. If the Lightroom Companion
   plugin was absent from the Piwigo server, this triggered a spurious
   "Video Upload Blocked" critical dialog on every photo-only publish.
   Fix: guard the call with `if batchVideoCount > 0`.

2. When videos ARE present and the Companion plugin is absent, the upload
   was hard-blocked. `PiwigoAPI.updateGallery` already handles all video
   MIME types, and the three Companion-specific enrichment calls
   (`setRepresentative`, `setVideoInfo`, `setVideoMeta`) are already
   individually guarded by `if companionAvailable then` in
   `vtk_core.uploadVariants`. The block was therefore unnecessary.
   Fix: replace the hard block with a non-critical warning. Videos are
   uploaded via the standard Piwigo API; thumbnail and dimension metadata
   are silently skipped. If the server is not configured to accept video
   file types, the existing "forbidden file type" error handler surfaces
   the rejection naturally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant