Merge pull request #61127 from nextcloud/feat/noid/subtitles-task

feat(TaskProcessing): add AudioToTextSubtitles TaskType
This commit is contained in:
Julien Veyssier 2026-06-24 11:57:24 +02:00 committed by GitHub
commit 0ade15d9fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 100 additions and 0 deletions

View file

@ -943,6 +943,7 @@ return array(
'OCP\\TaskProcessing\\TaskTypes\\AnalyzeImages' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/AnalyzeImages.php',
'OCP\\TaskProcessing\\TaskTypes\\AudioToAudioChat' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/AudioToAudioChat.php',
'OCP\\TaskProcessing\\TaskTypes\\AudioToText' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/AudioToText.php',
'OCP\\TaskProcessing\\TaskTypes\\AudioToTextSubtitles' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/AudioToTextSubtitles.php',
'OCP\\TaskProcessing\\TaskTypes\\ContextAgentAudioInteraction' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/ContextAgentAudioInteraction.php',
'OCP\\TaskProcessing\\TaskTypes\\ContextAgentInteraction' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/ContextAgentInteraction.php',
'OCP\\TaskProcessing\\TaskTypes\\ContextWrite' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/ContextWrite.php',

View file

@ -984,6 +984,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OCP\\TaskProcessing\\TaskTypes\\AnalyzeImages' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/AnalyzeImages.php',
'OCP\\TaskProcessing\\TaskTypes\\AudioToAudioChat' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/AudioToAudioChat.php',
'OCP\\TaskProcessing\\TaskTypes\\AudioToText' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/AudioToText.php',
'OCP\\TaskProcessing\\TaskTypes\\AudioToTextSubtitles' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/AudioToTextSubtitles.php',
'OCP\\TaskProcessing\\TaskTypes\\ContextAgentAudioInteraction' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/ContextAgentAudioInteraction.php',
'OCP\\TaskProcessing\\TaskTypes\\ContextAgentInteraction' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/ContextAgentInteraction.php',
'OCP\\TaskProcessing\\TaskTypes\\ContextWrite' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/ContextWrite.php',

View file

@ -72,6 +72,7 @@ use OCP\TaskProcessing\Task;
use OCP\TaskProcessing\TaskTypes\AnalyzeImages;
use OCP\TaskProcessing\TaskTypes\AudioToAudioChat;
use OCP\TaskProcessing\TaskTypes\AudioToText;
use OCP\TaskProcessing\TaskTypes\AudioToTextSubtitles;
use OCP\TaskProcessing\TaskTypes\ContextAgentAudioInteraction;
use OCP\TaskProcessing\TaskTypes\ContextAgentInteraction;
use OCP\TaskProcessing\TaskTypes\ContextWrite;
@ -687,6 +688,7 @@ class Manager implements IManager {
TextToTextReformulation::ID => Server::get(TextToTextReformulation::class),
TextToImage::ID => Server::get(TextToImage::class),
AudioToText::ID => Server::get(AudioToText::class),
AudioToTextSubtitles::ID => Server::get(AudioToTextSubtitles::class),
ContextWrite::ID => Server::get(ContextWrite::class),
GenerateEmoji::ID => Server::get(GenerateEmoji::class),
TextToTextChangeTone::ID => Server::get(TextToTextChangeTone::class),

View file

@ -0,0 +1,96 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\TaskProcessing\TaskTypes;
use OCP\IL10N;
use OCP\L10N\IFactory;
use OCP\TaskProcessing\EShapeType;
use OCP\TaskProcessing\ITaskType;
use OCP\TaskProcessing\ShapeDescriptor;
/**
* This is the task processing task type for subtitles transcription
* @since 35.0.0
*/
class AudioToTextSubtitles implements ITaskType {
/**
* @since 35.0.0
*/
public const ID = 'core:audio2text:subtitles';
private IL10N $l;
/**
* @param IFactory $l10nFactory
* @since 35.0.0
*/
public function __construct(
IFactory $l10nFactory,
) {
$this->l = $l10nFactory->get('lib');
}
/**
* @inheritDoc
* @since 35.0.0
*/
#[\Override]
public function getName(): string {
return $this->l->t('Generate subtitles');
}
/**
* @inheritDoc
* @since 35.0.0
*/
#[\Override]
public function getDescription(): string {
return $this->l->t('Subtitle the things said in an audio or video');
}
/**
* @return string
* @since 35.0.0
*/
#[\Override]
public function getId(): string {
return self::ID;
}
/**
* @return ShapeDescriptor[]
* @since 35.0.0
*/
#[\Override]
public function getInputShape(): array {
return [
'input' => new ShapeDescriptor(
$this->l->t('Input file'),
$this->l->t('The file to subtitle'),
EShapeType::File
),
];
}
/**
* @return ShapeDescriptor[]
* @since 35.0.0
*/
#[\Override]
public function getOutputShape(): array {
return [
'output' => new ShapeDescriptor(
$this->l->t('Subtitles'),
$this->l->t('The subtitles file'),
EShapeType::File
),
];
}
}