Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
685e5e03c4
9 changed files with 86 additions and 110 deletions
|
@ -203,32 +203,6 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
public function todayInfoAction()
|
||||
{
|
||||
if (Application_Model_Preference::GetAllow3rdPartyApi()){
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$date = new Application_Model_DateHelper;
|
||||
$utcTimeNow = $date->getUtcTimestamp();
|
||||
$utctimeEnd = Application_Model_DateHelper::GetDayEndTimestampInUtc();
|
||||
|
||||
$result = array("env"=>APPLICATION_ENV,
|
||||
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
|
||||
"nextShow"=>Application_Model_Show::GetNextShows($utcTimeNow, 5, $utcTimeEnd));
|
||||
|
||||
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
|
||||
header("Content-type: text/javascript");
|
||||
echo $_GET['callback'].'('.json_encode($result).')';
|
||||
} else {
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
print 'You are not allowed to access this resource. ';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
public function weekInfoAction()
|
||||
{
|
||||
if (Application_Model_Preference::GetAllow3rdPartyApi()){
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
<?php
|
||||
|
||||
class Zend_Filter_ImageSize implements Zend_Filter_Interface {
|
||||
|
||||
public function filter($value) {
|
||||
if(!file_exists($value)) {
|
||||
if (!file_exists($value)) {
|
||||
throw new Zend_Filter_Exception('Image does not exist: ' . $value);
|
||||
}
|
||||
|
||||
$image = imageCreateFromString(file_get_contents($value));
|
||||
if(false === $image) {
|
||||
if (false === $image) {
|
||||
throw new Zend_Filter_Exception('Can\'t load image: ' . $value);
|
||||
}
|
||||
|
||||
|
@ -17,11 +16,9 @@ class Zend_Filter_ImageSize implements Zend_Filter_Interface {
|
|||
$origWidth = imagesx($image);
|
||||
$origHeight = imagesy($image);
|
||||
$ratio = max($origWidth, $origHeight) / 600;
|
||||
if($ratio < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// create a scaled down image
|
||||
if ($ratio > 1) {
|
||||
// img too big! create a scaled down image
|
||||
$newWidth = round($origWidth / $ratio);
|
||||
$newHeight = round($origHeight / $ratio);
|
||||
$resized = imagecreatetruecolor($newWidth, $newHeight);
|
||||
|
@ -29,14 +26,17 @@ class Zend_Filter_ImageSize implements Zend_Filter_Interface {
|
|||
|
||||
// determine type and store to disk
|
||||
$explodeResult = explode(".", $value);
|
||||
$type = $explodeResult[count($explodeResult) - 1];
|
||||
$type = strtolower($explodeResult[count($explodeResult) - 1]);
|
||||
$writeFunc = 'image' . $type;
|
||||
if($type == 'jpeg' || $type == 'jpg') {
|
||||
if ($type == 'jpeg' || $type == 'jpg') {
|
||||
imagejpeg($resized, $value, 100);
|
||||
} else {
|
||||
$writeFunc($resized, $value);
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1191,12 +1191,39 @@ class Application_Model_Show {
|
|||
|
||||
self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone);
|
||||
|
||||
|
||||
if ($p_interval == 'P1M'){
|
||||
/* When adding months, there is a problem if we are on January 31st and add one month with PHP.
|
||||
* What ends up happening is that since February 31st doesn't exist, the date returned is
|
||||
* March 3rd. For now let's ignore the day and assume we are always working with the
|
||||
* first of each month, and use PHP to add 1 month to this (this will take care of rolling
|
||||
* over the years 2011->2012, etc.). Then let's append the actual day, and use the php
|
||||
* checkdate() function, to see if it is valid. If not, then we'll just skip this month. */
|
||||
|
||||
$startDt = new DateTime($start, new DateTimeZone($timezone));
|
||||
|
||||
/* pass in only the year and month (not the day) */
|
||||
$dt = new DateTime($startDt->format("Y-m"), new DateTimeZone($timezone));
|
||||
|
||||
/* Keep adding 1 month, until we find the next month that contains the day
|
||||
* we are looking for (31st day for example) */
|
||||
do {
|
||||
$dt->add(new DateInterval($p_interval));
|
||||
} while(!checkdate($dt->format("m"), $startDt->format("d"), $dt->format("Y")));
|
||||
$dt->setDate($dt->format("Y"), $dt->format("m"), $startDt->format("d"));
|
||||
|
||||
$start = $dt->format("Y-m-d H:i:s");
|
||||
|
||||
$dt->setTimezone(new DateTimeZone('UTC'));
|
||||
$utcStartDateTime = $dt;
|
||||
} else {
|
||||
$dt = new DateTime($start, new DateTimeZone($timezone));
|
||||
$dt->add(new DateInterval($p_interval));
|
||||
$start = $dt->format("Y-m-d H:i:s");
|
||||
|
||||
$dt->setTimezone(new DateTimeZone('UTC'));
|
||||
$utcStartDateTime = $dt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@ $(document).ready(function(){
|
|||
|
||||
$("#combo-box").change(function(eventObject){
|
||||
var elem = $("#combo-box option:selected");
|
||||
console.log(elem);
|
||||
|
||||
setjPlayer(elem.attr("data-url"), elem.attr("data-type"), elem.attr("server-type"));
|
||||
});
|
||||
|
||||
|
|
|
@ -88,6 +88,15 @@ function adjustDateToServerDate(date, serverTimezoneOffset){
|
|||
return date;
|
||||
}
|
||||
|
||||
function pad(number, length) {
|
||||
var str = '' + number;
|
||||
while (str.length < length) {
|
||||
str = '0' + str;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function dayClick(date, allDay, jsEvent, view) {
|
||||
var now, today, selected, chosenDate, chosenTime;
|
||||
|
||||
|
@ -112,57 +121,22 @@ function dayClick(date, allDay, jsEvent, view) {
|
|||
$(span).remove();
|
||||
}
|
||||
|
||||
chosenDate = selected.getFullYear();
|
||||
// 1 hr
|
||||
var duration = 60 * 60* 1000;
|
||||
|
||||
var month = selected.getMonth() + 1;
|
||||
if(month < 10) {
|
||||
chosenDate = chosenDate+'-0'+month;
|
||||
}
|
||||
else {
|
||||
chosenDate = chosenDate+'-'+month;
|
||||
}
|
||||
var endDateTime = new Date(selected.getTime() + duration);
|
||||
|
||||
var day = selected.getDate();
|
||||
if(day < 10) {
|
||||
chosenDate = chosenDate+'-0'+day;
|
||||
}
|
||||
else {
|
||||
chosenDate = chosenDate+'-'+day;
|
||||
}
|
||||
|
||||
var min = selected.getMinutes();
|
||||
var hours = selected.getHours();
|
||||
if(min < 10){
|
||||
chosenTime = hours+":0"+min;
|
||||
}
|
||||
else {
|
||||
chosenTime = hours+":"+min;
|
||||
}
|
||||
|
||||
if(hours < 10){
|
||||
chosenTime = "0"+chosenTime;
|
||||
}
|
||||
|
||||
var endHour = hours + 1;
|
||||
var chosenEndTime;
|
||||
|
||||
if(min < 10){
|
||||
chosenEndTime = endHour+":0"+min;
|
||||
}
|
||||
else {
|
||||
chosenEndTime = endHour+":"+min;
|
||||
}
|
||||
|
||||
if(endHour < 10){
|
||||
chosenEndTime = "0"+chosenEndTime;
|
||||
}
|
||||
chosenDate = selected.getFullYear() + '-' + pad(selected.getMonth()+1,2) + '-' + pad(selected.getDate(),2);
|
||||
chosenTime = pad(selected.getHours(),2) + ':' + pad(selected.getMinutes(),2);
|
||||
var endDateFormat = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2);
|
||||
var endTimeFormat = pad(endDateTime.getHours(),2) + ':' + pad(endDateTime.getMinutes(),2);
|
||||
|
||||
$("#add_show_start_date").val(chosenDate);
|
||||
$("#add_show_end_date_no_repeat").val(chosenDate);
|
||||
$("#add_show_end_date").datepicker("option", "minDate", chosenDate);
|
||||
$("#add_show_end_date").val(chosenDate);
|
||||
$("#add_show_end_date_no_repeat").val(endDateFormat);
|
||||
$("#add_show_end_date").datepicker("option", "minDate", endDateFormat);
|
||||
$("#add_show_end_date").val(endDateFormat);
|
||||
$("#add_show_start_time").val(chosenTime);
|
||||
$("#add_show_end_time").val(chosenEndTime);
|
||||
$("#add_show_end_time").val(endTimeFormat);
|
||||
$("#add_show_duration").val('1h');
|
||||
$("#schedule-show-when").show();
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ def create_fresh_os(vm_name, update_virtualenv=False, debian=False):
|
|||
then they will most likey have a different host key, and ssh will fail, warning
|
||||
about a possible man in the middle attack.
|
||||
"""
|
||||
local("rm ~/.ssh/known_hosts")
|
||||
local("rm -f ~/.ssh/known_hosts")
|
||||
|
||||
vm_vdi_file = '%s.vdi'%vm_name
|
||||
vm_xml_file = '%s.xml'%vm_name
|
||||
|
@ -103,7 +103,7 @@ def create_fresh_os(vm_name, update_virtualenv=False, debian=False):
|
|||
local('VBoxManage snapshot %s restore fresh_install'%vm_name)
|
||||
|
||||
|
||||
local('VBoxManage modifyvm "%s" --bridgeadapter1 eth0'%vm_name)
|
||||
local('VBoxManage modifyvm "%s" --bridgeadapter1 wlan0'%vm_name)
|
||||
local('VBoxManage startvm %s'%vm_name)
|
||||
print "Please wait while attempting to acquire IP address"
|
||||
|
||||
|
|
|
@ -4,8 +4,9 @@ exec 2>&1
|
|||
|
||||
target="airtime_git_branch"
|
||||
#airtime_versions=("" "airtime_182_tar" "airtime_194_tar")
|
||||
airtime_versions=("")
|
||||
ubuntu_versions=("ubuntu_lucid_32" "ubuntu_lucid_64" "ubuntu_maverick_32" "ubuntu_maverick_64" "ubuntu_natty_32" "ubuntu_natty_64" "ubuntu_oneiric_32" "ubuntu_oneiric_64" "debian_squeeze_32" "debian_squeeze_64")
|
||||
airtime_versions=("" "airtime_182_tar" "airtime_195_tar")
|
||||
#ubuntu_versions=("ubuntu_lucid_32" "ubuntu_lucid_64" "ubuntu_maverick_32" "ubuntu_maverick_64" "ubuntu_natty_32" "ubuntu_natty_64" "ubuntu_oneiric_32" "ubuntu_oneiric_64" "debian_squeeze_32" "debian_squeeze_64")
|
||||
ubuntu_versions=("ubuntu_natty_32" "ubuntu_natty_64")
|
||||
|
||||
num1=${#ubuntu_versions[@]}
|
||||
num2=${#airtime_versions[@]}
|
||||
|
|
|
@ -10,7 +10,7 @@ class Version20111114222927 extends AbstractMigration
|
|||
public function up(Schema $schema)
|
||||
{
|
||||
$cc_show_instances = $schema->getTable('cc_show_instances');
|
||||
$cc_show_instances->addColumn('deleted_instance', 'boolean', array('notnull' => true, 'default'=> '0'));
|
||||
$cc_show_instances->addColumn('modified_instance', 'boolean', array('notnull' => true, 'default'=> '0'));
|
||||
}
|
||||
|
||||
public function down(Schema $schema)
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
getServerData();
|
||||
|
||||
function updateWidget(){
|
||||
var shows = sd.getNextShows();
|
||||
var currentShow = sd.getCurrentShow();
|
||||
var nextShows = sd.getNextShows();
|
||||
var shows = currentShow.length == 0 ? nextShows : currentShow.concat(nextShows);
|
||||
|
||||
tableString = "";
|
||||
tableString += "<h3>" + options.text.onAirToday + "</h3>";
|
||||
|
@ -50,7 +52,7 @@
|
|||
}
|
||||
|
||||
function getServerData(){
|
||||
$.ajax({ url: options.sourceDomain + "api/today-info/", dataType:"jsonp", success:function(data){
|
||||
$.ajax({ url: options.sourceDomain + "api/live-info/", dataType:"jsonp", success:function(data){
|
||||
processData(data);
|
||||
}, error:airtimeScheduleJsonpError});
|
||||
setTimeout(getServerData, options.updatePeriod*1000);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue