Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

Conflicts:
	airtime_mvc/application/controllers/PreferenceController.php
	airtime_mvc/application/models/Preference.php
This commit is contained in:
james 2011-06-20 18:09:37 -04:00
commit 05dc48fa71
55 changed files with 907 additions and 664 deletions

View file

@ -127,5 +127,35 @@ class DateHelper
$explode = explode(" ", $p_timestamp);
return $explode[1];
}
/* Given a track length in the format HH:MM:SS.mm, we want to
* convert this to seconds. This is useful for Liquidsoap which
* likes input parameters give in seconds.
* For example, 00:06:31.444, should be converted to 391.444 seconds
* @param int $p_time
* The time interval in format HH:MM:SS.mm we wish to
* convert to seconds.
* @return int
* The input parameter converted to seconds.
*/
public static function calculateLengthInSeconds($p_time){
if (2 !== substr_count($p_time, ":")){
return FALSE;
}
if (1 === substr_count($p_time, ".")){
list($hhmmss, $ms) = explode(".", $p_time);
} else {
$hhmmss = $p_time;
$ms = 0;
}
list($hours, $minutes, $seconds) = explode(":", $hhmmss);
$totalSeconds = $hours*3600 + $minutes*60 + $seconds + $ms/1000;
return $totalSeconds;
}
}

View file

@ -393,7 +393,7 @@ class Playlist {
->orderByDbPosition()
->filterByDbPlaylistId($this->id)
->find();
$i = 0;
$offset = 0;
foreach ($rows as $row) {
@ -502,7 +502,7 @@ class Playlist {
}
$metadata = $media->getMetadata();
$length = $metadata["dcterms:extent"];
$length = $metadata['MDATA_KEY_DURATION'];
if (!is_null($p_clipLength)) {
$length = $p_clipLength;

View file

@ -36,7 +36,7 @@ class Application_Model_Preference
else if(is_null($id)) {
$sql = "INSERT INTO cc_pref (keystr, valstr)"
." VALUES ('$key', '$value')";
}
}
else {
$sql = "INSERT INTO cc_pref (subjid, keystr, valstr)"
." VALUES ($id, '$key', '$value')";
@ -188,6 +188,7 @@ class Application_Model_Preference
return $val;
}
}
<<<<<<< HEAD
public static function SetPhone($phone){
Application_Model_Preference::SetValue("phone", $phone);
@ -350,5 +351,16 @@ class Application_Model_Preference
return Application_Model_Preference::GetValue("remindme");
}
=======
public static function SetWatchedDirectory($directory) {
Application_Model_Preference::SetValue("watched_directory", $directory);
}
public static function GetWatchedDirectory() {
return Application_Model_Preference::GetValue("watched_directory");
}
>>>>>>> 898cdc64dc65c03d2ed6e3f3344b273df7c0d201
}

View file

@ -40,10 +40,12 @@ class RabbitMq
}
}
public static function SendFileMetaData($md)
public static function SendMessageToMediaMonitor($event_type, $md)
{
global $CC_CONFIG;
$md["event_type"] = $event_type;
$conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"],
$CC_CONFIG["rabbitmq"]["port"],
$CC_CONFIG["rabbitmq"]["user"],

View file

@ -184,7 +184,9 @@ class ScheduleGroup {
." st.cue_out,"
." st.clip_length,"
." st.fade_in,"
." st.fade_out"
." st.fade_out,"
." st.starts,"
." st.ends"
." FROM $CC_CONFIG[scheduleTable] as st"
." LEFT JOIN $CC_CONFIG[showInstances] as si"
." ON st.instance_id = si.id"
@ -676,7 +678,7 @@ class Schedule {
$timestamp = strtotime($start);
$playlists[$pkey]['source'] = "PLAYLIST";
$playlists[$pkey]['x_ident'] = $dx['group_id'];
$playlists[$pkey]['subtype'] = '1'; // Just needs to be between 1 and 4 inclusive
//$playlists[$pkey]['subtype'] = '1'; // Just needs to be between 1 and 4 inclusive
$playlists[$pkey]['timestamp'] = $timestamp;
$playlists[$pkey]['duration'] = $dx['clip_length'];
$playlists[$pkey]['played'] = '0';
@ -696,27 +698,24 @@ class Schedule {
$scheduleGroup = new ScheduleGroup($playlist["schedule_id"]);
$items = $scheduleGroup->getItems();
$medias = array();
$playlist['subtype'] = '1';
foreach ($items as $item)
{
$storedFile = StoredFile::Recall($item["file_id"]);
$uri = $storedFile->getFileUrl();
// For pypo, a cueout of zero means no cueout
$cueOut = "0";
if (Schedule::TimeDiff($item["cue_out"], $item["clip_length"]) > 0.001) {
$cueOut = Schedule::WallTimeToMillisecs($item["cue_out"]);
}
$medias[] = array(
$starts = Schedule::AirtimeTimeToPypoTime($item["starts"]);
$medias[$starts] = array(
'row_id' => $item["id"],
'id' => $storedFile->getGunid(),
'uri' => $uri,
'fade_in' => Schedule::WallTimeToMillisecs($item["fade_in"]),
'fade_out' => Schedule::WallTimeToMillisecs($item["fade_out"]),
'fade_cross' => 0,
'cue_in' => Schedule::WallTimeToMillisecs($item["cue_in"]),
'cue_out' => $cueOut,
'export_source' => 'scheduler'
'cue_in' => DateHelper::CalculateLengthInSeconds($item["cue_in"]),
'cue_out' => DateHelper::CalculateLengthInSeconds($item["cue_out"]),
'export_source' => 'scheduler',
'start' => $starts,
'end' => Schedule::AirtimeTimeToPypoTime($item["ends"])
);
}
$playlist['medias'] = $medias;

View file

@ -63,6 +63,10 @@ class StoredFile {
return $this->_file->getDbFtype();
}
public function getPropelOrm(){
return $this->_file;
}
public function setFormat($p_format)
{
$this->_file->setDbFtype($p_format);