Esempio n. 1
0
 public function downloadListAction()
 {
     $this->_checkLoggedUser();
     $multimediaService = new Service_Multimedia();
     $downloadList = $multimediaService->getDownloadListDetails();
     $this->view->downloadLinkList = $downloadList;
 }
 public function downloadVideoAction()
 {
     set_time_limit(0);
     $cronId = md5(time());
     require 'WindowsAzure/WindowsAzure.php';
     $multimediaService = new Service_Multimedia();
     $videoToConvert = $multimediaService->getVideoToConvert();
     $multimediaService->markAsInProgress($videoToConvert['id']);
     try {
         $audioFileName = $multimediaService->downloadVideo($videoToConvert, $cronId);
         $filePath = realpath(sprintf('%s/../data/downloads/%s', APPLICATION_PATH, $audioFileName));
         $multimediaService->storeBlobInAzure($filePath, $audioFileName);
         $multimediaService->setBlobName($audioFileName, $videoToConvert['id']);
     } catch (Exception $exception) {
         $multimediaService->markAsFailed($videoToConvert['id']);
         echo $exception->getMessage();
     }
     $multimediaService->collectGarbage($cronId);
 }