/** * Convert file object * * @param * @return */ function convertFileObject() { global $ilCtrl; $this->checkPermission("write"); $this->mcst_item = new ilNewsItem($_GET["item_id"]); include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php"; $mob = new ilObjMediaObject($this->mcst_item->getMobId()); $target_purpose = ilUtil::stripSlashes($_POST["target_purpose"]); $target_format = ilUtil::stripSlashes($_POST["target_format"]); try { include_once "./Services/MediaObjects/classes/class.ilFFmpeg.php"; $med = $mob->getMediaItem("Standard"); $mob_file = ilObjMediaObject::_getDirectory($mob->getId()) . "/" . $med->getLocation(); $new_file = ilFFmpeg::convert($mob_file, $target_format); $ret = ilFFmpeg::getLastReturnValues(); $pi = pathinfo($new_file); $med = $mob->getMediaItem($target_purpose); if (!is_object($med)) { $med = new ilMediaItem(); $med->setMobId($mob->getId()); $mob->addMediaItem($med); $mob->update(); $med->setPurpose($target_purpose); } $med->setFormat($target_format); $med->setLocation($pi["basename"]); $med->setLocationType("LocalFile"); $med->update(); $add = is_array($ret) && count($ret) > 0 ? "<br />" . implode($ret, "<br />") : ""; ilUtil::sendInfo($this->lng->txt("mcst_converted_file") . $add, true); } catch (ilException $e) { $ret = ilFFmpeg::getLastReturnValues(); $add = is_array($ret) && count($ret) > 0 ? "<br />" . implode($ret, "<br />") : ""; ilUtil::sendFailure($e->getMessage() . $add, true); } $ilCtrl->redirect($this, "editCastItem"); }