SAAS-503: PYPO -> Use the REST API to download files

This commit is contained in:
drigato 2014-12-03 13:22:52 -05:00
parent e1f1807f5a
commit 16dc286420
3 changed files with 21 additions and 21 deletions

View file

@ -771,6 +771,9 @@ SQL;
* @param Array $item schedule info about one track
* @param Integer $media_id scheduled item's cc_files id
* @param String $uri path to the scheduled item's physical location
* @param String $downloadURL URL PYPO makes to the REST API to download the file for playout
* @param Integer $filsize The file's file size in bytes
*
*/
private static function createFileScheduleEvent(&$data, $item, $media_id, $uri, $downloadURL, $filesize)
{
@ -943,8 +946,9 @@ SQL;
$storedFile = Application_Model_StoredFile::RecallById($media_id);
$file = $storedFile->getPropelOrm();
$uri = $file->getAbsoluteFilePath();
// TODO: fix this URL
$downloadURL = "http://localhost/rest/media/$media_id/download";
$baseUrl = Application_Common_OsPath::getBaseDir();
$downloadURL = "http://".$_SERVER['HTTP_HOST'].$baseUrl."rest/media/$media_id/download";
$filesize = $file->getFileSize();
self::createFileScheduleEvent($data, $item, $media_id, $uri, $downloadURL, $filesize);