try {
$api = new Api(env('AZURE_TTS_API_KEY'));
$voices = $api->listVoices(true);
+
if ($voices) {
foreach ($voices as $key => $voice) {
- $res['azuretts:' . $voice['Locale'] . '/' . $voice['Gender'] . '/' . $voice['ShortName']] = 'Azure ' . $voice['DisplayName'] . ' (' . $voice['Locale'] . ')';
+ if (isset($voice['SecondaryLocaleList'])) {
+ foreach ($voice['SecondaryLocaleList'] as $secVoice) {
+ $res['azuretts:' . $voice['Locale'] . '|' . $secVoice . '/' . $voice['Gender'] . '/' . $voice['ShortName']] = 'Azure ' . $voice['DisplayName'] . ' (' . $secVoice . ')';
+ }
+ } else {
+ $res['azuretts:' . $voice['Locale'] . '/' . $voice['Gender'] . '/' . $voice['ShortName']] = 'Azure ' . $voice['DisplayName'] . ' (' . $voice['Locale'] . ')';
+ }
+
}
}
} catch (\Exception $e) {
$voiceInfos = $data['voice'] ?? $this->fluidbookSettings->audiodescriptionVoice;
if ($voiceInfos) {
- $e = explode(':', $voiceInfos);
+ $e = explode(':', $voiceInfos, 2);
if (count($e) === 1) {
$engine = 'azuretts';
use Cubist\Backpack\Magic\Form;
use Cubist\Azure\TTS\Api;
use Cubist\Util\Files\Files;
+
// __('!! Outils')
trait TextToSpeech
{
-
-
public function tts()
{
$form = new Form(backpack_url('tools/gettts'));
$form->setTitle(__('Text to speech'));
$form->setSubmitLabel(__('Générer'));
$form->setSubmitIcon('la-volume-up');
- $form->addField('voice', SelectFromArray::class, __('Voix'), ['options' => $this->_api()->listVoices(), 'default' => 'fr-FR/Female/fr-FR-DeniseNeural', 'show_selected_option' => true]);
+ $form->addField('voice', SelectFromArray::class, __('Voix'), ['options' => $this->_api()->listVoices(false, true), 'default' => 'fr-FR/Female/fr-FR-DeniseNeural', 'show_selected_option' => true]);
$form->addField('text', Textarea::class, __('Texte'));
return view('tools.form', ['form' => $form]);
'singular' => 'lien',
'plural' => 'liens'];
- protected $_enableEdition = false;
+ protected $_enableEdition = true;
protected $_enableClone = false;
protected $_enableCreation = false;
+ protected $_enableDeletion = false;
protected $_enableRevisions = false;
$this->addField('server', SelectFromArray::class, __('Serveur'), ['type' => 'hidden', 'options' => LinkShortener::getAvaiableShorteners()]);
$this->addField('url', URL::class, __('URL'), ['column' => true]);
- $this->addField('shortlink', URL::class, __('Short URL'), ['type' => 'hidden_visible', 'column' => true, 'database_unique' => true]);
+ $this->addField('shortlink', URL::class, __('Short URL'), ['type' => 'hidden_visible', 'column' => 'url', 'database_unique' => true]);
$this->addOwnerField(['column' => false, 'type' => Hidden::class]);
}
+ public function showPrimaryColumn()
+ {
+ return false;
+ }
+
/**
* @throws \Exception
*/