|
36 | 36 | use OCP\IServerContainer;
|
37 | 37 | use OCP\L10N\IFactory;
|
38 | 38 | use OCP\Lock\LockedException;
|
| 39 | +use OCP\SpeechToText\ISpeechToTextManager; |
39 | 40 | use OCP\SpeechToText\ISpeechToTextProvider;
|
40 | 41 | use OCP\SpeechToText\ISpeechToTextProviderWithId;
|
41 | 42 | use OCP\TaskProcessing\EShapeType;
|
@@ -95,31 +96,9 @@ public function __construct(
|
95 | 96 | $this->appData = $appDataFactory->get('core');
|
96 | 97 | }
|
97 | 98 |
|
98 |
| - |
99 |
| - /** |
100 |
| - * This is almost a copy of textProcessingManager->getProviders |
101 |
| - * to avoid a dependency cycle between TextProcessingManager and TaskProcessingManager |
102 |
| - */ |
103 | 99 | private function _getRawTextProcessingProviders(): array {
|
104 |
| - $context = $this->coordinator->getRegistrationContext(); |
105 |
| - if ($context === null) { |
106 |
| - return []; |
107 |
| - } |
108 |
| - |
109 |
| - $providers = []; |
110 |
| - |
111 |
| - foreach ($context->getTextProcessingProviders() as $providerServiceRegistration) { |
112 |
| - $class = $providerServiceRegistration->getService(); |
113 |
| - try { |
114 |
| - $providers[$class] = $this->serverContainer->get($class); |
115 |
| - } catch (\Throwable $e) { |
116 |
| - $this->logger->error('Failed to load Text processing provider ' . $class, [ |
117 |
| - 'exception' => $e, |
118 |
| - ]); |
119 |
| - } |
120 |
| - } |
121 |
| - |
122 |
| - return $providers; |
| 100 | + $textProcessingManager = \OCP\Server::get(\OCP\TextProcessing\IManager::class); |
| 101 | + return $textProcessingManager->getProviders(); |
123 | 102 | }
|
124 | 103 |
|
125 | 104 | private function _getTextProcessingProviders(): array {
|
@@ -368,28 +347,9 @@ public function getOptionalOutputShapeEnumValues(): array {
|
368 | 347 | return $newProviders;
|
369 | 348 | }
|
370 | 349 |
|
371 |
| - /** |
372 |
| - * This is almost a copy of SpeechToTextManager->getProviders |
373 |
| - * to avoid a dependency cycle between SpeechToTextManager and TaskProcessingManager |
374 |
| - */ |
375 | 350 | private function _getRawSpeechToTextProviders(): array {
|
376 |
| - $context = $this->coordinator->getRegistrationContext(); |
377 |
| - if ($context === null) { |
378 |
| - return []; |
379 |
| - } |
380 |
| - $providers = []; |
381 |
| - foreach ($context->getSpeechToTextProviders() as $providerServiceRegistration) { |
382 |
| - $class = $providerServiceRegistration->getService(); |
383 |
| - try { |
384 |
| - $providers[$class] = $this->serverContainer->get($class); |
385 |
| - } catch (NotFoundExceptionInterface|ContainerExceptionInterface|\Throwable $e) { |
386 |
| - $this->logger->error('Failed to load SpeechToText provider ' . $class, [ |
387 |
| - 'exception' => $e, |
388 |
| - ]); |
389 |
| - } |
390 |
| - } |
391 |
| - |
392 |
| - return $providers; |
| 351 | + $speechToTextManager = \OCP\Server::get(ISpeechToTextManager::class); |
| 352 | + return $speechToTextManager->getProviders(); |
393 | 353 | }
|
394 | 354 |
|
395 | 355 | /**
|
|
0 commit comments