summaryrefslogtreecommitdiffstats
path: root/lib/private/SpeechToText
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2023-04-19 12:35:13 +0200
committerMarcel Klehr <mklehr@gmx.net>2023-04-19 12:35:13 +0200
commita2f5421fc3eb13ed28167e97483fa7eaa4e65841 (patch)
treeeec8142c6eb4c88afb3309361a23c64a2d07a554 /lib/private/SpeechToText
parenta8b27c91265a883aaa1563c33edf8d6917af63b1 (diff)
downloadnextcloud-server-a2f5421fc3eb13ed28167e97483fa7eaa4e65841.tar.gz
nextcloud-server-a2f5421fc3eb13ed28167e97483fa7eaa4e65841.zip
SpeechToTextManager#scheduleFileTranscription: Take context params and expose them on the Transcription*Events
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Diffstat (limited to 'lib/private/SpeechToText')
-rw-r--r--lib/private/SpeechToText/SpeechToTextManager.php9
-rw-r--r--lib/private/SpeechToText/TranscriptionJob.php8
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/private/SpeechToText/SpeechToTextManager.php b/lib/private/SpeechToText/SpeechToTextManager.php
index d6f7e74c95e..95208e5b0ca 100644
--- a/lib/private/SpeechToText/SpeechToTextManager.php
+++ b/lib/private/SpeechToText/SpeechToTextManager.php
@@ -90,12 +90,17 @@ class SpeechToTextManager implements ISpeechToTextManager {
return !empty($context->getSpeechToTextProviders());
}
- public function scheduleFileTranscription(File $file): void {
+ public function scheduleFileTranscription(File $file, string $userId, string $appId): void {
if (!$this->hasProviders()) {
throw new PreConditionNotMetException('No SpeechToText providers have been registered');
}
try {
- $this->jobList->add(TranscriptionJob::class, ['fileId' => $file->getId(), 'owner' => $file->getOwner()->getUID()]);
+ $this->jobList->add(TranscriptionJob::class, [
+ 'fileId' => $file->getId(),
+ 'owner' => $file->getOwner()->getUID(),
+ 'userId' => $userId,
+ 'appId' => $appId,
+ ]);
} catch (NotFoundException|InvalidPathException $e) {
throw new InvalidArgumentException('Invalid file provided for file transcription: ' . $e->getMessage());
}
diff --git a/lib/private/SpeechToText/TranscriptionJob.php b/lib/private/SpeechToText/TranscriptionJob.php
index c77ae23ac02..d5cc9ed7c38 100644
--- a/lib/private/SpeechToText/TranscriptionJob.php
+++ b/lib/private/SpeechToText/TranscriptionJob.php
@@ -58,6 +58,8 @@ class TranscriptionJob extends QueuedJob {
protected function run($argument) {
$fileId = $argument['fileId'];
$owner = $argument['owner'];
+ $userId = $argument['userId'];
+ $appId = $argument['appId'];
$file = null;
try {
\OC_Util::setupFS($owner);
@@ -70,6 +72,8 @@ class TranscriptionJob extends QueuedJob {
$fileId,
null,
'File not found',
+ $userId,
+ $appId,
)
);
return;
@@ -80,6 +84,8 @@ class TranscriptionJob extends QueuedJob {
$fileId,
$file,
$result,
+ $userId,
+ $appId,
)
);
} catch (PreConditionNotMetException|\RuntimeException|\InvalidArgumentException|NotFoundException|NotPermittedException|NoUserException $e) {
@@ -89,6 +95,8 @@ class TranscriptionJob extends QueuedJob {
$fileId,
$file,
$e->getMessage(),
+ $userId,
+ $appId,
)
);
}