server/src/app/Libraries/Transcript/TranscriptConverterBase.php
changeset 163 59c68fc4848e
parent 162 a6cf5a06f02d
child 168 17f10b56c079
equal deleted inserted replaced
162:a6cf5a06f02d 163:59c68fc4848e
     7 use DateTime;
     7 use DateTime;
     8 
     8 
     9 
     9 
    10 abstract class TranscriptConverterBase implements Transcriptconverterinterface {
    10 abstract class TranscriptConverterBase implements Transcriptconverterinterface {
    11 
    11 
    12     public function __construct(Document $document, $source, string $creationDate = null) {
    12     public function __construct(Document $document, string $source, string $creationDate = null) {
    13         $this->resJSON = [];
    13         $this->resJSON = [];
    14         $this->document = $document;
    14         $this->document = $document;
    15         $this->source = $source;
    15 
       
    16         $this->source = new \DOMDocument();
       
    17         $this->source->loadXML($source, LIBXML_NOCDATA|LIBXML_NOBLANKS);
       
    18 
    16         $this->creationDate = $creationDate;
    19         $this->creationDate = $creationDate;
    17         $this->mediaRefId = null;
    20         $this->mediaRefId = null;
    18         if(is_null($this->creationDate)) {
    21         if(is_null($this->creationDate)) {
    19             $this->creationDate = (new DateTime())->format(DateTime::ATOM);
    22             $this->creationDate = (new DateTime())->format(DateTime::ATOM);
    20         }
    23         }
    75         $medias = [];
    78         $medias = [];
    76 
    79 
    77         $i = 1;
    80         $i = 1;
    78         foreach($this->document->getMediaArray() as $documentMedia)
    81         foreach($this->document->getMediaArray() as $documentMedia)
    79         {
    82         {
    80             if(0 !== strpos($documentMedia['format'], 'audio/')) {
    83             if((0 !== strpos($documentMedia['format'], 'audio/')) &&
       
    84                (0 !== strpos($documentMedia['format'], 'video/')) &&
       
    85                (0 !== strpos($documentMedia['format'], 'Sampling:')) ) {
    81                 continue;
    86                 continue;
    82             }
    87             }
    83 
    88 
    84             $mId = $this->document->getId()."_m$i";
    89             $mId = $this->document->getId()."_m$i";
    85             $i++;
    90             $i++;