Merge branch '2.2.x' of dev.sourcefabric.org:airtime into 2.2.x

This commit is contained in:
Martin Konecny 2012-10-17 15:28:15 -04:00
commit 7123230eea
23 changed files with 147 additions and 68 deletions

View file

@ -313,7 +313,7 @@ class ApiController extends Zend_Controller_Action
} }
//used by caller to determine if the airtime they are running or widgets in use is out of date. //used by caller to determine if the airtime they are running or widgets in use is out of date.
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; $result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION;
header("Content-type: text/javascript"); header("Content-type: text/javascript");
// If a callback is not given, then just provide the raw JSON. // If a callback is not given, then just provide the raw JSON.
echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result); echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result);
@ -830,8 +830,8 @@ class ApiController extends Zend_Controller_Action
if ($djtype == 'master') { if ($djtype == 'master') {
//check against master //check against master
if ($username == Application_Model_Preference::GetLiveSteamMasterUsername() if ($username == Application_Model_Preference::GetLiveStreamMasterUsername()
&& $password == Application_Model_Preference::GetLiveSteamMasterPassword()) { && $password == Application_Model_Preference::GetLiveStreamMasterPassword()) {
$this->view->msg = true; $this->view->msg = true;
} else { } else {
$this->view->msg = false; $this->view->msg = false;

View file

@ -220,8 +220,8 @@ class PreferenceController extends Zend_Controller_Action
// this goes into cc_pref table // this goes into cc_pref table
Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']); Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']);
Application_Model_Preference::SetLiveSteamMasterUsername($values["master_username"]); Application_Model_Preference::SetLiveStreamMasterUsername($values["master_username"]);
Application_Model_Preference::SetLiveSteamMasterPassword($values["master_password"]); Application_Model_Preference::SetLiveStreamMasterPassword($values["master_password"]);
Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]); Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]);
Application_Model_Preference::SetAutoTransition($values["auto_transition"]); Application_Model_Preference::SetAutoTransition($values["auto_transition"]);
Application_Model_Preference::SetAutoSwitch($values["auto_switch"]); Application_Model_Preference::SetAutoSwitch($values["auto_switch"]);

View file

@ -186,13 +186,13 @@ class ShowbuilderController extends Zend_Controller_Action
$menu["preview"] = array("name"=> "Preview", "icon" => "play"); $menu["preview"] = array("name"=> "Preview", "icon" => "play");
//select the cursor //select the cursor
$menu["selCurs"] = array("name"=> "Select Cursor","icon" => "select-cursor"); $menu["selCurs"] = array("name"=> "Select cursor","icon" => "select-cursor");
$menu["delCurs"] = array("name"=> "Remove Cursor","icon" => "select-cursor"); $menu["delCurs"] = array("name"=> "Remove cursor","icon" => "select-cursor");
if ($now < floatval($item->getDbEnds("U.u")) && $user->canSchedule($instance->getDbShowId())) { if ($now < floatval($item->getDbEnds("U.u")) && $user->canSchedule($instance->getDbShowId())) {
//remove/truncate the item from the schedule //remove/truncate the item from the schedule
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/showbuilder/schedule-remove"); $menu["del"] = array("name"=> "Remove from show", "icon" => "delete", "url" => "/showbuilder/schedule-remove");
} }
$this->view->items = $menu; $this->view->items = $menu;

View file

