]> _ Git - fluidbook-toolbox.git/commitdiff
wait #5686 @0.75
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 15 Sep 2023 14:54:06 +0000 (16:54 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 15 Sep 2023 14:54:06 +0000 (16:54 +0200)
app/Fluidbook/Compiler/Compiler.php
app/Jobs/FluidbookCollectionDownload.php
app/Jobs/Maintenance/CleanDownloads.php
app/Models/FluidbookPublication.php

index d2fe99497ee3f231554d6d8e6873cf4a62d70b7b..6710e01fcf4141f728c148c02070e6eb8ff6f687 100644 (file)
@@ -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);
         }
index 943abbe5bbb5532081587f50c505b743a596f091..a8c51837572def6a1eb59f7c2235a823b03df2e6 100644 (file)
@@ -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) {
index 0ebfd85a0ae1457013923a5401fbb8b9977e8de2..8a6d239a6900741c54890e6f39ebd0f43886327e 100644 (file)
@@ -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) {
index 65d87d3452ba6958eebcc212be57eff224e856e1..cd9c2e90f4544bd3be8ed5909d1d253e76076711 100644 (file)
@@ -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 .= '&nbsp;<i class="fluidbook-title-icon las la-mobile"></i>';
         }
-        return '<span style="white-space: normal;">' . e($this->c_title) . $more . '</span>';
+        return '<span style="white-space: normal;">' . e(trim($this->c_title, ' -')) . $more . '</span>';
     }
 
     public function allowsDownload()