From: Vincent Vanwaelscappel Date: Fri, 15 Sep 2023 14:54:06 +0000 (+0200) Subject: wait #5686 @0.75 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=9f34365cadaffcc763bcbfdba27b42607c340b6c;p=fluidbook-toolbox.git wait #5686 @0.75 --- diff --git a/app/Fluidbook/Compiler/Compiler.php b/app/Fluidbook/Compiler/Compiler.php index d2fe99497..6710e01fc 100644 --- a/app/Fluidbook/Compiler/Compiler.php +++ b/app/Fluidbook/Compiler/Compiler.php @@ -36,10 +36,13 @@ use Cubist\Util\Zip; use DOMDocument; use DOMElement; use DOMXPath; +use Exception; use Fluidbook\Tools\Compiler\CompilerInterface; use Fluidbook\Tools\SVG\SVGTools; use Illuminate\Console\Command; use Illuminate\Support\Facades\Log; +use PhpOffice\PhpSpreadsheet\Reader\Xlsx; +use PhpOffice\PhpSpreadsheet\Spreadsheet; use SimpleXMLElement; use SplFileInfo; @@ -885,17 +888,16 @@ class Compiler extends Base implements CompilerInterface $file = $this->wdir . '/' . $this->fluidbookSettings->audiodescriptionTexts; if (file_exists($file)) { - new PHPExcel(); - $reader = new PHPExcel_Reader_Excel2007(); + $reader = new Xlsx(); $phpexcel = $reader->load($file); $sheet = $phpexcel->getActiveSheet(); - $maxRow = $sheet->getHighestRow(0); + $maxRow = $sheet->getHighestRow('A'); for ($i = 0; $i <= $maxRow; $i++) { - $page = trim($sheet->getCellByColumnAndRow(0, $i)->getValue()); - $text = trim($sheet->getCellByColumnAndRow(1, $i)->getValue()); - $voice = trim($sheet->getCellByColumnAndRow(2, $i)->getValue()); + $page = trim($sheet->getCell('A' . $i)->getValue()); + $text = trim($sheet->getCell('B' . $i)->getValue()); + $voice = trim($sheet->getCell('C' . $i)->getValue()); if ($page == '' || $text == '') { continue; } @@ -949,7 +951,7 @@ class Compiler extends Base implements CompilerInterface } } - $this->config->audiodescription[$page] = $fname; + $this->config->set('audiodescription.' . $page, $fname); $this->vdir->copy($file, 'data/audiodescription/' . $fname); } $this->accessibleTexts[$page] = $text; @@ -966,6 +968,9 @@ class Compiler extends Base implements CompilerInterface try { $api = new \Cubist\Azure\TTS\Api('28fdfcdcc7f141b29cd9db4afc5779c5'); $api->textToSpeech($text, $locale, $gender, $voiceName, $output); + if (!file_exists($output)) { + throw new Exception('Error while making tts (' . $output . ') : ' . $text . ', ' . $locale . ', ' . $gender . ', ' . $voiceName); + } } catch (Exception $e) { dd($e); } diff --git a/app/Jobs/FluidbookCollectionDownload.php b/app/Jobs/FluidbookCollectionDownload.php index 943abbe5b..a8c518375 100644 --- a/app/Jobs/FluidbookCollectionDownload.php +++ b/app/Jobs/FluidbookCollectionDownload.php @@ -277,7 +277,7 @@ class FluidbookCollectionDownload extends DownloadBase protected function _getMultilangOptions($fluidbooks) { - $defaultFlags = ['en' => 'gb', 'sv' => 'se', 'zh' => 'cn', 'el' => 'gr']; + $defaultFlags = ['en' => 'gb', 'sv' => 'se', 'zh' => 'cn', 'el' => 'gr', 'ja' => 'jp', 'ko' => 'kr']; $multilang = []; foreach ($fluidbooks as $fbid => $publication) { diff --git a/app/Jobs/Maintenance/CleanDownloads.php b/app/Jobs/Maintenance/CleanDownloads.php index 0ebfd85a0..8a6d239a6 100644 --- a/app/Jobs/Maintenance/CleanDownloads.php +++ b/app/Jobs/Maintenance/CleanDownloads.php @@ -13,7 +13,7 @@ class CleanDownloads extends Base $days = 15; $limit = time() - (3600 * 24 * $days); - $directoriesToClean = [protected_path('signedexe/')]; + $directoriesToClean = [protected_path('signedexe/'),protected_path('fluidbookpublication/packager'),protected_path('fluidbookpublication/packager/download')]; $types = ['elearningmedia', 'elearningpackage', 'quiz', 'fluidbookcollection', 'fluidbookpublication']; foreach ($types as $type) { diff --git a/app/Models/FluidbookPublication.php b/app/Models/FluidbookPublication.php index 65d87d345..cd9c2e90f 100644 --- a/app/Models/FluidbookPublication.php +++ b/app/Models/FluidbookPublication.php @@ -151,7 +151,7 @@ class FluidbookPublication extends ToolboxSettingsModel 'column_type' => 'model_function', 'column_function_name' => 'getTitleForColumn', 'column_move_after' => 'id', - 'column_limit' => 150, + 'column_limit' => 500, 'column_escape' => false, ], 'c_pages' => [ @@ -722,7 +722,7 @@ class FluidbookPublication extends ToolboxSettingsModel if ($this->mobileNavigationType === 'mobilefirst') { $more .= ' '; } - return '' . e($this->c_title) . $more . ''; + return '' . e(trim($this->c_title, ' -')) . $more . ''; } public function allowsDownload()