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

This commit is contained in:
martin 2011-09-22 17:50:51 -04:00
commit 53a095d0a5
9 changed files with 67 additions and 9 deletions

1
.gitignore vendored
View File

@ -2,4 +2,5 @@
*.pyc
/files
python_apps/pypo/liquidsoap_bin/liquidsoap
python_apps/pypo/liquidsoap/
build/build.properties

View File

@ -407,6 +407,13 @@ class ApiController extends Zend_Controller_Action
}
catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
$code = $e->getHttpCode();
$msg = $e->getHttpBody();
$temp = explode('"error":',$msg);
$msg = trim($temp[1], '"}');
$this->setSoundCloudErrorCode($code);
$this->setSoundCloudErrorMsg($msg);
// setting sc id to -3 which indicates error
$this->setSoundCloudFileId(-3);
if(!in_array($code, array(0, 100))) {
break;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

View File

@ -1567,7 +1567,7 @@ div.success{
width:21px;
}
.small-icon.sc-error {
background:url(images/icon_record.png) no-repeat 0 0;
background:url(images/icon_soundcloud_error2.png) no-repeat 0 0;
}
.small-icon.progress {
background:url(images/upload-icon.gif) no-repeat;

View File

@ -374,16 +374,16 @@ function setAddShowEvents() {
function calculateDuration(endDateTime, startDateTime){
var duration;
var durationSeconds = (endDateTime.getTime() - startDateTime.getTime())/1000;
if(durationSeconds != 0){
if(isNaN(durationSeconds)){
duration = '1h';
}
else if(durationSeconds != 0){
var durationHour = parseInt(durationSeconds/3600, 10);
var durationMin = parseInt((durationSeconds%3600)/60, 10);
duration = (durationHour == 0 ? '' : durationHour+'h'+' ')+(durationMin == 0 ? '' : durationMin+'m');
}else{
duration = '0m';
}
if(isNaN(duration)){
duration = '1h';
}
$('#add_show_duration').val(duration);
}

View File

@ -18,6 +18,19 @@ class Version20110829143306 extends AbstractMigration
$cc_stream_setting->setPrimaryKey(array('keyname'));
//end create cc_stream_setting table
// add soundcloud_id, soundcloud_error_code, soundcloud_error_msg columns to cc_files
$cc_files = $schema->getTable('cc_files');
$cc_files->addColumn('soundcloud_id', 'integer', array('notnull' => 0, 'default'=> NULL));
$cc_files->addColumn('soundcloud_error_code', 'integer', array('notnull' => 0, 'default'=> NULL));
$cc_files->addColumn('soundcloud_error_msg', 'string', array('length' => 255, 'notnull' => 0, 'default'=> NULL));
}
public function postUp(){
// move soundcloud_id from cc_show_instances to cc_files
$this->_addSql("update cc_files as cf set soundcloud_id = csi.soundcloud_id
from cc_show_instances as csi
where csi.file_id = cf.id and file_id is not NULL");
}
public function down(Schema $schema)

View File

@ -0,0 +1,38 @@
<?php
namespace DoctrineMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration,
Doctrine\DBAL\Schema\Schema;
class Version20110922153933 extends AbstractMigration
{
public function up(Schema $schema)
{
// move soundcloud_id from cc_show_instances to cc_files
$this->_addSql("update cc_files as cf set soundcloud_id = csi.soundcloud_id
from cc_show_instances as csi
where csi.file_id = cf.id and file_id is not NULL");
// remove soundcloud_id from cc_show_instance table
$cc_show_instances = $schema->getTable('cc_show_instances');
$cc_show_instances->dropColumn('soundcloud_id');
// create cc_login_sttempts table
$cc_login = $schema->createTable('cc_login_attempts');
$cc_login->addColumn('ip', 'string', array('length' => 32));
$cc_login->addColumn('attempts', 'integer', array('notnull' => 0, 'default'=> 0));
$cc_login->setPrimaryKey(array('ip'));
// add login_attempts column to cc_subjs table
$cc_subjs = $schema->getTable('cc_subjs');
$cc_subjs->addColumn('login_attempts', 'integer', array('notnull' => 0, 'default'=> 0));
}
public function down(Schema $schema)
{
}
}

View File

@ -301,7 +301,7 @@ class ConvertToUtc{
$dt = new DateTime($sd->getDbFirstShow()." ".$sd->getDbStartTime(), new DateTimeZone(date_default_timezone_get()));
$dt->setTimezone(new DateTimeZone("UTC"));
$sd->setDbFirstShow($dt->format("Y-m-d"));
$sd->setDbStartTime($dt->format("H-i-s"));
$sd->setDbStartTime($dt->format("H:i:s"));
$dt = new DateTime($sd->getDbLastShow()." ".$sd->getDbStartTime(), new DateTimeZone(date_default_timezone_get()));
$dt->setTimezone(new DateTimeZone("UTC"));
@ -571,7 +571,7 @@ if(AirtimeInstall::DbTableExists('doctrine_migration_versions') === false) {
}
}
AirtimeInstall::MigrateTablesToVersion(__DIR__, '20110829143306');
AirtimeInstall::MigrateTablesToVersion(__DIR__, '20110922153933');
AirtimeInstall::SetDefaultStreamSetting();

View File

@ -22,8 +22,7 @@ $CC_CONFIG['soundcloud-connection-wait'] = $values['soundcloud']['time_between_r
require_once($CC_CONFIG['phpDir'].'/application/configs/constants.php');
require_once($CC_CONFIG['phpDir'].'/application/configs/conf.php');
//$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
$CC_CONFIG['phpDir'] = "/home/james/src/airtime/airtime_mvc";
$CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php');
require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php');