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 { try {
$obj = $this->getPlaylist($type); $obj = $this->getPlaylist($type);
$obj->setName($name); $obj->setName(trim($name));
$obj->setDescription($description); $obj->setDescription($description);
$this->view->description = $description; $this->view->description = $description;
$this->view->playlistName = $name; $this->view->playlistName = $name;

View file

@ -163,7 +163,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
} elseif (!$formData["add_show_no_end"]) { } elseif (!$formData["add_show_no_end"]) {
$popUntil = $formData["add_show_end_date"]." ".$formData["add_show_end_time"]; $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 //get repeat interval
@ -198,21 +199,20 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$repeatShowStart->add(new DateInterval("P".$daysAdd."D")); $repeatShowStart->add(new DateInterval("P".$daysAdd."D"));
$repeatShowEnd->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()) { while ($repeatShowStart->getTimestamp() < $populateUntilDateTime->getTimestamp()) {
//need to get each repeating show's instance id if ($formData['add_show_id'] == -1) {
$qry = CcShowInstancesQuery::create() //this is a new show
->filterByDbStarts($repeatShowStart->format('Y-m-d H:i:s')) $overlapping = Application_Model_Schedule::checkOverlappingShows(
->filterByDbEnds($repeatShowEnd->format('Y-m-d H:i:s')) $repeatShowStart, $repeatShowEnd);
->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);
} else { } else {
$overlapping = false; $overlapping = Application_Model_Schedule::checkOverlappingShows(
$repeatShowStart, $repeatShowEnd, $update, null, $formData["add_show_id"]);
} }
if ($overlapping) { if ($overlapping) {
$valid = false; $valid = false;
$this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows')); $this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
@ -244,6 +244,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$durationToAdd = "PT".$hours."H"; $durationToAdd = "PT".$hours."H";
} }
if (empty($formData["add_show_rebroadcast_date_absolute_".$i])) break;
$abs_rebroadcast_start = $formData["add_show_rebroadcast_date_absolute_".$i]." ". $abs_rebroadcast_start = $formData["add_show_rebroadcast_date_absolute_".$i]." ".
$formData["add_show_rebroadcast_time_absolute_".$i]; $formData["add_show_rebroadcast_time_absolute_".$i];
$rebroadcastShowStart = new DateTime($abs_rebroadcast_start); $rebroadcastShowStart = new DateTime($abs_rebroadcast_start);

View file

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

View file

@ -229,11 +229,18 @@ SQL;
$formatter = new LengthFormatter($offset_cliplength); $formatter = new LengthFormatter($offset_cliplength);
$row['offset'] = $formatter->format(); $row['offset'] = $formatter->format();
//format the fades in format 00(.000000) //format the fades in format 00(.0)
$fades = $this->getFadeInfo($row['position']); $fades = $this->getFadeInfo($row['position']);
$row['fadein'] = $fades[0]; $row['fadein'] = $fades[0];
$row['fadeout'] = $fades[1]; $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 //format original length
$formatter = new LengthFormatter($row['orig_length']); $formatter = new LengthFormatter($row['orig_length']);
$row['orig_length'] = $formatter->format(); $row['orig_length'] = $formatter->format();
@ -611,9 +618,10 @@ SQL;
#Propel returns values in form 00.000000 format which is for only seconds. //Propel returns values in form 00.000000 format which is for only seconds.
$fadeIn = $row->getDbFadein(); //We only want to display 1 decimal
$fadeOut = $row->getDbFadeout(); $fadeIn = substr($row->getDbFadein(), 0, 4);
$fadeOut = substr($row->getDbFadeout(), 0, 4);
return array($fadeIn, $fadeOut); return array($fadeIn, $fadeOut);
} }

View file

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

View file

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

View file

