Read an episode’s Transcription tile, save its notes, and run code when they are saved
The Workbench’s Transcription tile (id transcription, Post-production, priority 30, after Audio / video; off by default).
With the Transcription add-on on for the episode’s show, the tile reads benecaster_transcription_status() (see Show an episode’s transcription status, and request one, from your add-on): none is Not transcribed yet (Not started); pending and processing are Processing (In progress); failed is Failed (In progress, with the provider’s reason in the panel); complete is Complete (Done). Its button is Transcription’s editor_url.
A request charges the podcaster’s provider. The panel’s Request transcription (Try again after a failure) first asks for confirmation, naming the provider, and only Transcribe posts to the Transcription add-on’s own request route. With no provider set up, it links to the Transcription settings instead. Podcast Workflow never requests a transcription by itself.
Without Transcription, or with it off for the show, the tile is Transcript notes and a Transcript done box.
- Reading:
GET …/workbench(see Read the Podcast Workflow Workbench over REST) carriesworkflow.transcription:{ transcription, status, status_label, error, can_request, editor_url, done, notes }.statusis''while Transcription is off or not installed, elsenone,pending,processing,completeorfailed. - Saving (the notes state):
PUT /benecaster-podcast-workflow/v1/shows/{show_id}/episodes/{episode_id}/transcription-noteswith{ done: bool, notes: string }, both every time. Notes are plain text, 10,000 characters at most (400 benecaster_podcast_workflow_guest_notes_too_long), a missing or mistyped field is400 benecaster_podcast_workflow_invalid_field, and the Workbench’s per-show checks apply. It answers the refreshed canvas and writes no episode note. - With Transcription on, its status decides the tile; the box and notes are kept and come back if it is switched off. The tile is declared with no
add_on, so it is asked for its state while Transcription is off. - benecaster_podcast_workflow_before_save_transcription_notes and benecaster_podcast_workflow_after_save_transcription_notes are actions,
( int $episode_id, bool $done, string $notes, int $show_id ), around every save of the notes state, with the notes as stored.
Code
<?php
add_action( 'benecaster_podcast_workflow_after_save_transcription_notes', function ( int $episode_id, bool $done, string $notes, int $show_id ): void {
if ( $done ) {
my_plugin_attach_external_transcript( $episode_id );
}
}, 10, 4 );
Hooks Used
Need this built rather than just documented? See our services →