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

This commit is contained in:
Martin Konecny 2012-04-12 17:23:03 -04:00
commit 6c17cf6e24
8 changed files with 152 additions and 32 deletions

View File

@ -648,13 +648,13 @@ class ApiController extends Zend_Controller_Action
$filepath = $md['MDATA_KEY_FILEPATH'];
$filepath = str_replace("\\", "", $filepath);
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
if (is_null($file)) {
$this->view->error = "File doesn't exist in Airtime.";
return;
}
else {
$file->delete();
$file->deleteByMediaMonitor();
}
}
else if ($mode == "delete_dir") {
@ -663,7 +663,7 @@ class ApiController extends Zend_Controller_Action
$files = Application_Model_StoredFile::RecallByPartialFilepath($filepath);
foreach($files as $file){
$file->delete();
$file->deleteByMediaMonitor();
}
return;
}

View File

@ -578,6 +578,11 @@ class Application_Model_Schedule {
global $CC_CONFIG, $CC_DBC;
$CC_DBC->query("TRUNCATE TABLE ".$CC_CONFIG["scheduleTable"]);
}
public static function deleteWithFileId($fileId){
global $CC_CONFIG, $CC_DBC;
$CC_DBC->query("DELETE FROM ".$CC_CONFIG["scheduleTable"]." WHERE file_id=$fileId");
}
public static function createNewFormSections($p_view){
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;

View File

@ -567,15 +567,14 @@ class Application_Model_ShowInstance {
public function getTimeScheduled()
{
$time = $this->_showInstance->getDbTimeFilled();
if (is_null($time)) {
$time = "00:00:00";
if ($time != "00:00:00") {
$milliseconds = substr(round(substr($time, 8), 2), 1);
$time = substr($time, 0, 8) . $milliseconds;
} else {
$time = "00:00:00.00";
}
else {
$formatter = new LengthFormatter($time);
$time = $formatter->format();
}
return $time;
}
@ -610,9 +609,17 @@ class Application_Model_ShowInstance {
$interval = $start->diff($end);
$days = $interval->format("%d");
$hours = sprintf("%02d" ,$interval->format("%h"));
if ($days > 0) {
$totalHours = $days * 24 + $hours;
//$interval object does not have milliseconds so hard code to .00
$returnStr = $totalHours . ":" . $interval->format("%I:%S") . ".00";
} else {
$returnStr = $hours . ":" . $interval->format("%I:%S") . ".00";
}
if ($days > 0) return "24:" . $interval->format("%I:%S");
else return $interval->format("%h:%I:%S");
return $returnStr;
}
public function getShowListContent()

View File

@ -286,14 +286,12 @@ class Application_Model_StoredFile {
{
$filepath = $this->getFilePath();
// Check if the file is scheduled to be played in the future
if (Application_Model_Schedule::IsFileScheduledInTheFuture($this->getId())) {
throw new DeleteScheduledFileException();
}
if (file_exists($filepath)) {
$data = array("filepath" => $filepath, "delete" => 1);
Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data);
}
@ -301,7 +299,25 @@ class Application_Model_StoredFile {
if ($deleteFromPlaylist){
Application_Model_Playlist::DeleteFileFromAllPlaylists($this->getId());
}
// set file_exists falg to false
$this->_file->setDbFileExists(false);
$this->_file->save();
}
/**
* This function is for when media monitor detects deletion of file
* and trying to update airtime side
*
* @param boolean $p_deleteFile
*
*/
public function deleteByMediaMonitor($deleteFromPlaylist=false)
{
$filepath = $this->getFilePath();
if ($deleteFromPlaylist){
Application_Model_Playlist::DeleteFileFromAllPlaylists($this->getId());
}
// set file_exists falg to false
$this->_file->setDbFileExists(false);
$this->_file->save();

View File

@ -53,4 +53,4 @@
To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
</div>
</div>
</div>
</div>

View File

@ -684,7 +684,7 @@ input[type="checkbox"] {
width:13px;
height:13px;
}
/*---//////////////////// LOGIN ////////////////////---*/
/*---//////////////////// LOGIN & PASSWORD RESET ////////////////////---*/
.login_box {
margin: 0 auto 0 auto;
@ -703,7 +703,7 @@ input[type="checkbox"] {
border:1px solid #181818;
border-top-color:#4f4f4f;
margin:0;
padding:8px 0 8px 14px;
padding:8px 0 8px 20px;
font-size:15px;
font-weight:bold;
color:#bebebe;
@ -754,7 +754,7 @@ input[type="checkbox"] {
.login-content {
background:url(images/login_content_bg.png) no-repeat 0 bottom;
padding:10px 10px 12px 14px;
padding:10px 20px 14px;
text-align:left;
}
.login-content dl, .login-content dl.zend_form {
@ -766,23 +766,23 @@ input[type="checkbox"] {
}
.login-content dd {
padding: 4px 0;
float: left;
/*float: left;*/
font-size: 1.2em;
margin: 0;
padding: 4px 0 4px 15px;
padding: 0 0 9px 0;
display:block;
}
.login-content dt {
clear: left;
color: #666666;
float: left;
/*float: left;*/
font-size: 1.2em;
font-weight: bold;
margin: 0;
padding: 4px 0;
padding: 0 0 6px 0;
text-align: left;
min-width:90px;
clear:left;
display:block;
}
dt.block-display, dd.block-display {
@ -794,11 +794,31 @@ dt.block-display, dd.block-display {
.login-content dt label {
padding-right:0;
color:#a8a8a8;
}
.login-content dd .input_text {
padding-right:0;
width:280px;
.login-content dd .input_text, .login-content dd input[type="text"], .login-content dd input[type="password"] {
width:99%;
font-size:14px;
padding: 6px 0 6px 3px;
}
.login-content dd input.ui-button, .login-content dd input.btn {
width:100%;
font-size:14px;
padding: 6px 10px 6px;
}
.login-content .hidden, .hidden {
display:none;
}
.login-content .text-right, .text-right {
text-align:right;
}
.login-content .link {
color:#FF5D1A;
text-decoration:none;
}
.login-content .link:hover {
text-decoration:underline;
}
/*---//////////////////// END LOGIN ////////////////////---*/
@ -2566,4 +2586,74 @@ dd .stream-status {
}
.close-round:active {
background-position:0 -36px;
}
}
/*---//////////////////// NEW BUTTONS ////////////////////---*/
.btn {
display: inline-block;
*display: inline;
/* IE7 inline-block hack */
*zoom: 1;
padding: 4px 10px 4px;
margin-bottom: 0;
font-size: 13px;
line-height: 18px;
color: #fff;
text-align: center;
vertical-align: middle;
background-image: -moz-linear-gradient(top, #a3a3a3, #6e6e6e);
background-image: -ms-linear-gradient(top, #a3a3a3, #6e6e6e);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#a3a3a3), to(#6e6e6e));
background-image: -webkit-linear-gradient(top, #a3a3a3, #6e6e6e);
background-image: -o-linear-gradient(top, #a3a3a3, #6e6e6e);
background-image: linear-gradient(top, #a3a3a3, #6e6e6e);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#a3a3a3', endColorstr='#6e6e6e', GradientType=0);
border:1px solid #575757;
border-bottom-color: #333333;
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 2px rgba(0, 0, 0, 0.05);
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 2px rgba(0, 0, 0, 0.05);
cursor: pointer;
*margin-left: .3em;
}
.btn.disabled,
.btn[disabled] {
background: #fff;
}
.btn:active,
.btn.active {
background-color: #cccccc \9;
}
.btn:first-child {
*margin-left: 0;
}
.btn:hover {
color: #fff;
text-decoration: none;
background-color: #e6e6e6;
background-image: -moz-linear-gradient(top, #868686, #535353);
background-image: -ms-linear-gradient(top, #868686, #535353);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#868686), to(#535353));
background-image: -webkit-linear-gradient(top, #868686, #535353);
background-image: -o-linear-gradient(top, #868686, #535353);
background-image: linear-gradient(top, #868686, #535353);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#868686', endColorstr='#535353', GradientType=0);
}
.btn.active,
.btn:active {
background-image: none;
-webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.2);
-moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255,0.2);
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.2);
background-color: #727272;
outline: 0;
border-top-color:#333333
}

View File

@ -645,4 +645,4 @@ a.jp-shuffle-off:hover {
font-weight:bold;
}
/* @end */
/* @end */

View File

@ -9,12 +9,14 @@ class MediaMonitorWorkerProcess:
while True:
try:
event = queue.get()
notifier.logger.info("received event %s", event)
if event['mode'] == AirtimeMediaConfig.MODE_CREATE:
filepath = event['filepath']
if mediamonitorcommon.test_file_playability(filepath):
notifier.logger.info("received event %s", event)
if mediamonitorcommon.test_file_playability(filepath):
notifier.update_airtime(event)
else:
notifier.logger.warn("Liquidsoap integrity check for file at %s failed. Not adding to media library.", filepath)
else:
notifier.update_airtime(event)
except Exception, e:
notifier.logger.error(e)