@ -180,13 +180,18 @@ SQL;
return "Shows can have a max length of 24 hours."; return "Shows can have a max length of 24 hours.";
} }
$utc = new DateTimeZone("UTC");
$nowDateTime = new DateTime("now", $utc);
$showInstances = CcShowInstancesQuery::create() $showInstances = CcShowInstancesQuery::create()
->filterByDbShowId($this->_showId) ->filterByDbShowId($this->_showId)
->find($con); ->find($con);
/* Check if the show being resized and any of its repeats * overlap /* 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 */ with other scheduled shows */
$utc = new DateTimeZone("UTC");
foreach ($showInstances as $si) { foreach ($showInstances as $si) {
$startsDateTime = new DateTime($si->getDbStarts(), new DateTimeZone("UTC")); $startsDateTime = new DateTime($si->getDbStarts(), new DateTimeZone("UTC"));
@ -202,6 +207,10 @@ SQL;
$newStartsDateTime = Application_Model_ShowInstance::addDeltas($startsDateTime, $deltaDay, $deltaMin); $newStartsDateTime = Application_Model_ShowInstance::addDeltas($startsDateTime, $deltaDay, $deltaMin);
$newEndsDateTime = Application_Model_ShowInstance::addDeltas($endsDateTime, $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. //convert our new starts/ends to UTC.
$newStartsDateTime->setTimezone($utc); $newStartsDateTime->setTimezone($utc);
$newEndsDateTime->setTimezone($utc); $newEndsDateTime->setTimezone($utc);
@ -1203,15 +1212,16 @@ SQL;
//$con = Propel::getConnection(CcShowPeer::DATABASE_NAME); //$con = Propel::getConnection(CcShowPeer::DATABASE_NAME);
//$sql = "SELECT date '{$data['add_show_rebroadcast_date_absolute_'.$i]}' - date '{$data['add_show_start_date']}' "; //$sql = "SELECT date '{$data['add_show_rebroadcast_date_absolute_'.$i]}' - date '{$data['add_show_start_date']}' ";
$sql = <<<SQL $sql = <<<SQL
SELECT date :rebroadcast - date :start SELECT :rebroadcast::date - :start::date
SQL; SQL;
$offset_days = $offset_days =
Application_Common_Database::prepareAndExecute($sql, Application_Common_Database::prepareAndExecute($sql,
array( array(
'rebroadcast' => 'rebroadcast' =>
$date["add_show_rebroadcast_date_absolute_$i"], $data["add_show_rebroadcast_date_absolute_$i"],
'start' => 'start' =>
$date['add_show_start_date']), "column" ); $data['add_show_start_date']), "column" );
//$r = $con->query($sql); //$r = $con->query($sql);
//$offset_days = $r->fetchColumn(0); //$offset_days = $r->fetchColumn(0);

View file

@ -192,6 +192,7 @@ class Application_Model_StoredFile
if ($dbColumn == "track_title" && (is_null($mdValue) || $mdValue == "")) { if ($dbColumn == "track_title" && (is_null($mdValue) || $mdValue == "")) {
continue; continue;
} }
# TODO : refactor string evals
if (isset($this->_dbMD[$dbColumn])) { if (isset($this->_dbMD[$dbColumn])) {
$propelColumn = $this->_dbMD[$dbColumn]; $propelColumn = $this->_dbMD[$dbColumn];
$method = "set$propelColumn"; $method = "set$propelColumn";
@ -756,10 +757,13 @@ SQL;
$row['tr_id'] = "{$type}_{$row['id']}"; $row['tr_id'] = "{$type}_{$row['id']}";
//TODO url like this to work on both playlist/showbuilder screens. //TODO url like this to work on both playlist/showbuilder
//datatable stuff really needs to be pulled out and generalized within the project //screens. datatable stuff really needs to be pulled out and
//access to zend view methods to access url helpers is needed. //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") { if ($type == "au") {
$row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION); $row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
$row['image'] = '<img title="Track preview" src="/css/images/icon_audioclip.png">'; $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_date_end'); ?>
<?php echo $this->element->getElement('sb_time_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> <i class="icon-white icon-search"></i> Find Shows</a>
<div class="sb-advanced-options"> <div class="sb-advanced-options">
<fieldset class="padded display_field push-down-8 closed"> <fieldset class="padded display_field push-down-8 closed">

View file

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

View file

@ -3,9 +3,9 @@
<dl class="zend_form"> <dl class="zend_form">
<dd id="SupportFeedback-element" style="width:90%;"> <dd id="SupportFeedback-element" style="width:90%;">
<div class="info-text"> <div class="info-text">
Help Airtime improve by letting us know how you are using it. This info 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 /><br /> will be collected regularly in order to enhance your user experience.<br />
Click "Yes, help Airtime" and we'll make sure the features you use are Click the "Send support feedback" box and we'll make sure the features you use are
constantly improving. constantly improving.
</div> </div>
<label class="optional" for="SupportFeedback"> <label class="optional" for="SupportFeedback">
@ -21,9 +21,9 @@
<?php endif; ?> <?php endif; ?>
</dd> </dd>
<dd id="publicize-element" style="width:90%;"> <dd id="publicize-element" style="width:90%;">
<div class="info-text">Click the box below to advertise your station on <div class="info-text">Click the box below to promote 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>. <a id="link_to_whos_using" href="http://www.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>
<label class="optional" for="Publicise"> <label class="optional" for="Publicise">
<?php echo $this->element->getElement('Publicise') ?> <?php echo $this->element->getElement('Publicise') ?>
<strong><?php echo $this->element->getElement('Publicise')->getLabel() ?></strong> <strong><?php echo $this->element->getElement('Publicise')->getLabel() ?></strong>
@ -37,7 +37,7 @@
<?php endif; ?> <?php endif; ?>
</dd> </dd>
</dl> </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 }?> <?php }?>
<dl id="public-info" style="display:<?php echo !$this->isSaas?"none":"block"?>;"> <dl id="public-info" style="display:<?php echo !$this->isSaas?"none":"block"?>;">
<dt id="stationName-label" class="block-display"> <dt id="stationName-label" class="block-display">
@ -179,7 +179,7 @@
</ul> </ul>
<?php endif; ?> <?php endif; ?>
<?php }else{?> <?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 }?> <?php }?>
</div> </div>
<?php } ?> <?php } ?>

