Code cleanup
This commit is contained in:
parent
5cf5ff4fa1
commit
c132cac43d
5 changed files with 35 additions and 22 deletions
|
@ -761,7 +761,19 @@ SQL;
|
|||
}
|
||||
}
|
||||
|
||||
private static function createFileScheduleEvent(&$data, $item, $media_id, $uri, $object_name=null)
|
||||
/**
|
||||
*
|
||||
* Appends schedule "events" to an array of schedule events that gets
|
||||
* sent to PYPO. Each schedule event contains information PYPO and
|
||||
* Liquidsoap need for playout.
|
||||
*
|
||||
* @param Array $data array to be filled with schedule info - $item(s)
|
||||
* @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 $amazonS3ResourceId scheduled item's Amazon S3 resource id, if applicable
|
||||
*/
|
||||
private static function createFileScheduleEvent(&$data, $item, $media_id, $uri, $amazonS3ResourceId)
|
||||
{
|
||||
$start = self::AirtimeTimeToPypoTime($item["start"]);
|
||||
$end = self::AirtimeTimeToPypoTime($item["end"]);
|
||||
|
@ -797,8 +809,8 @@ SQL;
|
|||
'replay_gain' => $replay_gain,
|
||||
'independent_event' => $independent_event
|
||||
);
|
||||
if (!is_null($object_name)) {
|
||||
$schedule_item["object_name"] = $object_name;
|
||||
if (!is_null($amazonS3ResourceId)) {
|
||||
$schedule_item["amazonS3_resource_id"] = $amazonS3ResourceId;
|
||||
}
|
||||
|
||||
if ($schedule_item['cue_in'] > $schedule_item['cue_out']) {
|
||||
|
@ -934,11 +946,8 @@ SQL;
|
|||
$file = $storedFile->getPropelOrm();
|
||||
$uri = $file->getAbsoluteFilePath();
|
||||
|
||||
$object_name = null;
|
||||
if ($file instanceof CloudFile) {
|
||||
$object_name = $storedFile->getResourceId();
|
||||
}
|
||||
self::createFileScheduleEvent($data, $item, $media_id, $uri, $object_name);
|
||||
$amazonS3ResourceId = $file->getResourceId();
|
||||
self::createFileScheduleEvent($data, $item, $media_id, $uri, $amazonS3ResourceId);
|
||||
}
|
||||
elseif (!is_null($item['stream_id'])) {
|
||||
//row is type "webstream"
|
||||
|
|
|
@ -111,7 +111,7 @@ class CcFiles extends BaseCcFiles {
|
|||
/**
|
||||
* Checks if the file is a regular file that can be previewed and downloaded.
|
||||
*/
|
||||
public function isValidFile()
|
||||
public function isValidPhysicalFile()
|
||||
{
|
||||
return is_file($this->getAbsoluteFilePath());
|
||||
}
|
||||
|
@ -130,4 +130,14 @@ class CcFiles extends BaseCcFiles {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* This function refers to the file's Amazon S3 resource id.
|
||||
* Returns null because cc_files are stored on local disk.
|
||||
*/
|
||||
public function getResourceId()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
} // CcFiles
|
||||
|
|
|
@ -93,7 +93,7 @@ class CloudFile extends BaseCloudFile
|
|||
/**
|
||||
* Checks if the file is a regular file that can be previewed and downloaded.
|
||||
*/
|
||||
public function isValidFile()
|
||||
public function isValidPhysicalFile()
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt_array($ch, array(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue