Merge branches '2.2.x' and 'devel' into devel

This commit is contained in:
James 2012-10-15 11:34:37 -04:00
commit 7165d1fa2e
35 changed files with 253 additions and 154 deletions

View File

@ -436,7 +436,7 @@ class PlaylistController extends Zend_Controller_Action
try {
$obj = $this->getPlaylist($type);
$obj->setName($name);
$obj->setName(trim($name));
$obj->setDescription($description);
$this->view->description = $description;
$this->view->playlistName = $name;

View File

@ -163,7 +163,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
} elseif (!$formData["add_show_no_end"]) {
$popUntil = $formData["add_show_end_date"]." ".$formData["add_show_end_time"];
$populateUntilDateTime = new DateTime($popUntil, new DateTimeZone('UTC'));
$populateUntilDateTime = new DateTime($popUntil);
$populateUntilDateTime->setTimezone(new DateTimeZone('UTC'));
}
//get repeat interval
@ -198,21 +199,20 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$repeatShowStart->add(new DateInterval("P".$daysAdd."D"));
$repeatShowEnd->add(new DateInterval("P".$daysAdd."D"));
}
/* Here we are checking each repeating show by
* the show day.
* (i.e: every wednesday, then every thursday, etc.)
*/
while ($repeatShowStart->getTimestamp() < $populateUntilDateTime->getTimestamp()) {
//need to get each repeating show's instance id
$qry = CcShowInstancesQuery::create()
->filterByDbStarts($repeatShowStart->format('Y-m-d H:i:s'))
->filterByDbEnds($repeatShowEnd->format('Y-m-d H:i:s'))
->find();
$count = $qry->count();
if ($count > 1) {
$overlapping = true;
} elseif ($count == 1) {
$instanceId = $qry->getFirst()->getDbId();
$overlapping = Application_Model_Schedule::checkOverlappingShows($repeatShowStart, $repeatShowEnd, $update, $instanceId);
if ($formData['add_show_id'] == -1) {
//this is a new show
$overlapping = Application_Model_Schedule::checkOverlappingShows(
$repeatShowStart, $repeatShowEnd);
} else {
$overlapping = false;
$overlapping = Application_Model_Schedule::checkOverlappingShows(
$repeatShowStart, $repeatShowEnd, $update, null, $formData["add_show_id"]);
}
if ($overlapping) {
$valid = false;
$this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
@ -243,7 +243,9 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$minutes = "0";
$durationToAdd = "PT".$hours."H";
}
if (empty($formData["add_show_rebroadcast_date_absolute_".$i])) break;
$abs_rebroadcast_start = $formData["add_show_rebroadcast_date_absolute_".$i]." ".
$formData["add_show_rebroadcast_time_absolute_".$i];
$rebroadcastShowStart = new DateTime($abs_rebroadcast_start);

View File

@ -125,7 +125,7 @@ class Application_Form_EditAudioMD extends Zend_Form
// Add the submit button
$this->addElement('submit', 'submit', array(
'ignore' => true,
'class' => 'ui-button ui-state-default',
'class' => 'btn',
'label' => 'Save',
'decorators' => array(
'ViewHelper'
@ -135,7 +135,7 @@ class Application_Form_EditAudioMD extends Zend_Form
// Add the submit button
$this->addElement('button', 'cancel', array(
'ignore' => true,
'class' => 'ui-button ui-state-default ui-button-text-only md-cancel',
'class' => 'btn md-cancel',
'label' => 'Cancel',
'onclick' => 'javascript:document.location.href = "/Library"',
'decorators' => array(

View File

@ -229,10 +229,17 @@ SQL;
$formatter = new LengthFormatter($offset_cliplength);
$row['offset'] = $formatter->format();
//format the fades in format 00(.000000)
//format the fades in format 00(.0)
$fades = $this->getFadeInfo($row['position']);
$row['fadein'] = $fades[0];
$row['fadeout'] = $fades[1];
// format the cues in format 00:00:00(.0)
// we need to add the '.0' for cues and not fades
// because propel takes care of this for us
// (we use propel to fetch the fades)
$row['cuein'] = str_pad(substr($row['cuein'], 0, 10), 10, '.0');
$row['cueout'] = str_pad(substr($row['cueout'], 0, 10), 10, '.0');
//format original length
$formatter = new LengthFormatter($row['orig_length']);
@ -611,9 +618,10 @@ SQL;
#Propel returns values in form 00.000000 format which is for only seconds.
$fadeIn = $row->getDbFadein();
$fadeOut = $row->getDbFadeout();
//Propel returns values in form 00.000000 format which is for only seconds.
//We only want to display 1 decimal
$fadeIn = substr($row->getDbFadein(), 0, 4);
$fadeOut = substr($row->getDbFadeout(), 0, 4);
return array($fadeIn, $fadeOut);
}

View File

@ -244,6 +244,13 @@ SQL;
$fades = $this->getFadeInfo($row['position']);
$row['fadein'] = $fades[0];
$row['fadeout'] = $fades[1];
// format the cues in format 00:00:00(.0)
// we need to add the '.0' for cues and not fades
// because propel takes care of this for us
// (we use propel to fetch the fades)
$row['cuein'] = str_pad(substr($row['cuein'], 0, 10), 10, '.0');
$row['cueout'] = str_pad(substr($row['cueout'], 0, 10), 10, '.0');
//format original length
$formatter = new LengthFormatter($row['orig_length']);
@ -585,9 +592,10 @@ SQL;
if (!$row) {
return NULL;
}
#Propel returns values in form 00.000000 format which is for only seconds.
$fadeIn = $row->getDbFadein();
$fadeOut = $row->getDbFadeout();
//Propel returns values in form 00.000000 format which is for only seconds.
//We only want to display 1 decimal
$fadeIn = substr($row->getDbFadein(), 0, 4);
$fadeOut = substr($row->getDbFadeout(), 0, 4);
return array($fadeIn, $fadeOut);
}
@ -624,7 +632,7 @@ SQL;
if (!is_null($fadeIn)) {
$sql = "SELECT INTERVAL :fadein > INTERVAL '{$clipLength}'";
$sql = "SELECT :fadein::INTERVAL > INTERVAL '{$clipLength}'";
if (Application_Common_Database::prepareAndExecute($sql, array(':fadein'=>$fadeIn), 'column')) {
//"Fade In can't be larger than overall playlength.";
$fadeIn = $clipLength;
@ -633,7 +641,7 @@ SQL;
}
if (!is_null($fadeOut)) {
$sql = "SELECT INTERVAL :fadeout > INTERVAL '{$clipLength}'";
$sql = "SELECT :fadeout::INTERVAL > INTERVAL '{$clipLength}'";
if (Application_Common_Database::prepareAndExecute($sql, array(':fadeout'=>$fadeOut), 'column')) {
//Fade Out can't be larger than overall playlength.";
$fadeOut = $clipLength;
@ -724,21 +732,21 @@ SQL;
$cueOut = $origLength;
}
$sql = "SELECT INTERVAL :cueIn > INTERVAL :cueOut";
$sql = "SELECT :cueIn::INTERVAL > :cueOut::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueIn'=>$cueIn, ':cueOut'=>$cueOut), 'column')) {
$errArray["error"] = "Can't set cue in to be larger than cue out.";
return $errArray;
}
$sql = "SELECT INTERVAL :cueOut > INTERVAL :origLength";
$sql = "SELECT :cueOut::INTERVAL > :origLength::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':origLength'=>$origLength), 'column')) {
$errArray["error"] = "Can't set cue out to be greater than file length.";
return $errArray;
}
$sql = "SELECT INTERVAL :cueOut - INTERVAL :cueIn";
$sql = "SELECT :cueOut::INTERVAL - :cueIn::INTERVAL";
$cliplength = Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':cueIn'=>$cueIn), 'column');
$row->setDbCuein($cueIn);
@ -747,15 +755,15 @@ SQL;
} elseif (!is_null($cueIn)) {
$sql = "SELECT INTERVAL :cueIn > INTERVAL :oldCueOut";
$sql = "SELECT :cueIn::INTERVAL > :oldCueOut::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueIn'=>$cueIn, ':oldCueOut'=>$oldCueOut), 'column')) {
$errArray["error"] = "Can't set cue in to be larger than cue out.";
return $errArray;
}
$sql = "SELECT INTERVAL :oldCueOut - INTERVAL :cueIn";
$cliplength = Application_Common_Database::prepareAndExecute($sql, array(':cueIn'=>$cueIn, ':oldCueOut'=>$oldCueOut, 'column'));
$sql = "SELECT :oldCueOut::INTERVAL - :cueIn::INTERVAL";
$cliplength = Application_Common_Database::prepareAndExecute($sql, array(':cueIn'=>$cueIn, ':oldCueOut'=>$oldCueOut), 'column');
$row->setDbCuein($cueIn);
$row->setDBCliplength($cliplength);
@ -765,22 +773,22 @@ SQL;
$cueOut = $origLength;
}
$sql = "SELECT INTERVAL :cueOut < INTERVAL :oldCueIn";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':oldCueIn'=>$oldCueIn, 'column'))) {
$sql = "SELECT :cueOut::INTERVAL < :oldCueIn::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':oldCueIn'=>$oldCueIn), 'column')) {
$errArray["error"] = "Can't set cue out to be smaller than cue in.";
return $errArray;
}
$sql = "SELECT INTERVAL :cueOut > INTERVAL :origLength";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':origLength'=>$origLength, 'column'))) {
$sql = "SELECT :cueOut::INTERVAL > :origLength::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':origLength'=>$origLength), 'column')) {
$errArray["error"] = "Can't set cue out to be greater than file length.";
return $errArray;
}
$sql = "SELECT INTERVAL :cueOut - INTERVAL :oldCueIn";
$cliplength = Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':oldCueIn'=>$oldCueIn, 'column'));
$sql = "SELECT :cueOut::INTERVAL - :oldCueIn::INTERVAL";
$cliplength = Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':oldCueIn'=>$oldCueIn), 'column');
$row->setDbCueout($cueOut);
$row->setDBCliplength($cliplength);
@ -788,14 +796,14 @@ SQL;
$cliplength = $row->getDbCliplength();
$sql = "SELECT INTERVAL :fadeIn > INTERVAL :cliplength";
if (Application_Common_Database::prepareAndExecute($sql, array(':fadeIn'=>$fadeIn, ':cliplength'=>$cliplength, 'column'))) {
$sql = "SELECT :fadeIn::INTERVAL > :cliplength::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':fadeIn'=>$fadeIn, ':cliplength'=>$cliplength), 'column')) {
$fadeIn = $cliplength;
$row->setDbFadein($fadeIn);
}
$sql = "SELECT INTERVAL :fadeOut > INTERVAL :cliplength";
if (Application_Common_Database::prepareAndExecute($sql, array(':fadeOut'=>$fadeOut, ':cliplength'=>$cliplength, 'column'))) {
$sql = "SELECT :fadeOut::INTERVAL > :cliplength::INTERVAL";
if (Application_Common_Database::prepareAndExecute($sql, array(':fadeOut'=>$fadeOut, ':cliplength'=>$cliplength), 'column')) {
$fadeOut = $cliplength;
$row->setDbFadein($fadeOut);
}

View File

@ -1157,14 +1157,21 @@ SQL;
}
public static function checkOverlappingShows($show_start, $show_end,
$update=false, $instanceId=null)
$update=false, $instanceId=null, $showId=null)
{
$overlapping = false;
$params = array(
':show_end1' => $show_end->format('Y-m-d H:i:s'),
':show_end2' => $show_end->format('Y-m-d H:i:s'),
':show_end3' => $show_end->format('Y-m-d H:i:s')
);
/* If a show is being edited, exclude it from the query
* In both cases (new and edit) we only grab shows that
* are scheduled 2 days prior
*/
//$se = $show_end->format('Y-m-d H:i:s');
if ($update) {
$sql = <<<SQL
SELECT id,
@ -1175,15 +1182,21 @@ WHERE (ends <= :show_end1
OR starts <= :show_end2)
AND date(starts) >= (date(:show_end3) - INTERVAL '2 days')
AND modified_instance = FALSE
SQL;
if (is_null($showId)) {
$sql .= <<<SQL
AND id != :instanceId
ORDER BY ends
SQL;
$rows = Application_Common_Database::prepareAndExecute($sql, array(
':show_end1' => $show_end->format('Y-m-d H:i:s'),
':show_end2' => $show_end->format('Y-m-d H:i:s'),
':show_end3' => $show_end->format('Y-m-d H:i:s'),
':instanceId' => $instanceId
), 'all');
$params[':instanceId'] = $instanceId;
} else {
$sql .= <<<SQL
AND show_id != :showId
ORDER BY ends
SQL;
$params[':showId'] = $showId;
}
$rows = Application_Common_Database::prepareAndExecute($sql, $params, 'all');
} else {
$sql = <<<SQL
SELECT id,
@ -1202,6 +1215,7 @@ SQL;
':show_end2' => $show_end->format('Y-m-d H:i:s'),
':show_end3' => $show_end->format('Y-m-d H:i:s')), 'all');
}
foreach ($rows as $row) {
$start = new DateTime($row["starts"], new DateTimeZone('UTC'));
$end = new DateTime($row["ends"], new DateTimeZone('UTC'));

View File

@ -179,14 +179,19 @@ SQL;
if ($deltaDay > 0) {
return "Shows can have a max length of 24 hours.";
}
$utc = new DateTimeZone("UTC");
$nowDateTime = new DateTime("now", $utc);
$showInstances = CcShowInstancesQuery::create()
->filterByDbShowId($this->_showId)
->find($con);
/* Check if the show being resized and any of its repeats * overlap
with other scheduled shows */
$utc = new DateTimeZone("UTC");
/* Check two things:
1. If the show being resized and any of its repeats end in the past
2. If the show being resized and any of its repeats overlap
with other scheduled shows */
foreach ($showInstances as $si) {
$startsDateTime = new DateTime($si->getDbStarts(), new DateTimeZone("UTC"));
@ -201,6 +206,10 @@ SQL;
$newStartsDateTime = Application_Model_ShowInstance::addDeltas($startsDateTime, $deltaDay, $deltaMin);
$newEndsDateTime = Application_Model_ShowInstance::addDeltas($endsDateTime, $deltaDay, $deltaMin);
if ($newEndsDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
return "End date/time cannot be in the past";
}
//convert our new starts/ends to UTC.
$newStartsDateTime->setTimezone($utc);
@ -1203,15 +1212,16 @@ SQL;
//$con = Propel::getConnection(CcShowPeer::DATABASE_NAME);
//$sql = "SELECT date '{$data['add_show_rebroadcast_date_absolute_'.$i]}' - date '{$data['add_show_start_date']}' ";
$sql = <<<SQL
SELECT date :rebroadcast - date :start
SELECT :rebroadcast::date - :start::date
SQL;
$offset_days =
Application_Common_Database::prepareAndExecute($sql,
array(
'rebroadcast' =>
$date["add_show_rebroadcast_date_absolute_$i"],
$data["add_show_rebroadcast_date_absolute_$i"],
'start' =>
$date['add_show_start_date']), "column" );
$data['add_show_start_date']), "column" );
//$r = $con->query($sql);
//$offset_days = $r->fetchColumn(0);

