-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add WP-CLI
command to bulk process audio transcriptions
#514
Conversation
…dio attachment items and process those. Add helper method that can be used to determine if an item should be processed to avoid duplicate code
@dkotter there are some conflicts in this PR. |
@Sidsector9 Thanks for pointing that out. Those should be cleaned up now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good 👍
These are the points I noted:
1. Logs both error
and success
messages

- Disable
Generate transcripts from audio files
. - Run
wp classifai transcribe_audio <audio_id>
.
2. Logging types can be changed
\WP_CLI::log( sprintf( '%d items had errors', $errors ) );
can use\WP_CLI::error()
instead.\WP_CLI::success( sprintf( '%d items would have had transcriptions added', $count ) );
can use\WP_CLI::log()
instead.
3. Minor inconsistency between CLI and GUI
When Generate transcripts from audio files
is disabled, the Re-Transcribe
button is not rendered, however, we can still use CLI to Re-Transcribe. The setting description says
Automatically generate transcripts for supported audio files, but Re-Transcribing is a manual process. So IMO we should render that button at all times, whether this setting is enabled or disabled.
Adding to that, we should add a separate setting to enable/disable the feature, and use this setting value as a conditional to decide whether to render the button in the GUI.
Let me know your thoughts on this.
@Sidsector9 I've updated the log types you've mentioned.
I think these are both good points though I wouldn't tackle them as part of this PR. I'd suggest opening a new issue to track those things and we can look to address those in a separate PR. |
@Sidsector9 Let me know if you have any thoughts on the above. Hoping to get this finished off so I can proceed with a 2.2.3 release. Thanks! |
Description of the Change
In #451 we added the ability to generate a transcription from an audio file. This PR is a follow-up to that and adds a
WP-CLI
command that can be used to do the same thing. This is perfect for processing a large amount of audio files or having more control over which files are processed.The new command looks like:
and has the following options:
per_page
argument. This controls how many items we process in each batch. Defaults to 100. As an example, if you have 1000 items to process, all of these will be processed but will be done in batches of 100 for performance reasonsforce
argument that defaults tofalse
. Will only process items that don't have data saved inpost_content
if set tofalse
(basically won't re-process items that already have a transcription saved)dry-run
argument that defaults totrue
. You must passfalse
to actually run the commandHere are some example commands that can be run:
Closes #498
How to test the Change
Try running some of the
WP-CLI
commands as described above and ensure they all work as expectedChangelog Entry
Credits
Props @dkotter
Checklist: