Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
89883fc6a3
8 changed files with 52 additions and 41 deletions
|
@ -909,7 +909,17 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$duration = $UTCEndDateTime->diff($UTCStartDateTime);
|
||||
|
||||
$result = $duration->format('%r%Hh %Im');
|
||||
$day = intval($duration->format('%d'));
|
||||
if($day > 0){
|
||||
$hour = intval($duration->format('%h'));
|
||||
$min = intval($duration->format('%i'));
|
||||
$hour += $day * 24;
|
||||
$hour = min($hour, 99);
|
||||
$sign = $duration->format('%r');
|
||||
$result = sprintf('%s%02dh %02dm', $sign, $hour, $min);
|
||||
}else{
|
||||
$result = $duration->format('%r%Hh %Im');
|
||||
}
|
||||
}catch (Exception $e){
|
||||
$result = "Invalid Date";
|
||||
}
|
||||
|
|
|
@ -45,7 +45,9 @@ class Application_Model_StoredFile {
|
|||
"mime" => "DbMime",
|
||||
"md5" => "DbMd5",
|
||||
"ftype" => "DbFtype",
|
||||
"language" => "DbLanguage"
|
||||
"language" => "DbLanguage",
|
||||
"filepath" => "DbFilepath",
|
||||
"directory" => "DbDirectory"
|
||||
);
|
||||
|
||||
public function __construct()
|
||||
|
@ -223,7 +225,19 @@ class Application_Model_StoredFile {
|
|||
foreach ($c['user'] as $constant => $value) {
|
||||
if (preg_match('/^MDATA_KEY/', $constant)) {
|
||||
if (isset($this->_dbMD[$value])) {
|
||||
$md[$constant] = $this->getDbColMetadataValue($value);
|
||||
if ($value == 'filepath') {
|
||||
$directoryPK = $this->getDbColMetadataValue('directory');
|
||||
if ($directoryPK == 1) {
|
||||
$musicDir = Application_Model_MusicDir::getDirByPK($directoryPK);
|
||||
$md[$constant] = $musicDir->getDirectory() . $this->getDbColMetadataValue($value);
|
||||
}
|
||||
else {
|
||||
$md[$constant] = $this->getDbColMetadataValue($value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$md[$constant] = $this->getDbColMetadataValue($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<div><span>Isrc Number:</span><span><?php echo ($this->md["MDATA_KEY_ISRC"]);?></span></div>
|
||||
<div><span>Website:</span><span><?php echo ($this->md["MDATA_KEY_URL"]);?></span></div>
|
||||
<div><span>Language:</span><span><?php echo ($this->md["MDATA_KEY_LANGUAGE"]);?></span></div>
|
||||
<div><span>File Path:</span><span><?php echo ($this->md["MDATA_KEY_FILEPATH"]);?></span></div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ function updateProgressBarValue(){
|
|||
songPercentDone = 0;
|
||||
currentSong = null;
|
||||
} else {
|
||||
if (currentSong.media_item_played == true && currentShow.length > 0){
|
||||
if (currentShow.length > 0){
|
||||
scheduled_play_line_to_switch.attr("class", "line-to-switch on");
|
||||
scheduled_play_div.addClass("ready")
|
||||
scheduled_play_source = true;
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* @copyright 2010 Sourcefabric O.P.S.
|
||||
* @license http://www.gnu.org/licenses/gpl.txt
|
||||
*/
|
||||
|
||||
require_once('DB.php');
|
||||
require_once(__DIR__.'/airtime-constants.php');
|
||||
require_once(dirname(__FILE__).'/AirtimeIni.php');
|
||||
require_once(dirname(__FILE__).'/AirtimeInstall.php');
|
||||
|
|
|
@ -15,7 +15,7 @@ class AirtimeDatabaseUpgrade{
|
|||
UpgradeCommon::MigrateTablesToVersion(__DIR__, '20120411174904');
|
||||
|
||||
$sql = "INSERT INTO cc_pref(\"keystr\", \"valstr\") VALUES('scheduled_play_switch', 'on')";
|
||||
UpgradeCommon::nonSelectQueryDb($sql);
|
||||
UpgradeCommon::queryDb($sql);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -23,6 +23,9 @@ function get_conf_location(){
|
|||
$conf_path = get_conf_location();
|
||||
require_once $conf_path;
|
||||
|
||||
set_include_path(__DIR__.'/../../../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
require_once 'propel/runtime/lib/Propel.php';
|
||||
require_once 'common/UpgradeCommon.php';
|
||||
require_once 'ConfFileUpgrade.php';
|
||||
require_once 'DbUpgrade.php';
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
<?php
|
||||
|
||||
require_once('DB.php');
|
||||
|
||||
/* These are helper functions that are common to each upgrade such as
|
||||
* creating connections to a database, backing up config files etc.
|
||||
*/
|
||||
|
@ -21,7 +18,7 @@ class UpgradeCommon{
|
|||
{
|
||||
$sql = "SELECT valstr from cc_pref WHERE keystr = 'timezone'";
|
||||
|
||||
$result = self::selectQueryDb($sql);
|
||||
$result = self::queryDb($sql);
|
||||
$timezone = $result['valstr'];
|
||||
|
||||
date_default_timezone_set($timezone);
|
||||
|
@ -29,29 +26,28 @@ class UpgradeCommon{
|
|||
|
||||
public static function connectToDatabase($p_exitOnError = true)
|
||||
{
|
||||
global $CC_DBC, $CC_CONFIG;
|
||||
$CC_DBC = DB::connect($CC_CONFIG['dsn'], FALSE);
|
||||
if (PEAR::isError($CC_DBC)) {
|
||||
echo $CC_DBC->getMessage().PHP_EOL;
|
||||
echo $CC_DBC->getUserInfo().PHP_EOL;
|
||||
try {
|
||||
$con = Propel::getConnection();
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage().PHP_EOL;
|
||||
echo "Database connection problem.".PHP_EOL;
|
||||
echo "Check if database '{$CC_CONFIG['dsn']['database']}' exists".
|
||||
" with corresponding permissions.".PHP_EOL;
|
||||
echo "Check if database exists with corresponding permissions.".PHP_EOL;
|
||||
if ($p_exitOnError) {
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static function DbTableExists($p_name)
|
||||
{
|
||||
global $CC_DBC;
|
||||
$sql = "SELECT * FROM ".$p_name;
|
||||
$result = $CC_DBC->GetOne($sql);
|
||||
if (PEAR::isError($result)) {
|
||||
$con = Propel::getConnection();
|
||||
try {
|
||||
$sql = "SELECT * FROM ".$p_name." LIMIT 1";
|
||||
$con->query($sql);
|
||||
} catch (PDOException $e){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -238,24 +234,13 @@ class UpgradeCommon{
|
|||
fclose($fp);
|
||||
}
|
||||
|
||||
public static function selectQueryDb($p_sql){
|
||||
global $CC_DBC;
|
||||
public static function queryDb($p_sql){
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$result = $CC_DBC->getRow($p_sql, $fetchmode=DB_FETCHMODE_ASSOC);
|
||||
if (PEAR::isError($result)) {
|
||||
echo "Error executing $sql. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function nonSelectQueryDb($p_sql){
|
||||
global $CC_DBC;
|
||||
|
||||
$result = $CC_DBC->query($p_sql);
|
||||
if (PEAR::isError($result)) {
|
||||
echo "Error executing $sql. Exiting.";
|
||||
try {
|
||||
$result = $con->exec($p_sql);
|
||||
} catch (Exception $e) {
|
||||
echo "Error executing $p_sql. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue