Skip to content

Commit 987791d

Browse files
committed
feat(TaskProcessing): add AudioToTextSubtitles TaskType
Signed-off-by: Edward Ly <contact@edward.ly>
1 parent 188006b commit 987791d

4 files changed

Lines changed: 100 additions & 0 deletions

File tree

lib/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,7 @@
938938
'OCP\\TaskProcessing\\TaskTypes\\AnalyzeImages' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/AnalyzeImages.php',
939939
'OCP\\TaskProcessing\\TaskTypes\\AudioToAudioChat' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/AudioToAudioChat.php',
940940
'OCP\\TaskProcessing\\TaskTypes\\AudioToText' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/AudioToText.php',
941+
'OCP\\TaskProcessing\\TaskTypes\\AudioToTextSubtitles' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/AudioToTextSubtitles.php',
941942
'OCP\\TaskProcessing\\TaskTypes\\ContextAgentAudioInteraction' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/ContextAgentAudioInteraction.php',
942943
'OCP\\TaskProcessing\\TaskTypes\\ContextAgentInteraction' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/ContextAgentInteraction.php',
943944
'OCP\\TaskProcessing\\TaskTypes\\ContextWrite' => $baseDir . '/lib/public/TaskProcessing/TaskTypes/ContextWrite.php',

lib/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
979979
'OCP\\TaskProcessing\\TaskTypes\\AnalyzeImages' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/AnalyzeImages.php',
980980
'OCP\\TaskProcessing\\TaskTypes\\AudioToAudioChat' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/AudioToAudioChat.php',
981981
'OCP\\TaskProcessing\\TaskTypes\\AudioToText' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/AudioToText.php',
982+
'OCP\\TaskProcessing\\TaskTypes\\AudioToTextSubtitles' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/AudioToTextSubtitles.php',
982983
'OCP\\TaskProcessing\\TaskTypes\\ContextAgentAudioInteraction' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/ContextAgentAudioInteraction.php',
983984
'OCP\\TaskProcessing\\TaskTypes\\ContextAgentInteraction' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/ContextAgentInteraction.php',
984985
'OCP\\TaskProcessing\\TaskTypes\\ContextWrite' => __DIR__ . '/../../..' . '/lib/public/TaskProcessing/TaskTypes/ContextWrite.php',

lib/private/TaskProcessing/Manager.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
use OCP\TaskProcessing\TaskTypes\AnalyzeImages;
7373
use OCP\TaskProcessing\TaskTypes\AudioToAudioChat;
7474
use OCP\TaskProcessing\TaskTypes\AudioToText;
75+
use OCP\TaskProcessing\TaskTypes\AudioToTextSubtitles;
7576
use OCP\TaskProcessing\TaskTypes\ContextAgentAudioInteraction;
7677
use OCP\TaskProcessing\TaskTypes\ContextAgentInteraction;
7778
use OCP\TaskProcessing\TaskTypes\ContextWrite;
@@ -687,6 +688,7 @@ private function _getTaskTypes(): array {
687688
TextToTextReformulation::ID => Server::get(TextToTextReformulation::class),
688689
TextToImage::ID => Server::get(TextToImage::class),
689690
AudioToText::ID => Server::get(AudioToText::class),
691+
AudioToTextSubtitles::ID => Server::get(AudioToTextSubtitles::class),
690692
ContextWrite::ID => Server::get(ContextWrite::class),
691693
GenerateEmoji::ID => Server::get(GenerateEmoji::class),
692694
TextToTextChangeTone::ID => Server::get(TextToTextChangeTone::class),
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OCP\TaskProcessing\TaskTypes;
11+
12+
use OCP\IL10N;
13+
use OCP\L10N\IFactory;
14+
use OCP\TaskProcessing\EShapeType;
15+
use OCP\TaskProcessing\ITaskType;
16+
use OCP\TaskProcessing\ShapeDescriptor;
17+
18+
/**
19+
* This is the task processing task type for subtitles transcription
20+
* @since 35.0.0
21+
*/
22+
class AudioToTextSubtitles implements ITaskType {
23+
/**
24+
* @since 35.0.0
25+
*/
26+
public const ID = 'core:audio2text:subtitles';
27+
28+
private IL10N $l;
29+
30+
/**
31+
* @param IFactory $l10nFactory
32+
* @since 35.0.0
33+
*/
34+
public function __construct(
35+
IFactory $l10nFactory,
36+
) {
37+
$this->l = $l10nFactory->get('lib');
38+
}
39+
40+
/**
41+
* @inheritDoc
42+
* @since 35.0.0
43+
*/
44+
#[\Override]
45+
public function getName(): string {
46+
return $this->l->t('Generate subtitles');
47+
}
48+
49+
/**
50+
* @inheritDoc
51+
* @since 35.0.0
52+
*/
53+
#[\Override]
54+
public function getDescription(): string {
55+
return $this->l->t('Subtitle the things said in an audio');
56+
}
57+
58+
/**
59+
* @return string
60+
* @since 35.0.0
61+
*/
62+
#[\Override]
63+
public function getId(): string {
64+
return self::ID;
65+
}
66+
67+
/**
68+
* @return ShapeDescriptor[]
69+
* @since 35.0.0
70+
*/
71+
#[\Override]
72+
public function getInputShape(): array {
73+
return [
74+
'input' => new ShapeDescriptor(
75+
$this->l->t('Input file'),
76+
$this->l->t('The file to subtitle'),
77+
EShapeType::File
78+
),
79+
];
80+
}
81+
82+
/**
83+
* @return ShapeDescriptor[]
84+
* @since 35.0.0
85+
*/
86+
#[\Override]
87+
public function getOutputShape(): array {
88+
return [
89+
'output' => new ShapeDescriptor(
90+
$this->l->t('Subtitles'),
91+
$this->l->t('The subtitles file'),
92+
EShapeType::File
93+
),
94+
];
95+
}
96+
}

0 commit comments

Comments
 (0)