Class GoogleSpeechTranscriptionService
java.lang.Object
org.opencastproject.job.api.AbstractJobProducer
org.opencastproject.transcription.googlespeech.GoogleSpeechTranscriptionService
- All Implemented Interfaces:
org.opencastproject.job.api.JobProducer,org.opencastproject.transcription.api.TranscriptionService
public class GoogleSpeechTranscriptionService
extends org.opencastproject.job.api.AbstractJobProducer
implements org.opencastproject.transcription.api.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) protected voiddeleteStorageFile(String mpId, String token) org.opencastproject.mediapackage.MediaPackageElementgetGeneratedTranscription(String mpId, String jobId, org.opencastproject.mediapackage.MediaPackageElement.Type type) protected org.opencastproject.security.api.OrganizationDirectoryServiceprotected StringgetReturnValues(String mpId, String jobId) protected org.opencastproject.security.api.SecurityServiceprotected org.opencastproject.serviceregistry.api.ServiceRegistrygetTranscriptionResults(String jobId) Get transcription result: GET /v1/operations/{name} Method mainly used by the REST endpointgetTranscriptionStatus(String mpId) Get mediapackage transcription statusprotected org.opencastproject.security.api.UserDirectoryServiceprotected org.apache.http.impl.client.CloseableHttpClientprotected Stringprocess(org.opencastproject.job.api.Job job) protected StringrefreshAccessToken(String clientId, String clientSecret, String refreshToken) voidsetAssetManager(org.opencastproject.assetmanager.api.AssetManager service) voidsetDatabase(org.opencastproject.transcription.persistence.TranscriptionDatabase service) voidsetOrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService organizationDirectoryService) voidsetSecurityService(org.opencastproject.security.api.SecurityService securityService) voidsetServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry) voidsetSmtpService(org.opencastproject.kernel.mail.SmtpService service) voidsetUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService) voidsetWorkflowService(org.opencastproject.workflow.api.WorkflowService service) voidsetWorkingFileRepository(org.opencastproject.workingfilerepository.api.WorkingFileRepository wfr) voidsetWorkspace(org.opencastproject.workspace.api.Workspace ws) org.opencastproject.job.api.JobstartTranscription(String mpId, org.opencastproject.mediapackage.Track track) org.opencastproject.job.api.JobstartTranscription(String mpId, org.opencastproject.mediapackage.Track track, String... args) voidtranscriptionDone(String mpId, Object obj) voidtranscriptionError(String mpId, Object obj) protected StringuploadAudioFileToGoogleStorage(String mpId, org.opencastproject.mediapackage.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) - Overrides:
activatein classorg.opencastproject.job.api.AbstractJobProducer
-
startTranscription
public org.opencastproject.job.api.Job startTranscription(String mpId, org.opencastproject.mediapackage.Track track, String... args) throws org.opencastproject.transcription.api.TranscriptionServiceException - Specified by:
startTranscriptionin interfaceorg.opencastproject.transcription.api.TranscriptionService- Throws:
org.opencastproject.transcription.api.TranscriptionServiceException
-
startTranscription
public org.opencastproject.job.api.Job startTranscription(String mpId, org.opencastproject.mediapackage.Track track) throws org.opencastproject.transcription.api.TranscriptionServiceException - Specified by:
startTranscriptionin interfaceorg.opencastproject.transcription.api.TranscriptionService- Throws:
org.opencastproject.transcription.api.TranscriptionServiceException
-
transcriptionDone
public void transcriptionDone(String mpId, Object obj) throws org.opencastproject.transcription.api.TranscriptionServiceException - Specified by:
transcriptionDonein interfaceorg.opencastproject.transcription.api.TranscriptionService- Throws:
org.opencastproject.transcription.api.TranscriptionServiceException
-
getLanguage
- Specified by:
getLanguagein interfaceorg.opencastproject.transcription.api.TranscriptionService
-
getReturnValues
public Map<String,Object> getReturnValues(String mpId, String jobId) throws org.opencastproject.transcription.api.TranscriptionServiceException - Specified by:
getReturnValuesin interfaceorg.opencastproject.transcription.api.TranscriptionService- Throws:
org.opencastproject.transcription.api.TranscriptionServiceException
-
transcriptionError
public void transcriptionError(String mpId, Object obj) throws org.opencastproject.transcription.api.TranscriptionServiceException - Specified by:
transcriptionErrorin interfaceorg.opencastproject.transcription.api.TranscriptionService- Throws:
org.opencastproject.transcription.api.TranscriptionServiceException
-
process
- Specified by:
processin classorg.opencastproject.job.api.AbstractJobProducer- Throws:
Exception
-
getTranscriptionResults
public String getTranscriptionResults(String jobId) throws org.opencastproject.transcription.api.TranscriptionServiceException, IOException Get transcription result: GET /v1/operations/{name} Method mainly used by the REST endpoint- Parameters:
jobId-- Returns:
- job details
- Throws:
org.opencastproject.transcription.api.TranscriptionServiceExceptionIOException
-
getGeneratedTranscription
public org.opencastproject.mediapackage.MediaPackageElement getGeneratedTranscription(String mpId, String jobId, org.opencastproject.mediapackage.MediaPackageElement.Type type) throws org.opencastproject.transcription.api.TranscriptionServiceException - Specified by:
getGeneratedTranscriptionin interfaceorg.opencastproject.transcription.api.TranscriptionService- Throws:
org.opencastproject.transcription.api.TranscriptionServiceException
-
getTranscriptionStatus
public String getTranscriptionStatus(String mpId) throws org.opencastproject.transcription.api.TranscriptionServiceException Get mediapackage transcription status- Parameters:
mpId- , mediapackage id- Returns:
- transcription status
- Throws:
org.opencastproject.transcription.api.TranscriptionServiceException
-
makeHttpClient
- Throws:
IOException
-
refreshAccessToken
protected String refreshAccessToken(String clientId, String clientSecret, String refreshToken) throws org.opencastproject.transcription.api.TranscriptionServiceException, IOException - Throws:
org.opencastproject.transcription.api.TranscriptionServiceExceptionIOException
-
getRefreshAccessToken
protected String getRefreshAccessToken() throws org.opencastproject.transcription.api.TranscriptionServiceException, IOException- Throws:
org.opencastproject.transcription.api.TranscriptionServiceExceptionIOException
-
uploadAudioFileToGoogleStorage
protected String uploadAudioFileToGoogleStorage(String mpId, org.opencastproject.mediapackage.Track track) throws org.opencastproject.transcription.api.TranscriptionServiceException, IOException - Throws:
org.opencastproject.transcription.api.TranscriptionServiceExceptionIOException
-
deleteStorageFile
- Throws:
IOException
-
setServiceRegistry
public void setServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry serviceRegistry) -
setSecurityService
public void setSecurityService(org.opencastproject.security.api.SecurityService securityService) -
setUserDirectoryService
public void setUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService) -
setOrganizationDirectoryService
public void setOrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService organizationDirectoryService) -
setSmtpService
public void setSmtpService(org.opencastproject.kernel.mail.SmtpService service) -
setWorkspace
public void setWorkspace(org.opencastproject.workspace.api.Workspace ws) -
setWorkingFileRepository
public void setWorkingFileRepository(org.opencastproject.workingfilerepository.api.WorkingFileRepository wfr) -
setDatabase
public void setDatabase(org.opencastproject.transcription.persistence.TranscriptionDatabase service) -
setAssetManager
public void setAssetManager(org.opencastproject.assetmanager.api.AssetManager service) -
setWorkflowService
public void setWorkflowService(org.opencastproject.workflow.api.WorkflowService service) -
getServiceRegistry
protected org.opencastproject.serviceregistry.api.ServiceRegistry getServiceRegistry()- Specified by:
getServiceRegistryin classorg.opencastproject.job.api.AbstractJobProducer
-
getSecurityService
protected org.opencastproject.security.api.SecurityService getSecurityService()- Specified by:
getSecurityServicein classorg.opencastproject.job.api.AbstractJobProducer
-
getUserDirectoryService
protected org.opencastproject.security.api.UserDirectoryService getUserDirectoryService()- Specified by:
getUserDirectoryServicein classorg.opencastproject.job.api.AbstractJobProducer
-
getOrganizationDirectoryService
protected org.opencastproject.security.api.OrganizationDirectoryService getOrganizationDirectoryService()- Specified by:
getOrganizationDirectoryServicein classorg.opencastproject.job.api.AbstractJobProducer
-