View file

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

View file

@ -3,7 +3,7 @@
<h2>Reset password</h2> <h2>Reset password</h2>
<div id="login" class="login-content clearfix"> <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; ?> <?php echo $this->form; ?>
</div> </div>
</div> </div>

View file

@ -57,10 +57,10 @@ if (isset($this->obj)) {
<div id="crossfade_main" class="crossfade-main clearfix" style="display:none;"> <div id="crossfade_main" class="crossfade-main clearfix" style="display:none;">
<span class="ui-icon ui-icon-closethick sp-closethick-center"></span> <span class="ui-icon ui-icon-closethick sp-closethick-center"></span>
<dl id="spl_editor-main" class="inline-list"> <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><span contenteditable="true" class="spl_text_input spl_main_fade_in">00</span></dd>
<dd class="edit-error"></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><span contenteditable="true" class="spl_text_input spl_main_fade_out">00</span></dd>
<dd class="edit-error"></dd> <dd class="edit-error"></dd>
</dl> </dl>

View file

@ -1,10 +1,10 @@
<dl id="spl_cue_editor" class="inline-list"> <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"> <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> <span contenteditable="true" class="spl_text_input"><?php echo $this->cueIn; ?></span>
</dd> </dd>
<dd class="edit-error"></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"> <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> <span contenteditable="true" class="spl_text_input"><?php echo $this->cueOut; ?></span>
</dd> </dd>

View file

@ -1,13 +1,13 @@
<dl id="spl_editor" class="inline-list"> <dl id="spl_editor" class="inline-list">
<?php if ($this->item1Type == 0) {?> <?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"> <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> <span contenteditable="true" class="spl_text_input"><?php echo $this->fadeOut; ?></span>
</dd> </dd>
<dd class="edit-error"></dd> <dd class="edit-error"></dd>
<?php } <?php }
if ($this->item2Type == 0) {?> 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"> <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> <span contenteditable="true" class="spl_text_input"><?php echo $this->fadeIn; ?></span>
</dd> </dd>

View file

@ -65,10 +65,10 @@ if (isset($this->obj)) {
<div id="crossfade_main" class="crossfade-main clearfix" style="display:none;"> <div id="crossfade_main" class="crossfade-main clearfix" style="display:none;">
<span class="ui-icon ui-icon-closethick"></span> <span class="ui-icon ui-icon-closethick"></span>
<dl id="spl_editor-main" class="inline-list"> <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><span contenteditable="true" class="spl_text_input spl_main_fade_in">00</span></dd>
<dd class="edit-error"></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><span contenteditable="true" class="spl_text_input spl_main_fade_out">00</span></dd>
<dd class="edit-error"></dd> <dd class="edit-error"></dd>
</dl> </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 id="show_builder" class="sb-content ui-widget ui-widget-content block-shadow omega-block padded">
<div class="sb-timerange"> <div class="sb-timerange">
<?php if(!$this->disableLib && !$this->showLib):?> <?php if(!$this->disableLib && !$this->showLib):?>
<a id="sb_edit" class="btn btn-small" href="#" title="open the library to schedule files."> <a id="sb_edit" class="btn btn-small" href="#" title="Open library to add or remove content">
Schedule files Add / Remove Content
</a> </a>
<?php endif; ?> <?php endif; ?>
<?php echo $this->sb_form; ?> <?php echo $this->sb_form; ?>

View file

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

View file

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

View file

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

View file

@ -29,6 +29,7 @@ var AIRTIME = (function(AIRTIME) {
"language" : "s", "language" : "s",
"length" : "n", "length" : "n",
"lyricist" : "s", "lyricist" : "s",
"mime" : "s",
"mood" : "s", "mood" : "s",
"name" : "s", "name" : "s",
"orchestra" : "s", "orchestra" : "s",
@ -377,16 +378,6 @@ var AIRTIME = (function(AIRTIME) {
$.each(aoCols, function(i,ele){ $.each(aoCols, function(i,ele){
if (ele.bSearchable) { if (ele.bSearchable) {
var currentColId = ele._ColReorder_iOrigCol; 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 inputClass = 'filter_column filter_number_text';
var labelStyle = "style='margin-right:35px;'"; var labelStyle = "style='margin-right:35px;'";
@ -396,9 +387,17 @@ var AIRTIME = (function(AIRTIME) {
} }
if (ele.bVisible) { 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 { } 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") { if (criteriaTypes[ele.mDataProp] == "s") {
@ -1174,6 +1173,7 @@ var validationTypes = {
"composer" : "s", "composer" : "s",
"conductor" : "s", "conductor" : "s",
"copyright" : "s", "copyright" : "s",
"encoded_by" : "s",
"utime" : "t", "utime" : "t",
"mtime" : "t", "mtime" : "t",
"lptime" : "t", "lptime" : "t",
@ -1185,6 +1185,7 @@ var validationTypes = {
"length" : "l", "length" : "l",
"lyricist" : "s", "lyricist" : "s",
"mood" : "s", "mood" : "s",
"mime" : "s",
"name" : "s", "name" : "s",
"orchestra" : "s", "orchestra" : "s",
"owner_id" : "s", "owner_id" : "s",

View file

@ -18,13 +18,13 @@ var AIRTIME = (function(AIRTIME){
function isTimeValid(time) { function isTimeValid(time) {
//var regExpr = new RegExp("^\\d{2}[:]\\d{2}[:]\\d{2}([.]\\d{1,6})?$"); //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); return regExpr.test(time);
} }
function isFadeValid(fade) { 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); return regExpr.test(fade);
} }
@ -74,7 +74,7 @@ var AIRTIME = (function(AIRTIME){
type = $('#obj_type').val(); type = $('#obj_type').val();
if (!isTimeValid(cueIn)){ 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; return;
} }
$.post(url, $.post(url,
@ -111,7 +111,7 @@ var AIRTIME = (function(AIRTIME){
type = $('#obj_type').val(); type = $('#obj_type').val();
if (!isTimeValid(cueOut)){ 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; return;
} }
@ -150,7 +150,7 @@ var AIRTIME = (function(AIRTIME){
type = $('#obj_type').val(); type = $('#obj_type').val();
if (!isFadeValid(fadeIn)){ 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; return;
} }
@ -188,7 +188,7 @@ var AIRTIME = (function(AIRTIME){
type = $('#obj_type').val(); type = $('#obj_type').val();
if (!isFadeValid(fadeOut)){ 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; return;
} }
@ -545,7 +545,7 @@ var AIRTIME = (function(AIRTIME){
type = $('#obj_type').val(); type = $('#obj_type').val();
if (!isFadeValid(fadeIn)){ 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; return;
} }
@ -569,7 +569,7 @@ var AIRTIME = (function(AIRTIME){
type = $('#obj_type').val(); type = $('#obj_type').val();
if (!isFadeValid(fadeOut)){ 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; return;
} }

View file

@ -313,7 +313,7 @@ $(document).ready(function() {
$("#auto_switch_help").qtip({ $("#auto_switch_help").qtip({
content: { 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: { hide: {
delay: 500, delay: 500,

View file

@ -15,7 +15,7 @@ AIRTIME = (function(AIRTIME) {
timeStartId = "#sb_time_start", timeStartId = "#sb_time_start",
dateEndId = "#sb_date_end", dateEndId = "#sb_date_end",
timeEndId = "#sb_time_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 />', { $libClose = $('<a />', {
"class": "close-round", "class": "close-round",
"href": "#", "href": "#",

View file

@ -5,8 +5,8 @@ Running a diff between the original column filter plugin (dataTables.columnFilte
our modified one (dataTables.columnFilter.js): 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 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_orig.js 2012-09-11 11:53:16.476101955 -0400
+++ dataTables.columnFilter.js 2012-09-10 17:04:21.017464447 -0400 +++ dataTables.columnFilter.js 2012-10-04 12:15:13.270199949 -0400
@@ -103,7 +103,8 @@ @@ -103,7 +103,8 @@
label = label.replace(/(^\s*)|(\s*$)/g, ""); label = label.replace(/(^\s*)|(\s*$)/g, "");
var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch; var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch;
@ -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 () { $('#' + 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) { function fnCreateRangeInput(oTable) {
//var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch; //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)); th.html(_fnRangeLabelPart(0));
var sFromId = oTable.attr("id") + '_range_from_' + i; 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(from);
th.append(_fnRangeLabelPart(1)); th.append(_fnRangeLabelPart(1));
var sToId = oTable.attr("id") + '_range_to_' + i; 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(to);
th.append(_fnRangeLabelPart(2)); th.append(_fnRangeLabelPart(2));
th.wrapInner('<span class="filterColumn filter_number_range" />'); th.wrapInner('<span class="filterColumn filter_number_range" />');

View file

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

View file

@ -34,6 +34,3 @@ class MMConfig(object):
""" """
return mmp.last_modified(self.cfg['index_path']) 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 __init__(self, connection, interval=1):
def cb(): def cb():
# TODO : make 0.3 parameter configurable
try : connection.drain_events(timeout=0.3) try : connection.drain_events(timeout=0.3)
except socket.timeout : pass except socket.timeout : pass
except Exception as e : except Exception as e :

View file

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

View file

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

View file

@ -13,14 +13,21 @@ import media.monitor.pure as mmp
class ManagerTimeout(threading.Thread,Loggable): 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) threading.Thread.__init__(self)
self.manager = manager self.manager = manager
self.interval = interval
def run(self): def run(self):
while True: while True:
time.sleep(3) time.sleep(self.interval) # every 3 seconds
self.manager.flush_organize() self.manager.flush_organize()
#self.logger.info("Force flushed organize...")
class Manager(Loggable): class Manager(Loggable):
""" """
@ -97,8 +104,10 @@ class Manager(Loggable):
Start watching 'path' using 'listener'. First will check if directory Start watching 'path' using 'listener'. First will check if directory
is being watched before adding another watch 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): if not self.has_watch(path):
wd = self.wm.add_watch(path, pyinotify.ALL_EVENTS, rec=True, wd = self.wm.add_watch(path, pyinotify.ALL_EVENTS, rec=True,
auto_add=True, proc_fun=listener) auto_add=True, proc_fun=listener)
@ -241,8 +250,3 @@ class Manager(Loggable):
notifier = pyinotify.Notifier(self.wm) notifier = pyinotify.Notifier(self.wm)
notifier.coalesce_events() notifier.coalesce_events()
notifier.loop() 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.exceptions import BadSongFile, InvalidMetadataElement
from media.monitor.log import Loggable 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 import media.monitor.pure as mmp
""" """
@ -95,12 +95,6 @@ truncate_table = {
'MDATA_KEY_COPYRIGHT' : 512, '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): class Metadata(Loggable):
# TODO : refactor the way metadata is being handled. Right now things are a # 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 # 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. # TODO : some files have multiple fields for the same metadata.
# genre is one example. In that case mutagen will return a list # genre is one example. In that case mutagen will return a list
# of values # 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 temp_dict[ m_key ] = assign_val
airtime_dictionary = {} airtime_dictionary = {}
for muta_k, muta_v in temp_dict.iteritems(): for muta_k, muta_v in temp_dict.iteritems():
@ -169,9 +170,12 @@ class Metadata(Loggable):
# Forcing the unicode through # Forcing the unicode through
try : fpath = fpath.decode("utf-8") try : fpath = fpath.decode("utf-8")
except : pass except : pass
if not mmp.file_playable(fpath): raise BadSongFile(fpath) if not mmp.file_playable(fpath): raise BadSongFile(fpath)
try : full_mutagen = mutagen.File(fpath, easy=True) try : full_mutagen = mutagen.File(fpath, easy=True)
except Exception : raise BadSongFile(fpath) except Exception : raise BadSongFile(fpath)
self.path = fpath self.path = fpath
if not os.path.exists(self.path): if not os.path.exists(self.path):
self.logger.info("Attempting to read metadata of file \ 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? # TODO : wtf is this for again?
new_md['MDATA_KEY_TITLE'] = re.sub(r'-?%s-?' % unicode_unknown, u'', new_md['MDATA_KEY_TITLE'] = re.sub(r'-?%s-?' % unicode_unknown, u'',
new_md['MDATA_KEY_TITLE']) new_md['MDATA_KEY_TITLE'])
# ugly mother fucking band aid until enterprise metadata framework is
# working
return new_md return new_md
def organized_path(old_path, root_path, orig_md): def organized_path(old_path, root_path, orig_md):