View File

@ -192,6 +192,7 @@ class Application_Model_StoredFile
if ($dbColumn == "track_title" && (is_null($mdValue) || $mdValue == "")) {
continue;
}
# TODO : refactor string evals
if (isset($this->_dbMD[$dbColumn])) {
$propelColumn = $this->_dbMD[$dbColumn];
$method = "set$propelColumn";
@ -756,10 +757,13 @@ SQL;
$row['tr_id'] = "{$type}_{$row['id']}";
//TODO url like this to work on both playlist/showbuilder screens.
//datatable stuff really needs to be pulled out and generalized within the project
//access to zend view methods to access url helpers is needed.
//TODO url like this to work on both playlist/showbuilder
//screens. datatable stuff really needs to be pulled out and
//generalized within the project access to zend view methods
//to access url helpers is needed.
// TODO : why is there inline html here? breaks abstraction and is
// ugly
if ($type == "au") {
$row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
$row['image'] = '<img title="Track preview" src="/css/images/icon_audioclip.png">';

View File

@ -3,7 +3,7 @@
<?php echo $this->element->getElement('sb_date_end'); ?>
<?php echo $this->element->getElement('sb_time_end'); ?>
<a id="sb_submit" class="btn btn-small" href="#" title="Find Shows">
<a id="sb_submit" class="btn btn-small" href="#" title="Display shows in the specified date and time range">
<i class="icon-white icon-search"></i> Find Shows</a>
<div class="sb-advanced-options">
<fieldset class="padded display_field push-down-8 closed">
@ -22,4 +22,4 @@
<?php endif;?>
</div>
</fieldset>
</div>
</div>

View File

@ -4,10 +4,10 @@
<dl class='zend_form search-criteria'>
<div class='btn-toolbar clearfix'>
<div class='btn-group pull-right'>
<div class='btn-group sp-button'>
<?php echo $this->element->getElement('generate_button') ?>
</div>
<div class='btn-group pull-right'>
<div class='btn-group sp-button'>
<?php echo $this->element->getElement('shuffle_button') ?>
</div>
</div>

View File

@ -3,9 +3,9 @@
<dl class="zend_form">
<dd id="SupportFeedback-element" style="width:90%;">
<div class="info-text">
Help Airtime improve by letting us know how you are using it. This info
will be collected regularly in order to enhance your user experience.<br /><br />
Click "Yes, help Airtime" and we'll make sure the features you use are
Help Airtime improve by letting Sourcefabric know how you are using it. This information
will be collected regularly in order to enhance your user experience.<br />
Click the "Send support feedback" box and we'll make sure the features you use are
constantly improving.
</div>
<label class="optional" for="SupportFeedback">
@ -21,9 +21,9 @@
<?php endif; ?>
</dd>
<dd id="publicize-element" style="width:90%;">
<div class="info-text">Click the box below to advertise your station on
<a id="link_to_whos_using" href="http://sourcefabric.org/en/airtime/whosusing" onclick="window.open(this.href); return false">Sourcefabric.org</a>.
In order to promote your station, "Send support feedback" must be enabled. This data will be collected in addition to the support feedback.</div>
<div class="info-text">Click the box below to promote your station on
<a id="link_to_whos_using" href="http://www.sourcefabric.org/en/airtime/whosusing/" onclick="window.open(this.href); return false">Sourcefabric.org</a>.
</div>
<label class="optional" for="Publicise">
<?php echo $this->element->getElement('Publicise') ?>
<strong><?php echo $this->element->getElement('Publicise')->getLabel() ?></strong>
@ -37,7 +37,7 @@
<?php endif; ?>
</dd>
</dl>
<div class="info-text" style="clear: both;padding: 4px 0 4px 15px;"><p> Note: In order to promote your station, "Send support feedback" must be enabled</p></div>
<div class="info-text" style="clear: both;padding: 4px 0 4px 15px;">(In order to promote your station, "Send support feedback" must be enabled).<br /><br /></div>
<?php }?>
<dl id="public-info" style="display:<?php echo !$this->isSaas?"none":"block"?>;">
<dt id="stationName-label" class="block-display">
@ -179,7 +179,7 @@
</ul>
<?php endif; ?>
<?php }else{?>
<a id="link_to_terms_and_condition" href="http://www.sourcefabric.org/en/about/policy/" onclick="window.open(this.href); return false;">Terms and Conditions</a>
<a id="link_to_terms_and_condition" href="http://www.sourcefabric.org/en/about/policy/" onclick="window.open(this.href); return false;">Sourcefabric Privacy Policy</a>
<?php }?>
</div>
<?php } ?>

