private function generateSubdef(\record_adapter $record, \databox_subdef $subdef_class, $pathdest) { try { if (null === $record->get_hd_file()) { $this->logger->addInfo('No HD file found, aborting'); return; } $this->alchemyst->turnInto($record->get_hd_file()->getPathname(), $pathdest, $subdef_class->getSpecs()); } catch (MediaAlchemystException $e) { $this->logger->error(sprintf('Subdef generation failed for record %d with message %s', $record->get_record_id(), $e->getMessage())); } }
/** * * @param record_adapter $record * @return array */ private function check_record_constraints(record_adapter $record) { $errors = []; if (!$record->get_hd_file() instanceof \SplFileInfo) { $errors["file_size"] = $this->translator->trans("Le record n'a pas de fichier physique"); } //Record must rely on real file if ($record->get_duration() > self::AUTH_VIDEO_DURATION) { $errors["duration"] = $this->translator->trans("La taille maximale d'une video est de %duration% minutes.", ['%duration%' => self::AUTH_VIDEO_DURATION / 60]); } if ($record->get_technical_infos('size') > self::AUTH_VIDEO_SIZE) { $errors["size"] = $this->translator->trans("Le poids maximum d'un fichier est de %size%", ['%size%' => p4string::format_octets(self::AUTH_VIDEO_SIZE)]); } return $errors; }
/** * * @param record_adapter $record * @return array */ private function check_record_constraints(record_adapter $record) { $errors = []; //Record must rely on real file if (!$record->get_hd_file() instanceof \SplFileInfo) { $errors["file_size"] = $this->translator->trans("Le record n'a pas de fichier physique"); } $size = $record->get_technical_infos('size'); $size = $size ? $size->getValue() : PHP_INT_MAX; if ($size > self::AUTH_PHOTO_SIZE) { $errors["size"] = $this->translator->trans("Le poids maximum d'un fichier est de %size%", ['%size%' => p4string::format_octets(self::AUTH_VIDEO_SIZE)]); } return $errors; }