Repository navigation
feat(tools): let Retranscode Media fetch audio, PDF and image attachments - #2083
Conversation
There was a problem hiding this comment.
Pull request overview
Adds media-type filtering to the retranscoding tool across the REST API and UI.
Changes:
- Supports video, audio, PDF, image, and combined fetching.
- Adds a media-type selector and updated notices.
- Updates MIME filtering and attachment counts.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
pages/tools/retranscode-media.scss |
Styles the new options controls. |
pages/tools/components/tabs/RetranscodeTab.jsx |
Adds media selection and request handling. |
inc/classes/rest-api/class-transcoding.php |
Adds REST validation, MIME filtering, and counts. |
Suppressed comments (1)
inc/classes/rest-api/class-transcoding.php:466
wp_count_attachments()includes its separatetrashproperty in this sum, while bothWP_Queryinstances usepost_status => 'any'and omit trash. This inflatestotal_media_countandtranscode_countwhenever matching media is trashed. Filter out thetrashkey before summing.
$total_media_count = array_sum( (array) wp_count_attachments( $mime_types ) );
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| 'all' => array( 'video', 'audio', 'application/pdf', 'image' ), | ||
| 'video' => array( 'video' ), | ||
| 'audio' => array( 'audio' ), | ||
| 'pdf' => array( 'application/pdf' ), | ||
| 'image' => array( 'image' ), |
| array( | ||
| 'data' => array(), | ||
| 'total_media_count' => array_sum( (array) wp_count_attachments( 'video' ) ), | ||
| 'total_media_count' => array_sum( (array) wp_count_attachments( $mime_types ) ), |
🔍 WordPress Plugin Check Report
📊 Report
❌ Errors (1)📁 readme.txt (1 error)
|
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
mismatched_plugin_name | Plugin name "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" is different from the name declared in plugin header "GoDAM". |
0 |
trademarked_term | The plugin name includes a restricted term. Your chosen plugin name - "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" - contains the restricted term "wordpress" which cannot be used at all in your plugin name. |
📁 composer.json (1 warning)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
missing_composer_json_file | The "/vendor" directory using composer exists, but "composer.json" file is missing. |
📁 assets/build/blocks/godam-gallery-v2/render.php (2 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
15 |
WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: "$inner_block_video_ids". |
23 |
WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound | Global variables defined by a theme/plugin should start with the theme/plugin prefix. Found: "$inner_block_video_ids". |
📁 assets/build/css/main.css (1 warning)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedStylesScope | This style is being loaded in all contexts. |
📁 assets/src/libs/analytics.min.js (5 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/08/24/hello-world/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/sample-page/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
📁 assets/build/js/main.min.js (5 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/08/24/hello-world/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/sample-page/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (1)
inc/classes/rest-api/class-transcoding.php:454
- The document scan runs before the storage-limit check, so a
documentorallrequest on an account that cannot transcode still pages through and cache-primes every matching attachment before returning the error. On a large library this can make an operation that must be rejected unnecessarily slow or time out. Check storage before callingget_document_attachments()and the count queries; the storage-exceeded UI only uses the returned message, so an exact total need not require a full scan.
$documents = empty( $document_mimes )
? array(
'eligible' => array(),
'untranscoded' => array(),
)
: $this->get_document_attachments( $document_mimes );
Adversarial reviewI ran this PR through several independent review passes, each trying to break a different part, then a second pass that tried to disprove every issue found. Below are the ones that held up, most important first. At the end I list what I checked and found solid, so you know what I looked at. Nothing here is a merge blocker on correctness of the happy path. The main asks are the Worth fixing1. 2. No tests added for the new server logic 3. An extra database query runs on every fetch and its result is thrown away 4. Unconvertible documents are skipped but not counted in the final summary Optional / your call5. On Copilot's 6. Pre-existing, not introduced by this PR: a network error mid-batch can freeze the tool Checked and found solid
|
This pull request adds support for selecting the media type to fetch and retranscode in the retranscoding tool, both in the REST API and the UI. Users can now choose which type of media (video, audio, PDF, image, or all) to fetch for retranscoding, and the backend and frontend have been updated to support this selection. Additionally, UI improvements make the options clearer and more accessible.
REST API enhancements:
media_typeparameter to thenot-transcodedREST API route, with validation and a default value, allowing clients to specify which type of media to fetch for retranscoding. [1] [2]Frontend/UI improvements:
SelectControl) to the retranscoding tab, allowing users to choose the type of media to fetch. The UI now dynamically shows/hides fetch options based on context. [1] [2] [3] [4] [5]These changes make the retranscoding tool more flexible and user-friendly, allowing for targeted retranscoding operations and a better overall experience.
Demo
Screen.Recording.2026-08-17.at.1.15.38.PM.mov