Class GoogleSpeechTranscriptionService
java.lang.Object
org.opencastproject.job.api.AbstractJobProducer
org.opencastproject.transcription.googlespeech.GoogleSpeechTranscriptionService
- All Implemented Interfaces:
JobProducer,TranscriptionService
public class GoogleSpeechTranscriptionService
extends AbstractJobProducer
implements TranscriptionService
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringService configuration optionsstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class org.opencastproject.job.api.AbstractJobProducer
ACCEPT_JOB_LOADS_EXCEEDING_PROPERTY, acceptJobLoadsExeedingMaxLoad, DEFAULT_ACCEPT_JOB_LOADS_EXCEEDING, executor, jobType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) OSGI activate method.protected voiddeleteStorageFile(String mpId, String token) getGeneratedTranscription(String mpId, String jobId, MediaPackageElement.Type type) protected OrganizationDirectoryServiceReturns a reference to the organization directory service.protected StringgetReturnValues(String mpId, String jobId) protected SecurityServiceReturns a reference to the security serviceprotected ServiceRegistryReturns a reference to the service registry.getTranscriptionResults(String jobId) Get transcription result: GET /v1/operations/{name} Method mainly used by the REST endpointgetTranscriptionStatus(String mpId) Get mediapackage transcription statusprotected UserDirectoryServiceReturns a reference to the user directory serviceprotected org.apache.http.impl.client.CloseableHttpClientprotected StringAsks the overriding class to process the arguments using the given operation.protected StringrefreshAccessToken(String clientId, String clientSecret, String refreshToken) voidsetAssetManager(AssetManager service) voidsetDatabase(TranscriptionDatabase service) voidsetOrganizationDirectoryService(OrganizationDirectoryService organizationDirectoryService) voidsetSecurityService(SecurityService securityService) voidsetServiceRegistry(ServiceRegistry serviceRegistry) voidsetSmtpService(SmtpService service) voidsetUserDirectoryService(UserDirectoryService userDirectoryService) voidsetWorkflowService(WorkflowService service) voidvoidstartTranscription(String mpId, Track track) startTranscription(String mpId, Track track, String... args) voidtranscriptionDone(String mpId, Object obj) voidtranscriptionError(String mpId, Object obj) protected StringuploadAudioFileToGoogleStorage(String mpId, Track track) Methods inherited from class org.opencastproject.job.api.AbstractJobProducer
acceptJob, countJobs, finallyUpdateJob, getJobType, incident, isReadyToAccept, isReadyToAcceptJobs
-
Field Details
-
DEFAULT_WF_DEF
- See Also:
-
ENABLED_CONFIG
Service configuration options- See Also:
-
GOOGLE_SPEECH_LANGUAGE
- See Also:
-
PROFANITY_FILTER
- See Also:
-
ENABLE_PUNCTUATION
- See Also:
-
TRANSCRIPTION_MODEL
- See Also:
-
WORKFLOW_CONFIG
- See Also:
-
DISPATCH_WORKFLOW_INTERVAL_CONFIG
- See Also:
-
COMPLETION_CHECK_BUFFER_CONFIG
- See Also:
-
MAX_PROCESSING_TIME_CONFIG
- See Also:
-
NOTIFICATION_EMAIL_CONFIG
- See Also:
-
CLEANUP_RESULTS_DAYS_CONFIG
- See Also:
-
GOOGLE_CLOUD_CLIENT_ID
- See Also:
-
GOOGLE_CLOUD_CLIENT_SECRET
- See Also:
-
GOOGLE_CLOUD_REFRESH_TOKEN
- See Also:
-
GOOGLE_CLOUD_BUCKET
- See Also:
-
GOOGLE_CLOUD_TOKEN_ENDPOINT_URL
- See Also:
-
ENCODING_EXTENSION
- See Also:
-
-
Constructor Details
-
GoogleSpeechTranscriptionService
public GoogleSpeechTranscriptionService()
-
-
Method Details
-
activate
public void activate(org.osgi.service.component.ComponentContext cc) Description copied from class:AbstractJobProducerOSGI activate method.- Overrides:
activatein classAbstractJobProducer- Parameters:
cc- OSGI component context
-
startTranscription
public Job startTranscription(String mpId, Track track, String... args) throws TranscriptionServiceException - Specified by:
startTranscriptionin interfaceTranscriptionService- Throws:
TranscriptionServiceException
-
startTranscription
- Specified by:
startTranscriptionin interfaceTranscriptionService- Throws:
TranscriptionServiceException
-
transcriptionDone
- Specified by:
transcriptionDonein interfaceTranscriptionService- Throws:
TranscriptionServiceException
-
getLanguage
- Specified by:
getLanguagein interfaceTranscriptionService
-
getReturnValues
public Map<String,Object> getReturnValues(String mpId, String jobId) throws TranscriptionServiceException - Specified by:
getReturnValuesin interfaceTranscriptionService- Throws:
TranscriptionServiceException
-
transcriptionError
- Specified by:
transcriptionErrorin interfaceTranscriptionService- Throws:
TranscriptionServiceException
-
process
Description copied from class:AbstractJobProducerAsks the overriding class to process the arguments using the given operation. The result will be added to the associated job as the payload.- Specified by:
processin classAbstractJobProducer- Parameters:
job- the job to process- Returns:
- the operation result
- Throws:
Exception
-
getTranscriptionResults
public String getTranscriptionResults(String jobId) throws TranscriptionServiceException, IOException Get transcription result: GET /v1/operations/{name} Method mainly used by the REST endpoint- Parameters:
jobId-- Returns:
- job details
- Throws:
TranscriptionServiceExceptionIOException
-
getGeneratedTranscription
public MediaPackageElement getGeneratedTranscription(String mpId, String jobId, MediaPackageElement.Type type) throws TranscriptionServiceException - Specified by:
getGeneratedTranscriptionin interfaceTranscriptionService- Throws:
TranscriptionServiceException
-
getTranscriptionStatus
Get mediapackage transcription status- Parameters:
mpId- , mediapackage id- Returns:
- transcription status
- Throws:
TranscriptionServiceException
-
makeHttpClient
- Throws:
IOException
-
refreshAccessToken
protected String refreshAccessToken(String clientId, String clientSecret, String refreshToken) throws TranscriptionServiceException, IOException -
getRefreshAccessToken
-
uploadAudioFileToGoogleStorage
protected String uploadAudioFileToGoogleStorage(String mpId, Track track) throws TranscriptionServiceException, IOException -
deleteStorageFile
- Throws:
IOException
-
setServiceRegistry
-
setSecurityService
-
setUserDirectoryService
-
setOrganizationDirectoryService
public void setOrganizationDirectoryService(OrganizationDirectoryService organizationDirectoryService) -
setSmtpService
-
setWorkspace
-
setWorkingFileRepository
-
setDatabase
-
setAssetManager
-
setWorkflowService
-
getServiceRegistry
Description copied from class:AbstractJobProducerReturns a reference to the service registry.- Specified by:
getServiceRegistryin classAbstractJobProducer- Returns:
- the service registry
-
getSecurityService
Description copied from class:AbstractJobProducerReturns a reference to the security service- Specified by:
getSecurityServicein classAbstractJobProducer- Returns:
- the security service
-
getUserDirectoryService
Description copied from class:AbstractJobProducerReturns a reference to the user directory service- Specified by:
getUserDirectoryServicein classAbstractJobProducer- Returns:
- the user directory service
-
getOrganizationDirectoryService
Description copied from class:AbstractJobProducerReturns a reference to the organization directory service.- Specified by:
getOrganizationDirectoryServicein classAbstractJobProducer- Returns:
- the organization directory service
-