@ -247,15 +247,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$overlapping = Application_Model_Schedule::checkOverlappingShows($show_start, $show_end, $update, $instanceId); $overlapping = Application_Model_Schedule::checkOverlappingShows($show_start, $show_end, $update, $instanceId);
if (!$overlapping) { if (!$overlapping) {
$durationToAdd = "PT".$hours."H".$minutes."M";
for ($i = 1; $i <= 10; $i++) { for ($i = 1; $i <= 10; $i++) {
$hours = ltrim($hours, '0');
if ($minutes != "00") {
$minutes = ltrim($minutes, '0');
$durationToAdd = "PT".$hours."H".$minutes."I";
} else {
$minutes = "0";
$durationToAdd = "PT".$hours."H";
}
if (empty($formData["add_show_rebroadcast_date_absolute_".$i])) break; if (empty($formData["add_show_rebroadcast_date_absolute_".$i])) break;

View file

@ -32,9 +32,7 @@ class Application_Form_EditAudioMD extends Zend_Form
$this->addElement('text', 'track_number', array( $this->addElement('text', 'track_number', array(
'label' => 'Track:', 'label' => 'Track:',
'class' => 'input_text', 'class' => 'input_text',
'filters' => array('StringTrim'), 'filters' => array('StringTrim')
'validators' => array('Int'),
'required' => true
)); ));
// Add genre field // Add genre field

View file

@ -45,7 +45,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
->setAllowEmpty(true) ->setAllowEmpty(true)
->setLabel('Master Username') ->setLabel('Master Username')
->setFilters(array('StringTrim')) ->setFilters(array('StringTrim'))
->setValue(Application_Model_Preference::GetLiveSteamMasterUsername()) ->setValue(Application_Model_Preference::GetLiveStreamMasterUsername())
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
$this->addElement($master_username); $this->addElement($master_username);
@ -59,7 +59,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$master_password->setAttrib('autocomplete', 'off') $master_password->setAttrib('autocomplete', 'off')
->setAttrib('renderPassword','true') ->setAttrib('renderPassword','true')
->setAllowEmpty(true) ->setAllowEmpty(true)
->setValue(Application_Model_Preference::GetLiveSteamMasterPassword()) ->setValue(Application_Model_Preference::GetLiveStreamMasterPassword())
->setLabel('Master Password') ->setLabel('Master Password')
->setFilters(array('StringTrim')) ->setFilters(array('StringTrim'))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));

View file

@ -16,12 +16,12 @@ class Application_Model_PlayoutHistory
private $opts; private $opts;
private $mDataPropMap = array( private $mDataPropMap = array(
"artist" => "file.artist_name", "artist" => "artist_name",
"title" => "file.track_title", "title" => "track_title",
"played" => "playout.played", "played" => "played",
"length" => "file.length", "length" => "length",
"composer" => "file.composer", "composer" => "composer",
"copyright" => "file.copyright", "copyright" => "copyright",
); );
public function __construct($p_startDT, $p_endDT, $p_opts) public function __construct($p_startDT, $p_endDT, $p_opts)

View file

@ -892,22 +892,22 @@ class Application_Model_Preference
return (strlen($val) == 0) ? 0 : $val; return (strlen($val) == 0) ? 0 : $val;
} }
public static function SetLiveSteamMasterUsername($value) public static function SetLiveStreamMasterUsername($value)
{ {
self::setValue("live_stream_master_username", $value, false); self::setValue("live_stream_master_username", $value, false);
} }
public static function GetLiveSteamMasterUsername() public static function GetLiveStreamMasterUsername()
{ {
return self::getValue("live_stream_master_username"); return self::getValue("live_stream_master_username");
} }
public static function SetLiveSteamMasterPassword($value) public static function SetLiveStreamMasterPassword($value)
{ {
self::setValue("live_stream_master_password", $value, false); self::setValue("live_stream_master_password", $value, false);
} }
public static function GetLiveSteamMasterPassword() public static function GetLiveStreamMasterPassword()
{ {
return self::getValue("live_stream_master_password"); return self::getValue("live_stream_master_password");
} }
@ -1093,7 +1093,7 @@ class Application_Model_Preference
public static function getOrderingMap($pref_param) public static function getOrderingMap($pref_param)
{ {
$v = self::getValue($pref_param, true); $v = self::getValue($pref_param, true);

View file

@ -196,6 +196,10 @@ class Application_Model_StoredFile
if (isset($this->_dbMD[$dbColumn])) { if (isset($this->_dbMD[$dbColumn])) {
$propelColumn = $this->_dbMD[$dbColumn]; $propelColumn = $this->_dbMD[$dbColumn];
$method = "set$propelColumn"; $method = "set$propelColumn";
/* We need to set track_number to null if it is an empty string
* because propel defaults empty strings to zeros */
if ($dbColumn == "track_number" && empty($mdValue)) $mdValue = null;
$this->_file->$method($mdValue); $this->_file->$method($mdValue);
} }
} }