View File

@ -37,8 +37,8 @@
<?php if ($this->type == "playlist") { ?>
<div class='file-md-qtip-legend'>
<span class='webstream'>o</span> <span>Web Stream</span><br />
<span class='dynamic'>o</span> <span>Dynamic Playlist</span><br />
<span class='static'>o</span> <span>Static Playlist</span><br />
<span class='dynamic'>o</span> <span>Dynamic Smart Block</span><br />
<span class='static'>o</span> <span>Static Smart Block</span><br />
<span>o</span> <span>Audio Track</span>
</div>
<?php } ?>
@ -47,7 +47,7 @@
<?php if ($this->type == "playlist") { ?>
<div class='file-md-qtip-left'><span>Playlist Contents: </span></div>
<?php } else { ?>
<div class='file-md-qtip-left'><span>Static Playlist Contents: </span></div>
<div class='file-md-qtip-left'><span>Static Smart Block Contents: </span></div>
<?php } ?>
<table class='library-get-file-md'>
<?php foreach($this->contents as $row) : ?>
@ -86,7 +86,7 @@
</table>
<?php } elseif ($this->blType == "Dynamic") { ?>
<div class='file-md-qtip-left'><span>Dynamic Playlist Criteria: </span></div>
<div class='file-md-qtip-left'><span>Dynamic Smart Block Criteria: </span></div>
<table class='library-get-file-md table-small'>
<?php foreach ($this->contents["crit"] as $criterias) : ?>
<?php foreach ($criterias as $crit ) : ?>

View File

@ -3,7 +3,7 @@
<h2>Reset password</h2>
<div id="login" class="login-content clearfix">
<p class="light">Please enter your account e-mail address. You will recieve a link to create a new password via e-mail.</p>
<p class="light">Please enter your account e-mail address. You will receive a link to create a new password via e-mail.</p>
<?php echo $this->form; ?>
</div>
</div>
</div>

View File

@ -57,10 +57,10 @@ if (isset($this->obj)) {
<div id="crossfade_main" class="crossfade-main clearfix" style="display:none;">
<span class="ui-icon ui-icon-closethick sp-closethick-center"></span>
<dl id="spl_editor-main" class="inline-list">
<dt>Fade in (s):</dt>
<dt>Fade in: <span class='spl_cue_hint'>(ss.t)</span></dt>
<dd><span contenteditable="true" class="spl_text_input spl_main_fade_in">00</span></dd>
<dd class="edit-error"></dd>
<dt>Fade out (s):</dt>
<dt>Fade out: <span class='spl_cue_hint'>(ss.t)</span></dt>
<dd><span contenteditable="true" class="spl_text_input spl_main_fade_out">00</span></dd>
<dd class="edit-error"></dd>
</dl>

View File

@ -1,10 +1,10 @@
<dl id="spl_cue_editor" class="inline-list">
<dt>Cue In:</dt>
<dt>Cue In: <span class='spl_cue_hint'>(hh:mm:ss.t)</span></dt>
<dd id="spl_cue_in_<?php echo $this->id; ?>" class="spl_cue_in">
<span contenteditable="true" class="spl_text_input"><?php echo $this->cueIn; ?></span>
</dd>
<dd class="edit-error"></dd>
<dt>Cue Out:</dt>
<dt>Cue Out: <span class='spl_cue_hint'>(hh:mm:ss.t)</span></dt>
<dd id="spl_cue_out_<?php echo $this->id; ?>" class="spl_cue_out">
<span contenteditable="true" class="spl_text_input"><?php echo $this->cueOut; ?></span>
</dd>

View File

@ -1,13 +1,13 @@
<dl id="spl_editor" class="inline-list">
<?php if ($this->item1Type == 0) {?>
<dt>Fade out (s):</dt>
<dt>Fade out: <span class='spl_cue_hint'>(ss.t)</span></dt>
<dd id="spl_fade_out_<?php echo $this->item1; ?>" class="spl_fade_out">
<span contenteditable="true" class="spl_text_input"><?php echo $this->fadeOut; ?></span>
</dd>
<dd class="edit-error"></dd>
<?php }
if ($this->item2Type == 0) {?>
<dt>Fade in (s):</dt>
<dt>Fade in: <span class='spl_cue_hint'>(ss.t)</span></dt>
<dd id="spl_fade_in_<?php echo $this->item2; ?>" class="spl_fade_in">
<span contenteditable="true" class="spl_text_input"><?php echo $this->fadeIn; ?></span>
</dd>

View File

@ -65,10 +65,10 @@ if (isset($this->obj)) {
<div id="crossfade_main" class="crossfade-main clearfix" style="display:none;">
<span class="ui-icon ui-icon-closethick"></span>
<dl id="spl_editor-main" class="inline-list">
<dt>Fade in (s):</dt>
<dt>Fade in: <span class='spl_cue_hint'>(ss.t)</span></dt>
<dd><span contenteditable="true" class="spl_text_input spl_main_fade_in">00</span></dd>
<dd class="edit-error"></dd>
<dt>Fade out (s):</dt>
<dt>Fade out: <span class='spl_cue_hint'>(ss.t)</span></dt>
<dd><span contenteditable="true" class="spl_text_input spl_main_fade_out">00</span></dd>
<dd class="edit-error"></dd>
</dl>

View File

@ -11,8 +11,8 @@
<div id="show_builder" class="sb-content ui-widget ui-widget-content block-shadow omega-block padded">
<div class="sb-timerange">
<?php if(!$this->disableLib && !$this->showLib):?>
<a id="sb_edit" class="btn btn-small" href="#" title="open the library to schedule files.">
Schedule files
<a id="sb_edit" class="btn btn-small" href="#" title="Open library to add or remove content">
Add / Remove Content
</a>
<?php endif; ?>
<?php echo $this->sb_form; ?>

View File

@ -116,6 +116,11 @@
color: #D5D5D5;
}
.spl_cue_hint {
font-size: 10px;
font-weight: normal;
}
.ui-state-active .spl_artist,.ui-state-active .spl_offset {
color: #606060 !important;
}

View File

@ -493,7 +493,7 @@ table.library-get-file-md.table-small{
.file-md-qtip-legend {
float: right;
width: 30%;
width: 34%;
font-size: 9px;
padding: 0px;
vertical-align:top;
@ -531,11 +531,11 @@ table.library-get-file-md.table-small{
}
input.input_text.sp_input_text{
width: 200px !important;
width: 139px !important;
}
input.input_text.sp_extra_input_text{
width: 90px !important;
width: 60px !important;
}
.sp_text_font{
@ -560,11 +560,7 @@ input.input_text.sp_extra_input_text{
}
.sp-button{
float: right !important;
width: 60px;
height: 24px !important;
margin-right: 0px !important;
margin-left: 10px !important;
margin-left: 368px;
}
.sp-save{
@ -1621,7 +1617,7 @@ div.errors, span.errors{
}
span.errors.sp-errors{
width: 486px;
width: 429px;
display: block;
}
@ -2287,7 +2283,7 @@ fieldset.closed, fieldset.display_field.closed {
margin-left: 1px;
}
fieldset.sb-criteria-fieldset{
min-width:670px;
min-width:503px;
overflow-x:auto;
}

View File

@ -65,7 +65,7 @@ var AIRTIME = (function(AIRTIME) {
var $el = $(this), selected = mod
.getChosenAudioFilesLength(), container, message, li = $("#side_playlist ul[id='spl_sortable'] li:first"), width = li
.width(), height = li.height();
.width(), height = 55;
// dragging an element that has an unselected
// checkbox.

View File

@ -29,6 +29,7 @@ var AIRTIME = (function(AIRTIME) {
"language" : "s",
"length" : "n",
"lyricist" : "s",
"mime" : "s",
"mood" : "s",
"name" : "s",
"orchestra" : "s",
@ -377,16 +378,6 @@ var AIRTIME = (function(AIRTIME) {
$.each(aoCols, function(i,ele){
if (ele.bSearchable) {
var currentColId = ele._ColReorder_iOrigCol;
var label = "";
if (ele.mDataProp == "bit_rate") {
label = " (bps)";
} else if (ele.mDataProp == "utime" || ele.mDataProp == "mtime" || ele.mDataProp == "lptime") {
label = " (yyyy-mm-dd)";
} else if (ele.mDataProp == "length") {
label = " (hh:mm:ss.t)";
} else if (ele.mDataProp == "sample_rate") {
label = " (Hz)";
}
var inputClass = 'filter_column filter_number_text';
var labelStyle = "style='margin-right:35px;'";
@ -396,9 +387,17 @@ var AIRTIME = (function(AIRTIME) {
}
if (ele.bVisible) {
advanceSearchDiv.append("<div id='advanced_search_col_"+currentColId+" class='control-group'><label class='control-label'"+labelStyle+">"+ele.sTitle+label+" : </label><div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div></div>");
advanceSearchDiv.append(
"<div id='advanced_search_col_"+currentColId+" class='control-group'>" +
"<label class='control-label'"+labelStyle+">"+ele.sTitle+" : </label>" +
"<div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div>" +
"</div>");
} else {
advanceSearchDiv.append("<div id='advanced_search_col_"+currentColId+"' class='control-group' style='display:none;'><label class='control-label'"+labelStyle+">"+ele.sTitle+label+"</label><div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div></div>");
advanceSearchDiv.append(
"<div id='advanced_search_col_"+currentColId+"' class='control-group' style='display:none;'>" +
"<label class='control-label'"+labelStyle+">"+ele.sTitle+"</label>" +
"<div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div>" +
"</div>");
}
if (criteriaTypes[ele.mDataProp] == "s") {
@ -1174,6 +1173,7 @@ var validationTypes = {
"composer" : "s",
"conductor" : "s",
"copyright" : "s",
"encoded_by" : "s",
"utime" : "t",
"mtime" : "t",
"lptime" : "t",
@ -1185,6 +1185,7 @@ var validationTypes = {
"length" : "l",
"lyricist" : "s",
"mood" : "s",
"mime" : "s",
"name" : "s",
"orchestra" : "s",
"owner_id" : "s",

View File

@ -18,13 +18,13 @@ var AIRTIME = (function(AIRTIME){
function isTimeValid(time) {
//var regExpr = new RegExp("^\\d{2}[:]\\d{2}[:]\\d{2}([.]\\d{1,6})?$");
var regExpr = new RegExp("^\\d{2}[:]([0-5]){1}([0-9]){1}[:]([0-5]){1}([0-9]){1}([.]\\d{1,6})?$");
var regExpr = new RegExp("^\\d{2}[:]([0-5]){1}([0-9]){1}[:]([0-5]){1}([0-9]){1}([.]\\d{1})?$");
return regExpr.test(time);
}
function isFadeValid(fade) {
var regExpr = new RegExp("^\\d{1}(\\d{1})?([.]\\d{1,6})?$");
var regExpr = new RegExp("^\\d{1}(\\d{1})?([.]\\d{1})?$");
return regExpr.test(fade);
}
@ -74,7 +74,7 @@ var AIRTIME = (function(AIRTIME){
type = $('#obj_type').val();
if (!isTimeValid(cueIn)){
showError(span, "please put in a time '00:00:00 (.000000)'");
showError(span, "please put in a time '00:00:00 (.0)'");
return;
}
$.post(url,
@ -111,7 +111,7 @@ var AIRTIME = (function(AIRTIME){
type = $('#obj_type').val();
if (!isTimeValid(cueOut)){
showError(span, "please put in a time '00:00:00 (.000000)'");
showError(span, "please put in a time '00:00:00 (.0)'");
return;
}
@ -150,7 +150,7 @@ var AIRTIME = (function(AIRTIME){
type = $('#obj_type').val();
if (!isFadeValid(fadeIn)){
showError(span, "please put in a time in seconds '00 (.000000)'");
showError(span, "please put in a time in seconds '00 (.0)'");
return;
}
@ -188,7 +188,7 @@ var AIRTIME = (function(AIRTIME){
type = $('#obj_type').val();
if (!isFadeValid(fadeOut)){
showError(span, "please put in a time in seconds '00 (.000000)'");
showError(span, "please put in a time in seconds '00 (.0)'");
return;
}
@ -545,7 +545,7 @@ var AIRTIME = (function(AIRTIME){
type = $('#obj_type').val();
if (!isFadeValid(fadeIn)){
showError(span, "please put in a time in seconds '00 (.000000)'");
showError(span, "please put in a time in seconds '00 (.0)'");
return;
}
@ -569,7 +569,7 @@ var AIRTIME = (function(AIRTIME){
type = $('#obj_type').val();
if (!isFadeValid(fadeOut)){
showError(span, "please put in a time in seconds '00 (.000000)'");
showError(span, "please put in a time in seconds '00 (.0)'");
return;
}

View File

@ -313,7 +313,7 @@ $(document).ready(function() {
$("#auto_switch_help").qtip({
content: {
text: "Check this box to automatically switch on Master/Show source upon source disconnection."
text: "Check this box to automatically switch on Master/Show source upon source connection."
},
hide: {
delay: 500,

View File

@ -15,7 +15,7 @@ AIRTIME = (function(AIRTIME) {
timeStartId = "#sb_time_start",
dateEndId = "#sb_date_end",
timeEndId = "#sb_time_end",
$toggleLib = $("<a id='sb_edit' class='btn btn-small' href='#' title='Open library to schedule files'>Schedule files</a>"),
$toggleLib = $("<a id='sb_edit' class='btn btn-small' href='#' title='Open library to add or remove content'>Add / Remove Content</a>"),
$libClose = $('<a />', {
"class": "close-round",
"href": "#",

View File

@ -5,8 +5,8 @@ Running a diff between the original column filter plugin (dataTables.columnFilte
our modified one (dataTables.columnFilter.js):
denise@denise-DX4860:~/airtime/airtime_mvc/public/js/datatables/plugin$ diff -u dataTables.columnFilter_orig.js dataTables.columnFilter.js
--- dataTables.columnFilter_orig.js 2012-09-10 14:26:30.041095663 -0400
+++ dataTables.columnFilter.js 2012-09-10 17:04:21.017464447 -0400
--- dataTables.columnFilter_orig.js 2012-09-11 11:53:16.476101955 -0400
+++ dataTables.columnFilter.js 2012-10-04 12:15:13.270199949 -0400
@@ -103,7 +103,8 @@
label = label.replace(/(^\s*)|(\s*$)/g, "");
var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch;
@ -32,7 +32,7 @@ denise@denise-DX4860:~/airtime/airtime_mvc/public/js/datatables/plugin$ diff -u
- var iCurrentFilterLength = this.value.length;
- if (Math.abs(iCurrentFilterLength - iLastFilterLength) < iFilterLength
- //&& currentFilter.length == 0 //Why this?
- ) {
- ) {
- //Cancel the filtering
- return;
- }
@ -52,7 +52,7 @@ denise@denise-DX4860:~/airtime/airtime_mvc/public/js/datatables/plugin$ diff -u
+ var iCurrentFilterLength = this.value.length;
+ if (Math.abs(iCurrentFilterLength - iLastFilterLength) < iFilterLength
+ //&& currentFilter.length == 0 //Why this?
+ ) {
+ ) {
+ //Cancel the filtering
+ return;
+ }
@ -81,7 +81,35 @@ denise@denise-DX4860:~/airtime/airtime_mvc/public/js/datatables/plugin$ diff -u
}
});
}
@@ -228,14 +233,16 @@
@@ -176,13 +181,25 @@
function fnCreateRangeInput(oTable) {
//var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch;
+
+ var label = "";
+ if (th.attr('id') == "bit_rate") {
+ label = " bps";
+ } else if (th.attr('id') == "utime" || th.attr('id') == "mtime" || th.attr('id') == "lptime") {
+ label = " yyyy-mm-dd";
+ } else if (th.attr('id') == "length") {
+ label = " hh:mm:ss.t";
+ } else if (th.attr('id') == "sample_rate") {
+ label = " Hz";
+ }
+
th.html(_fnRangeLabelPart(0));
var sFromId = oTable.attr("id") + '_range_from_' + i;
- var from = $('<input type="text" class="number_range_filter" id="' + sFromId + '" rel="' + i + '"/>');
+ var from = $('<input type="text" class="number_range_filter" id="' + sFromId + '" rel="' + i + '" placeholder="' + label + '"/>');
th.append(from);
th.append(_fnRangeLabelPart(1));
var sToId = oTable.attr("id") + '_range_to_' + i;
- var to = $('<input type="text" class="number_range_filter" id="' + sToId + '" rel="' + i + '"/>');
+ var to = $('<input type="text" class="number_range_filter" id="' + sToId + '" rel="' + i + '" placeholder="' + label + '"/>');
th.append(to);
th.append(_fnRangeLabelPart(2));
th.wrapInner('<span class="filterColumn filter_number_range" />');
@@ -228,14 +245,16 @@
$('#' + sFromId + ',#' + sToId, th).keyup(function () {
@ -106,3 +134,6 @@ denise@denise-DX4860:~/airtime/airtime_mvc/public/js/datatables/plugin$ diff -u
});

View File

@ -181,13 +181,25 @@
function fnCreateRangeInput(oTable) {
//var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch;
var label = "";
if (th.attr('id') == "bit_rate") {
label = " kbps";
} else if (th.attr('id') == "utime" || th.attr('id') == "mtime" || th.attr('id') == "lptime") {
label = " yyyy-mm-dd";
} else if (th.attr('id') == "length") {
label = " hh:mm:ss.t";
} else if (th.attr('id') == "sample_rate") {
label = " Hz";
}
th.html(_fnRangeLabelPart(0));
var sFromId = oTable.attr("id") + '_range_from_' + i;
var from = $('<input type="text" class="number_range_filter" id="' + sFromId + '" rel="' + i + '"/>');
var from = $('<input type="text" class="number_range_filter" id="' + sFromId + '" rel="' + i + '" placeholder="' + label + '"/>');
th.append(from);
th.append(_fnRangeLabelPart(1));
var sToId = oTable.attr("id") + '_range_to_' + i;
var to = $('<input type="text" class="number_range_filter" id="' + sToId + '" rel="' + i + '"/>');
var to = $('<input type="text" class="number_range_filter" id="' + sToId + '" rel="' + i + '" placeholder="' + label + '"/>');
th.append(to);
th.append(_fnRangeLabelPart(2));
th.wrapInner('<span class="filterColumn filter_number_range" />');
@ -737,4 +749,4 @@
})(jQuery);
})(jQuery);

View File

@ -94,8 +94,7 @@ with md.metadata("MDATA_KEY_MD5") as t:
t.optional(False)
t.translate(lambda k: file_md5(k['path'], max_length=100))
with md.metadata("MDATA_KEY_OWNER_ID") as t:
t.depends('owner_id')
# owner is handled differently by (by events.py)
with md.metadata('MDATA_KEY_ORIGINAL_PATH') as t:
t.depends('original_path')

View File

@ -34,6 +34,3 @@ class MMConfig(object):
"""
return mmp.last_modified(self.cfg['index_path'])
# Remove this after debugging...
def haxxor_set(self, key, value): self.cfg[key] = value
def haxxor_get(self, key): return self.cfg[key]

View File

@ -9,6 +9,7 @@ class EventDrainer(Loggable):
"""
def __init__(self, connection, interval=1):
def cb():
# TODO : make 0.3 parameter configurable
try : connection.drain_events(timeout=0.3)
except socket.timeout : pass
except Exception as e :

View File

@ -104,6 +104,7 @@ class BaseEvent(Loggable):
self._pack_hook = lambda: None # no op
# into another event
# TODO : delete this method later
def reset_hook(self):
"""
Resets the hook that is called after an event is packed. Before
@ -121,6 +122,7 @@ class BaseEvent(Loggable):
def __str__(self):
return "Event(%s). Path(%s)" % ( self.path, self.__class__.__name__)
# TODO : delete this method later
def add_safe_pack_hook(self,k):
"""
adds a callable object (function) that will be called after the event

View File

@ -40,6 +40,9 @@ def mediate_ignored(fn):
return wrapped
class BaseListener(object):
def __str__(self):
return "Listener(%s), Signal(%s)" % \
(self.__class__.__name__, self. signal)
def my_init(self, signal): self.signal = signal
class OrganizeListener(BaseListener, pyinotify.ProcessEvent, Loggable):

View File

@ -13,14 +13,21 @@ import media.monitor.pure as mmp
class ManagerTimeout(threading.Thread,Loggable):
def __init__(self, manager):
"""
The purpose of this class is to flush the organize directory every 3
secnods. This used to be just a work around for cc-4235 but recently
became a permanent solution because it's "cheap" and reliable
"""
def __init__(self, manager, interval=3):
# TODO : interval should be read from config and passed here instead
# of just using the hard coded value
threading.Thread.__init__(self)
self.manager = manager
self.manager = manager
self.interval = interval
def run(self):
while True:
time.sleep(3)
time.sleep(self.interval) # every 3 seconds
self.manager.flush_organize()
#self.logger.info("Force flushed organize...")
class Manager(Loggable):
"""
@ -97,8 +104,10 @@ class Manager(Loggable):
Start watching 'path' using 'listener'. First will check if directory
is being watched before adding another watch
"""
self.logger.info("Adding listener '%s' to '%s'" %
( listener.__class__.__name__, path) )
self.logger.info("Attempting to add listener to path '%s'" % path)
self.logger.info( 'Listener: %s' % str(listener) )
if not self.has_watch(path):
wd = self.wm.add_watch(path, pyinotify.ALL_EVENTS, rec=True,
auto_add=True, proc_fun=listener)
@ -241,8 +250,3 @@ class Manager(Loggable):
notifier = pyinotify.Notifier(self.wm)
notifier.coalesce_events()
notifier.loop()
# Experiments with running notifier in different modes
# There are 3 options: normal, async, threaded.
#import asyncore
#pyinotify.AsyncNotifier(self.wm).loop()
#asyncore.loop()

View File

@ -8,7 +8,7 @@ from mutagen.easyid3 import EasyID3KeyError
from media.monitor.exceptions import BadSongFile, InvalidMetadataElement
from media.monitor.log import Loggable
from media.monitor.pure import format_length
from media.monitor.pure import format_length, truncate_to_length
import media.monitor.pure as mmp
"""
@ -95,12 +95,6 @@ truncate_table = {
'MDATA_KEY_COPYRIGHT' : 512,
}
def truncate_to_length(item, length):
if isinstance(item, int): item = str(item)
if isinstance(item, basestring):
if len(item) > length: return item[0:length]
else: return item
class Metadata(Loggable):
# TODO : refactor the way metadata is being handled. Right now things are a
# little bit messy. Some of the handling is in m.m.pure while the rest is
@ -126,7 +120,14 @@ class Metadata(Loggable):
# TODO : some files have multiple fields for the same metadata.
# genre is one example. In that case mutagen will return a list
# of values
assign_val = m_val[0] if isinstance(m_val, list) else m_val
if isinstance(m_val, list):
# TODO : does it make more sense to just skip the element in
# this case?
if len(m_val) == 0: assign_val = ''
else: assign_val = m_val[0]
else: assign_val = m_val
temp_dict[ m_key ] = assign_val
airtime_dictionary = {}
for muta_k, muta_v in temp_dict.iteritems():
@ -169,9 +170,12 @@ class Metadata(Loggable):
# Forcing the unicode through
try : fpath = fpath.decode("utf-8")
except : pass
if not mmp.file_playable(fpath): raise BadSongFile(fpath)
try : full_mutagen = mutagen.File(fpath, easy=True)
except Exception : raise BadSongFile(fpath)
self.path = fpath
if not os.path.exists(self.path):
self.logger.info("Attempting to read metadata of file \

View File

@ -288,8 +288,6 @@ def normalized_metadata(md, original_path):
# TODO : wtf is this for again?
new_md['MDATA_KEY_TITLE'] = re.sub(r'-?%s-?' % unicode_unknown, u'',
new_md['MDATA_KEY_TITLE'])
# ugly mother fucking band aid until enterprise metadata framework is
# working
return new_md
def organized_path(old_path, root_path, orig_md):