Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
aa3bf3941b
|
@ -23,26 +23,26 @@ class Application_Model_ShowBuilder
|
|||
private $showInstances = array();
|
||||
|
||||
private $defaultRowArray = array(
|
||||
"header" => false,
|
||||
"footer" => false,
|
||||
"empty" => false,
|
||||
"allowed" => false,
|
||||
"id" => 0,
|
||||
"instance" => "",
|
||||
"starts" => "",
|
||||
"ends" => "",
|
||||
"runtime" => "",
|
||||
"title" => "",
|
||||
"creator" => "",
|
||||
"album" => "",
|
||||
"timestamp" => null,
|
||||
"cuein" => "",
|
||||
"cueout" => "",
|
||||
"fadein" => "",
|
||||
"fadeout" => "",
|
||||
"image" => false,
|
||||
"color" => "", //in hex without the '#' sign.
|
||||
"backgroundColor"=> "", //in hex without the '#' sign.
|
||||
"header" => false,
|
||||
"footer" => false,
|
||||
"empty" => false,
|
||||
"allowed" => false,
|
||||
"id" => 0,
|
||||
"instance" => "",
|
||||
"starts" => "",
|
||||
"ends" => "",
|
||||
"runtime" => "",
|
||||
"title" => "",
|
||||
"creator" => "",
|
||||
"album" => "",
|
||||
"timestamp" => null,
|
||||
"cuein" => "",
|
||||
"cueout" => "",
|
||||
"fadein" => "",
|
||||
"fadeout" => "",
|
||||
"image" => false,
|
||||
"color" => "", //in hex without the '#' sign.
|
||||
"backgroundColor" => "", //in hex without the '#' sign.
|
||||
);
|
||||
|
||||
/*
|
||||
|
@ -51,12 +51,12 @@ class Application_Model_ShowBuilder
|
|||
*/
|
||||
public function __construct($p_startDT, $p_endDT, $p_opts)
|
||||
{
|
||||
$this->startDT = $p_startDT;
|
||||
$this->endDT = $p_endDT;
|
||||
$this->timezone = date_default_timezone_get();
|
||||
$this->user = Application_Model_User::getCurrentUser();
|
||||
$this->opts = $p_opts;
|
||||
$this->epoch_now = floatval(microtime(true));
|
||||
$this->startDT = $p_startDT;
|
||||
$this->endDT = $p_endDT;
|
||||
$this->timezone = date_default_timezone_get();
|
||||
$this->user = Application_Model_User::getCurrentUser();
|
||||
$this->opts = $p_opts;
|
||||
$this->epoch_now = floatval(microtime(true));
|
||||
$this->currentShow = false;
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ class Application_Model_ShowBuilder
|
|||
|
||||
private function getItemColor($p_item, &$row)
|
||||
{
|
||||
$defaultColor = "ffffff";
|
||||
$defaultColor = "ffffff";
|
||||
$defaultBackground = "3366cc";
|
||||
|
||||
$color = $p_item["show_color"];
|
||||
|
@ -103,7 +103,7 @@ class Application_Model_ShowBuilder
|
|||
$backgroundColor = $defaultBackground;
|
||||
}
|
||||
|
||||
$row["color"] = $color;
|
||||
$row["color"] = $color;
|
||||
$row["backgroundColor"] = $backgroundColor;
|
||||
}
|
||||
|
||||
|
@ -129,6 +129,7 @@ class Application_Model_ShowBuilder
|
|||
* 0 = past
|
||||
* 1 = current
|
||||
* 2 = future
|
||||
* TODO : change all of the above to real constants -- RG
|
||||
*/
|
||||
private function getScheduledStatus($p_epochItemStart, $p_epochItemEnd, &$row)
|
||||
{
|
||||
|
@ -157,6 +158,14 @@ class Application_Model_ShowBuilder
|
|||
//item is in the future.
|
||||
else if ($this->epoch_now < $p_epochItemStart) {
|
||||
$row["scheduled"] = 2;
|
||||
} else {
|
||||
Logging::warn("No-op? is this what should happen...printing
|
||||
debug just in case");
|
||||
$d = array(
|
||||
'$p_epochItemStart' => $p_epochItemStart,
|
||||
'$p_epochItemEnd' => $p_epochItemEnd,
|
||||
'$row' => $row);
|
||||
Logging::warn($d);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,50 +250,50 @@ class Application_Model_ShowBuilder
|
|||
|
||||
$this->getItemStatus($p_item, $row);
|
||||
|
||||
$startsEpoch = floatval($schedStartDT->format("U.u"));
|
||||
$endsEpoch = floatval($schedEndDT->format("U.u"));
|
||||
$startsEpoch = floatval($schedStartDT->format("U.u"));
|
||||
$endsEpoch = floatval($schedEndDT->format("U.u"));
|
||||
$showEndEpoch = floatval($showEndDT->format("U.u"));
|
||||
|
||||
//don't want an overbooked item to stay marked as current.
|
||||
$this->getScheduledStatus($startsEpoch, min($endsEpoch, $showEndEpoch), $row);
|
||||
|
||||
$row["id"] = intval($p_item["sched_id"]);
|
||||
$row["image"] = $p_item["file_exists"];
|
||||
$row["id"] = intval($p_item["sched_id"]);
|
||||
$row["image"] = $p_item["file_exists"];
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
$row["starts"] = $schedStartDT->format("H:i:s");
|
||||
$row["ends"] = $schedEndDT->format("H:i:s");
|
||||
$row["starts"] = $schedStartDT->format("H:i:s");
|
||||
$row["ends"] = $schedEndDT->format("H:i:s");
|
||||
|
||||
$formatter = new LengthFormatter($p_item['file_length']);
|
||||
$row['runtime'] = $formatter->format();
|
||||
$formatter = new LengthFormatter($p_item['file_length']);
|
||||
$row['runtime'] = $formatter->format();
|
||||
|
||||
$row["title"] = $p_item["file_track_title"];
|
||||
$row["creator"] = $p_item["file_artist_name"];
|
||||
$row["album"] = $p_item["file_album_title"];
|
||||
$row["title"] = $p_item["file_track_title"];
|
||||
$row["creator"] = $p_item["file_artist_name"];
|
||||
$row["album"] = $p_item["file_album_title"];
|
||||
|
||||
$row["cuein"] = $p_item["cue_in"];
|
||||
$row["cueout"] = $p_item["cue_out"];
|
||||
$row["fadein"] = round(substr($p_item["fade_in"], 6), 6);
|
||||
$row["fadeout"] = round(substr($p_item["fade_out"], 6), 6);
|
||||
$row["cuein"] = $p_item["cue_in"];
|
||||
$row["cueout"] = $p_item["cue_out"];
|
||||
$row["fadein"] = round(substr($p_item["fade_in"], 6), 6);
|
||||
$row["fadeout"] = round(substr($p_item["fade_out"], 6), 6);
|
||||
|
||||
$row["pos"] = $this->pos++;
|
||||
$row["pos"] = $this->pos++;
|
||||
|
||||
$this->contentDT = $schedEndDT;
|
||||
}
|
||||
//show is empty or is a special kind of show (recording etc)
|
||||
else if (intval($p_item["si_record"]) === 1) {
|
||||
$row["record"] = true;
|
||||
$row["record"] = true;
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
|
||||
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
||||
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
|
||||
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
||||
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
|
||||
|
||||
$startsEpoch = floatval($showStartDT->format("U.u"));
|
||||
$endsEpoch = floatval($showEndDT->format("U.u"));
|
||||
$startsEpoch = floatval($showStartDT->format("U.u"));
|
||||
$endsEpoch = floatval($showEndDT->format("U.u"));
|
||||
|
||||
$this->getScheduledStatus($startsEpoch, $endsEpoch, $row);
|
||||
} else {
|
||||
$row["empty"] = true;
|
||||
$row["id"] = 0 ;
|
||||
$row["empty"] = true;
|
||||
$row["id"] = 0 ;
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
}
|
||||
|
||||
|
@ -335,6 +344,10 @@ class Application_Model_ShowBuilder
|
|||
$this->getScheduledStatus($startsEpoch, $endsEpoch, $row);
|
||||
$this->isAllowed($p_item, $row);
|
||||
|
||||
if (intval($p_item["si_record"]) === 1) {
|
||||
$row["record"] = true;
|
||||
}
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,16 +112,25 @@ var AIRTIME = (function(AIRTIME){
|
|||
};
|
||||
|
||||
mod.checkCancelButton = function() {
|
||||
var $current = $sbTable.find(".sb-current-show.sb-allowed"),
|
||||
|
||||
var $current = $sbTable.find(".sb-current-show"),
|
||||
//this user type should be refactored into a separate users module later
|
||||
//when there's more time and more JS will need to know user data.
|
||||
userType = localStorage.getItem('user-type');
|
||||
userType = localStorage.getItem('user-type'),
|
||||
canCancel = false;
|
||||
|
||||
if ($current.length !== 0 && (userType === 'A' || userType === 'P')) {
|
||||
AIRTIME.button.enableButton("icon-ban-circle", true);
|
||||
if ($current.length !== 0 && $current.hasClass("sb-allowed")) {
|
||||
canCancel = true;
|
||||
}
|
||||
else if ($current.length !== 0 && (userType === 'A' || userType === 'P')) {
|
||||
canCancel = true;
|
||||
}
|
||||
|
||||
if (canCancel === true) {
|
||||
AIRTIME.button.enableButton("icon-ban-circle", true);
|
||||
}
|
||||
else {
|
||||
AIRTIME.button.disableButton("icon-ban-circle", true);
|
||||
AIRTIME.button.disableButton("icon-ban-circle", true);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ CREATE TABLE cc_webstream (
|
|||
creator_id integer NOT NULL,
|
||||
mtime timestamp(6) without time zone NOT NULL,
|
||||
utime timestamp(6) without time zone NOT NULL,
|
||||
lptime timestamp(6) without time zone,
|
||||
mime character varying(255)
|
||||
);
|
||||
|
||||
|
@ -124,10 +125,13 @@ CREATE TABLE cc_webstream_metadata (
|
|||
|
||||
ALTER TABLE cc_files
|
||||
DROP COLUMN gunid,
|
||||
ADD COLUMN replay_gain character varying(16),
|
||||
ADD COLUMN replay_gain numeric,
|
||||
ADD COLUMN owner_id integer,
|
||||
ALTER COLUMN bpm TYPE integer using airtime_to_int(bpm) /* TYPE change - table: cc_files original: character varying(8) new: integer */;
|
||||
|
||||
ALTER TABLE cc_files
|
||||
ADD CONSTRAINT cc_files_owner_fkey FOREIGN KEY (owner_id) REFERENCES cc_subjs(id);
|
||||
|
||||
ALTER TABLE cc_playlistcontents
|
||||
ADD COLUMN block_id integer,
|
||||
ADD COLUMN stream_id integer,
|
||||
|
|
|
@ -35,23 +35,21 @@ get_include_path(),
|
|||
realpath($CC_CONFIG['phpDir'] . '/library')
|
||||
)));
|
||||
|
||||
function __autoload($classname){
|
||||
function my_autoload($classname){
|
||||
global $CC_CONFIG;
|
||||
$info = explode('_', $classname);
|
||||
if (isset($info[2])) {
|
||||
if (isset($info[1]) && isset($info[2])) {
|
||||
$filename = $info[2].".php";
|
||||
require_once($CC_CONFIG['phpDir'].'/application/models/'.$filename);
|
||||
if ($info[1] == "Model") {
|
||||
$folderName = "models";
|
||||
} else if ($info[1] == "Common") {
|
||||
$folderName = "common";
|
||||
}
|
||||
require_once($CC_CONFIG['phpDir'].'/application/'.$folderName.'/'.$filename);
|
||||
}
|
||||
}
|
||||
require_once($CC_CONFIG['phpDir'].'/application/models/User.php');
|
||||
require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php');
|
||||
require_once($CC_CONFIG['phpDir'].'/application/models/Playlist.php');
|
||||
require_once($CC_CONFIG['phpDir'].'/application/models/Schedule.php');
|
||||
require_once($CC_CONFIG['phpDir'].'/application/models/Show.php');
|
||||
require_once($CC_CONFIG['phpDir'].'/application/models/ShowInstance.php');
|
||||
require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php');
|
||||
require_once($CC_CONFIG['phpDir'].'/application/models/StreamSetting.php');
|
||||
require_once($CC_CONFIG['phpDir'].'/application/models/LiveLog.php');
|
||||
|
||||
spl_autoload_register('my_autoload');
|
||||
|
||||
require_once 'propel/runtime/lib/Propel.php';
|
||||
Propel::init($CC_CONFIG['phpDir']."/application/configs/airtime-conf-production.php");
|
||||
|
@ -64,20 +62,7 @@ if (file_exists('/usr/share/php/libzend-framework-php')){
|
|||
require_once('Zend/Loader/Autoloader.php');
|
||||
$autoloader = Zend_Loader_Autoloader::getInstance();
|
||||
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(
|
||||
array(
|
||||
'test|t' => "Keep broadcast log data\n"
|
||||
)
|
||||
);
|
||||
$opts->parse();
|
||||
}
|
||||
catch (Zend_Console_Getopt_Exception $e) {
|
||||
print $e->getMessage() .PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$infoArray = Application_Model_Preference::GetSystemInfo(true, isset($opts->t));
|
||||
$infoArray = Application_Model_Preference::GetSystemInfo(true);
|
||||
|
||||
if(Application_Model_Preference::GetSupportFeedback() == '1'){
|
||||
$url = 'http://stat.sourcefabric.org/index.php?p=airtime';
|
||||
|
|
Loading…
Reference in New Issue