View file

@ -5,7 +5,7 @@
/** /**
* Skeleton subclass for representing a row from the 'cc_blockcontents' table. * Skeleton subclass for representing a row from the 'cc_blockcontents' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
@ -44,11 +44,16 @@ class CcBlockcontents extends BaseCcBlockcontents {
*/ */
public function setDbFadein($v) public function setDbFadein($v)
{ {
$microsecond = 0;
if ($v instanceof DateTime) { if ($v instanceof DateTime) {
$dt = $v; $dt = $v;
} }
else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) { else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) {
$dt = DateTime::createFromFormat("s.u", $v); // in php 5.3.2 createFromFormat() with "u" is not supported(bug)
// Hence we need to do parsing.
$info = explode('.', $v);
$microsecond = $info[1];
$dt = DateTime::createFromFormat("s", $info[0]);
} }
else { else {
try { try {
@ -58,7 +63,7 @@ class CcBlockcontents extends BaseCcBlockcontents {
} }
} }
$this->fadein = $dt->format('H:i:s.u'); $this->fadein = $dt->format('H:i:s').".".$microsecond;
$this->modifiedColumns[] = CcBlockcontentsPeer::FADEIN; $this->modifiedColumns[] = CcBlockcontentsPeer::FADEIN;
return $this; return $this;
@ -72,11 +77,16 @@ class CcBlockcontents extends BaseCcBlockcontents {
*/ */
public function setDbFadeout($v) public function setDbFadeout($v)
{ {
$microsecond = 0;
if ($v instanceof DateTime) { if ($v instanceof DateTime) {
$dt = $v; $dt = $v;
} }
else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) { else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) {
$dt = DateTime::createFromFormat("s.u", $v); // in php 5.3.2 createFromFormat() with "u" is not supported(bug)
// Hence we need to do parsing.
$info = explode('.', $v);
$microsecond = $info[1];
$dt = DateTime::createFromFormat("s", $info[0]);
} }
else { else {
try { try {
@ -86,7 +96,7 @@ class CcBlockcontents extends BaseCcBlockcontents {
} }
} }
$this->fadeout = $dt->format('H:i:s.u'); $this->fadeout = $dt->format('H:i:s').".".$microsecond;
$this->modifiedColumns[] = CcBlockcontentsPeer::FADEOUT; $this->modifiedColumns[] = CcBlockcontentsPeer::FADEOUT;
return $this; return $this;

View file

@ -43,11 +43,16 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents {
*/ */
public function setDbFadein($v) public function setDbFadein($v)
{ {
$microsecond = 0;
if ($v instanceof DateTime) { if ($v instanceof DateTime) {
$dt = $v; $dt = $v;
} }
else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) { else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) {
$dt = DateTime::createFromFormat("s.u", $v); // in php 5.3.2 createFromFormat() with "u" is not supported(bug)
// Hence we need to do parsing.
$info = explode('.', $v);
$microsecond = $info[1];
$dt = DateTime::createFromFormat("s", $info[0]);
} }
else { else {
try { try {
@ -57,7 +62,7 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents {
} }
} }
$this->fadein = $dt->format('H:i:s.u'); $this->fadein = $dt->format('H:i:s').".".$microsecond;
$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN; $this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN;
return $this; return $this;
@ -71,11 +76,16 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents {
*/ */
public function setDbFadeout($v) public function setDbFadeout($v)
{ {
$microsecond = 0;
if ($v instanceof DateTime) { if ($v instanceof DateTime) {
$dt = $v; $dt = $v;
} }
else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) { else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) {
$dt = DateTime::createFromFormat("s.u", $v); // in php 5.3.2 createFromFormat() with "u" is not supported(bug)
// Hence we need to do parsing.
$info = explode('.', $v);
$microsecond = $info[1];
$dt = DateTime::createFromFormat("s", $info[0]);
} }
else { else {
try { try {
@ -85,7 +95,7 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents {
} }
} }
$this->fadeout = $dt->format('H:i:s.u'); $this->fadeout = $dt->format('H:i:s').".".$microsecond;
$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT; $this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT;
return $this; return $this;

View file

@ -107,11 +107,16 @@ class CcSchedule extends BaseCcSchedule {
*/ */
public function setDbFadeIn($v) public function setDbFadeIn($v)
{ {
$microsecond = 0;
if ($v instanceof DateTime) { if ($v instanceof DateTime) {
$dt = $v; $dt = $v;
} }
else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) { else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) {
$dt = DateTime::createFromFormat("s.u", $v); // in php 5.3.2 createFromFormat() with "u" is not supported(bug)
// Hence we need to do parsing.
$info = explode('.', $v);
$microsecond = $info[1];
$dt = DateTime::createFromFormat("s", $info[0]);
} }
else { else {
try { try {
@ -120,7 +125,7 @@ class CcSchedule extends BaseCcSchedule {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
} }
} }
$this->fade_in = $dt->format('H:i:s.u'); $this->fade_in = $dt->format('H:i:s').".".$microsecond;
$this->modifiedColumns[] = CcSchedulePeer::FADE_IN; $this->modifiedColumns[] = CcSchedulePeer::FADE_IN;
return $this; return $this;
@ -134,11 +139,16 @@ class CcSchedule extends BaseCcSchedule {
*/ */
public function setDbFadeOut($v) public function setDbFadeOut($v)
{ {
$microsecond = 0;
if ($v instanceof DateTime) { if ($v instanceof DateTime) {
$dt = $v; $dt = $v;
} }
else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) { else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) {
$dt = DateTime::createFromFormat("s.u", $v); // in php 5.3.2 createFromFormat() with "u" is not supported(bug)
// Hence we need to do parsing.
$info = explode('.', $v);
$microsecond = $info[1];
$dt = DateTime::createFromFormat("s", $info[0]);
} }
else { else {
try { try {
@ -148,7 +158,7 @@ class CcSchedule extends BaseCcSchedule {
} }
} }
$this->fade_out = $dt->format('H:i:s.u'); $this->fade_in = $dt->format('H:i:s').".".$microsecond;
$this->modifiedColumns[] = CcSchedulePeer::FADE_OUT; $this->modifiedColumns[] = CcSchedulePeer::FADE_OUT;
return $this; return $this;

View file

@ -4,8 +4,8 @@
<span class='playlistID'><?php echo "$this->playlistID" ?></span> <span class='playlistID'><?php echo "$this->playlistID" ?></span>
<span class='playlistIndex'><?php echo "$this->playlistIndex" ?></span> <span class='playlistIndex'><?php echo "$this->playlistIndex" ?></span>
<?php elseif (isset($this->blockId)): ?> <?php elseif (isset($this->blockId)): ?>
<span class='blockId'><?php echo "$this->blockId" ?></span> <span class='blockId' style="display: none;"><?php echo "$this->blockId" ?></span>
<span class='blockIndex'><?php echo "$this->blockIndex" ?></span> <span class='blockIndex' style="display: none;"><?php echo "$this->blockIndex" ?></span>
<?php elseif (isset($this->uri)): ?> <?php elseif (isset($this->uri)): ?>
<span class='audioUri' style="display: none;"><?php echo "$this->uri" ?></span> <span class='audioUri' style="display: none;"><?php echo "$this->uri" ?></span>
<span class='audioMime' style="display: none;"><?php echo "$this->mime" ?></span> <span class='audioMime' style="display: none;"><?php echo "$this->mime" ?></span>
@ -51,7 +51,7 @@
</div> </div>
<div class="jp-unmute"> <div class="jp-unmute">
<span class="ui-icon" tabindex="1" title="unmute">unmute</span> <span class="ui-icon" tabindex="1" title="unmute">unmute</span>
</div> </div>
<div class="jp-volume-bar"> <div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div> <div class="jp-volume-bar-value"></div>
</div> </div>

View file

@ -21,7 +21,7 @@ if ($item['type'] == 2) {
<span class="ui-icon ui-icon-play"></span> <span class="ui-icon ui-icon-play"></span>
</div> </div>
<?php elseif ($item['type'] == 2 && $item['exists']): ?> <?php elseif ($item['type'] == 2 && $item['exists']): ?>
<div class="big_play" blockId="<?php echo $item["item_id"]; ?>"> <div class="big_play" blockId="<?php echo $item["item_id"]; ?>" blocktype="<?php echo $staticBlock?"static":"dynamic"?>">
<span class="ui-icon ui-icon-play"></span> <span class="ui-icon ui-icon-play"></span>
</div> </div>
<?php else:?> <?php else:?>

View file

@ -123,6 +123,7 @@ function buildplaylist(p_url, p_playIndex) {
var media; var media;
var index; var index;
var total = 0; var total = 0;
var skipped = 0;
for(index in data) { for(index in data) {
if (data[index]['type'] == 0) { if (data[index]['type'] == 0) {
if (data[index]['element_mp3'] != undefined){ if (data[index]['element_mp3'] != undefined){
@ -145,22 +146,30 @@ function buildplaylist(p_url, p_playIndex) {
artist: data[index]['element_artist'], artist: data[index]['element_artist'],
wav:data[index]['uri'] wav:data[index]['uri']
}; };
} } else {
// skip this track since it's not supported
console.log("continue");
skipped++;
continue;
}
} else if (data[index]['type'] == 1) { } else if (data[index]['type'] == 1) {
media = {title: data[index]['element_title'], media = {title: data[index]['element_title'],
artist: data[index]['element_artist'], artist: data[index]['element_artist'],
mp3:data[index]['uri'] mp3:data[index]['uri']
}; };
} }
console.log(data[index]);
if (media && isAudioSupported(data[index]['mime'])) { if (media && isAudioSupported(data[index]['mime'])) {
myPlaylist[index] = media; // javascript doesn't support associative array with numeric key
// so we need to remove the gap if we skip any of tracks due to
// browser incompatibility.
myPlaylist[index-skipped] = media;
} }
// we should create a map according to the new position in the // we should create a map according to the new position in the
// player itself total is the index on the player // player itself total is the index on the player
_idToPostionLookUp[data[index]['element_id']] = total; _idToPostionLookUp[data[index]['element_id']] = total;
total++; total++;
} }
_playlist_jplayer.setPlaylist(myPlaylist); _playlist_jplayer.setPlaylist(myPlaylist);
_playlist_jplayer.option("autoPlay", true); _playlist_jplayer.option("autoPlay", true);
play(p_playIndex); play(p_playIndex);

View file

@ -54,7 +54,7 @@ function open_audio_preview(type, id, audioFileTitle, audioFileArtist) {
audioFileTitle = audioFileTitle.substring(0,index); audioFileTitle = audioFileTitle.substring(0,index);
} }
openPreviewWindow('audiopreview/audio-preview/audioFileID/'+id+'/audioFileArtist/'+audioFileArtist+'/audioFileTitle/'+audioFileTitle+'/type/'+type); openPreviewWindow('audiopreview/audio-preview/audioFileID/'+id+'/audioFileArtist/'+encodeURIComponent(audioFileArtist)+'/audioFileTitle/'+encodeURIComponent(audioFileTitle)+'/type/'+type);
_preview_window.focus(); _preview_window.focus();
} }

View file

@ -366,7 +366,7 @@ var AIRTIME = (function(AIRTIME){
//and verify whether they can be previewed by the browser or not. If not //and verify whether they can be previewed by the browser or not. If not
//then the playlist element is greyed out //then the playlist element is greyed out
mod.validatePlaylistElements = function(){ mod.validatePlaylistElements = function(){
$.each($(".big_play ui-icon-play"), function(index, value){ $.each($("div .big_play"), function(index, value){
if ($(value).attr('blockId') === undefined) { if ($(value).attr('blockId') === undefined) {
var mime = $(value).attr("data-mime-type"); var mime = $(value).attr("data-mime-type");
if (isAudioSupported(mime)) { if (isAudioSupported(mime)) {
@ -393,6 +393,31 @@ var AIRTIME = (function(AIRTIME){
}, },
}) })
} }
} else {
if ($(value).attr('blocktype') === 'dynamic') {
$(value).attr("class", "big_play_disabled dark_class");
$(value).qtip({
content: 'Dynamic block is not previewable',
show: 'mouseover',
hide: {
delay: 500,
fixed: true
},
style: {
border: {
width: 0,
radius: 4
},
classes: "ui-tooltip-dark ui-tooltip-rounded"
},
position: {
my: "left bottom",
at: "right center"
},
})
} else {
$(value).bind("click", openAudioPreview);
}
} }
}); });
} }

View file

@ -43,11 +43,16 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents {
*/ */
public function setDbFadein($v) public function setDbFadein($v)
{ {
$microsecond = 0;
if ($v instanceof DateTime) { if ($v instanceof DateTime) {
$dt = $v; $dt = $v;
} }
else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) { else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) {
$dt = DateTime::createFromFormat("s.u", $v); // in php 5.3.2 createFromFormat() with "u" is not supported(bug)
// Hence we need to do parsing.
$info = explode('.', $v);
$microsecond = $info[1];
$dt = DateTime::createFromFormat("s", $info[0]);
} }
else { else {
try { try {
@ -57,7 +62,7 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents {
} }
} }
$this->fadein = $dt->format('H:i:s.u'); $this->fadein = $dt->format('H:i:s').".".$microsecond;
$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN; $this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN;
return $this; return $this;
@ -71,11 +76,16 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents {
*/ */
public function setDbFadeout($v) public function setDbFadeout($v)
{ {
$microsecond = 0;
if ($v instanceof DateTime) { if ($v instanceof DateTime) {
$dt = $v; $dt = $v;
} }
else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) { else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) {
$dt = DateTime::createFromFormat("s.u", $v); // in php 5.3.2 createFromFormat() with "u" is not supported(bug)
// Hence we need to do parsing.
$info = explode('.', $v);
$microsecond = $info[1];
$dt = DateTime::createFromFormat("s", $info[0]);
} }
else { else {
try { try {
@ -85,7 +95,7 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents {
} }
} }
$this->fadeout = $dt->format('H:i:s.u'); $this->fadeout = $dt->format('H:i:s').".".$microsecond;
$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT; $this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT;
return $this; return $this;

View file

@ -107,11 +107,16 @@ class CcSchedule extends BaseCcSchedule {
*/ */
public function setDbFadeIn($v) public function setDbFadeIn($v)
{ {
$microsecond = 0;
if ($v instanceof DateTime) { if ($v instanceof DateTime) {
$dt = $v; $dt = $v;
} }
else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) { else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) {
$dt = DateTime::createFromFormat("s.u", $v); // in php 5.3.2 createFromFormat() with "u" is not supported(bug)
// Hence we need to do parsing.
$info = explode('.', $v);
$microsecond = $info[1];
$dt = DateTime::createFromFormat("s", $info[0]);
} }
else { else {
try { try {
@ -120,7 +125,7 @@ class CcSchedule extends BaseCcSchedule {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
} }
} }
$this->fade_in = $dt->format('H:i:s.u'); $this->fade_in = $dt->format('H:i:s').".".$microsecond;
$this->modifiedColumns[] = CcSchedulePeer::FADE_IN; $this->modifiedColumns[] = CcSchedulePeer::FADE_IN;
return $this; return $this;
@ -134,11 +139,16 @@ class CcSchedule extends BaseCcSchedule {
*/ */
public function setDbFadeOut($v) public function setDbFadeOut($v)
{ {
$microsecond = 0;
if ($v instanceof DateTime) { if ($v instanceof DateTime) {
$dt = $v; $dt = $v;
} }
else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) { else if (preg_match('/^[0-9]{1,2}(\.\d{1,6})?$/', $v)) {
$dt = DateTime::createFromFormat("s.u", $v); // in php 5.3.2 createFromFormat() with "u" is not supported(bug)
// Hence we need to do parsing.
$info = explode('.', $v);
$microsecond = $info[1];
$dt = DateTime::createFromFormat("s", $info[0]);
} }
else { else {
try { try {
@ -148,7 +158,7 @@ class CcSchedule extends BaseCcSchedule {
} }
} }
$this->fade_out = $dt->format('H:i:s.u'); $this->fade_out = $dt->format('H:i:s').".".$microsecond;
$this->modifiedColumns[] = CcSchedulePeer::FADE_OUT; $this->modifiedColumns[] = CcSchedulePeer::FADE_OUT;
return $this; return $this;

View file

@ -43,7 +43,7 @@ class EventRegistry(object):
methods") methods")
class EventProxy(object): class EventProxy(Loggable):
""" """
A container object for instances of BaseEvent (or it's subclasses) used for A container object for instances of BaseEvent (or it's subclasses) used for
event contractor event contractor

View file

@ -182,7 +182,7 @@ class Metadata(Loggable):
that does not exist. Setting metadata to {}") that does not exist. Setting metadata to {}")
self.__metadata = {} self.__metadata = {}
return return
# TODO : Simplify the way all of these rules are handled right not it's # TODO : Simplify the way all of these rules are handled right now it's
# extremely unclear and needs to be refactored. # extremely unclear and needs to be refactored.
#if full_mutagen is None: raise BadSongFile(fpath) #if full_mutagen is None: raise BadSongFile(fpath)
if full_mutagen is None: full_mutagen = FakeMutagen(fpath) if full_mutagen is None: full_mutagen = FakeMutagen(fpath)
@ -190,7 +190,6 @@ class Metadata(Loggable):
# Now we extra the special values that are calculated from the mutagen # Now we extra the special values that are calculated from the mutagen
# object itself: # object itself:
# Hickity Hackity for .wav files. Properly do this later
if mmp.extension(fpath) == 'wav': if mmp.extension(fpath) == 'wav':
full_mutagen.set_length(mmp.read_wave_duration(fpath)) full_mutagen.set_length(mmp.read_wave_duration(fpath))

View file

@ -126,7 +126,8 @@ class WatchSyncer(ReportHandler,Loggable):
try: try:
# If there is a strange bug anywhere in the code the next line # If there is a strange bug anywhere in the code the next line
# should be a suspect # should be a suspect
if self.contractor.register(EventProxy(event)): self.push_queue( event ) ev = EventProxy(event)
if self.contractor.register(ev): self.push_queue(ev)
#self.push_queue( event ) #self.push_queue( event )
except BadSongFile as e: except BadSongFile as e:
self.fatal_exception("Received bas song file '%s'" % e.path, e) self.fatal_exception("Received bas song file '%s'" % e.path, e)

View file

@ -39,7 +39,7 @@ class TestMMP(unittest.TestCase):
orig = Metadata.airtime_dict({ orig = Metadata.airtime_dict({
'date' : [u'2012-08-21'], 'date' : [u'2012-08-21'],
'tracknumber' : [u'2'], 'tracknumber' : [u'2'],
'title' : [u'11-29-00-record'], 'title' : [u'record-2012-08-21-11:29:00'],
'artist' : [u'Airtime Show Recorder'] 'artist' : [u'Airtime Show Recorder']
}) })
orga = Metadata.airtime_dict({ orga = Metadata.airtime_dict({
@ -57,7 +57,7 @@ class TestMMP(unittest.TestCase):
self.assertEqual( orga, normalized ) self.assertEqual( orga, normalized )
organized_base_name = "2012-08-21-11-29-00-record-256kbps.ogg" organized_base_name = "11:29:00-record-256kbps.ogg"
base = "/srv/airtime/stor/" base = "/srv/airtime/stor/"
organized_path = mmp.organized_path(old_path,base, normalized) organized_path = mmp.organized_path(old_path,base, normalized)
self.assertEqual(os.path.basename(organized_path), organized_base_name) self.assertEqual(os.path.basename(organized_path), organized_base_name)