diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index df9e7de38..2958243a5 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -560,7 +560,6 @@ class ApiController extends Zend_Controller_Action $filepath = str_replace("//", "/", $filepath); $file = Application_Model_StoredFile::RecallByFilepath($filepath); - if (is_null($file)) { $file = Application_Model_StoredFile::Insert($md); } @@ -573,6 +572,7 @@ class ApiController extends Zend_Controller_Action }else{ // file marked as not exists $file->setFileExistsFlag(true); + $file->setMetadata($md); } } } diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 755cbc7f3..a0429bf17 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -744,6 +744,7 @@ class ScheduleController extends Zend_Controller_Action $show = new Application_Model_Show($data['add_show_id']); $validateStartDate = true; + $validateStartTime = true; if (!array_key_exists('add_show_start_date', $data)){ //Changing the start date was disabled, since the //array key does not exist. We need to repopulate this entry from the db. diff --git a/airtime_mvc/application/forms/AddShowLiveStream.php b/airtime_mvc/application/forms/AddShowLiveStream.php index 680de4645..36c9d6484 100644 --- a/airtime_mvc/application/forms/AddShowLiveStream.php +++ b/airtime_mvc/application/forms/AddShowLiveStream.php @@ -6,7 +6,6 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm public function init() { - $description1 = "This follows the same security pattern for the shows: only users assigned to the show can connect."; $cb_airtime_auth = new Zend_Form_Element_Checkbox("cb_airtime_auth"); $cb_airtime_auth->setLabel("Use Airtime Authentication:") ->setDescription($description1) @@ -14,7 +13,6 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm ->setDecorators(array('ViewHelper')); $this->addElement($cb_airtime_auth); - $description2 = "Specify custom authentication which will work only for this show."; $cb_custom_auth = new Zend_Form_Element_Checkbox("cb_custom_auth"); $cb_custom_auth ->setLabel("Use Custom Authentication:") ->setDescription($description2) @@ -74,4 +72,4 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm } return $isValid; } -} \ No newline at end of file +} diff --git a/airtime_mvc/application/forms/AddShowWhen.php b/airtime_mvc/application/forms/AddShowWhen.php index 0b7da6155..e05e7a1a5 100644 --- a/airtime_mvc/application/forms/AddShowWhen.php +++ b/airtime_mvc/application/forms/AddShowWhen.php @@ -67,19 +67,19 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm // Add duration element $this->addElement('text', 'add_show_duration', array( - 'label' => 'Duration:', + 'label' => 'Duration:', 'class' => 'input_text', - 'value' => '01h 00m', - 'readonly' => true, + 'value' => '01h 00m', + 'readonly' => true, 'decorators' => array('ViewHelper') )); - // Add repeats element - $this->addElement('checkbox', 'add_show_repeats', array( + // Add repeats element + $this->addElement('checkbox', 'add_show_repeats', array( 'label' => 'Repeats?', 'required' => false, - 'decorators' => array('ViewHelper') - )); + 'decorators' => array('ViewHelper') + )); } @@ -92,21 +92,25 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm $nowDateTime = new DateTime(); $showStartDateTime = new DateTime($start_time); - if ($validateStartDate){ - if($showStartDateTime->getTimestamp() < $nowDateTime->getTimestamp()) { - $this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past')); - $valid = false; - } - } - + if ($validateStartDate){ + if($showStartDateTime->getTimestamp() < $nowDateTime->getTimestamp()) { + $this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past')); + $valid = false; + } + } + + $hours = intval(substr($formData["add_show_duration"], 0, strpos($formData["add_show_duration"], 'h'))); + $minutes = intval(substr($formData["add_show_duration"], -3, -1)); if( $formData["add_show_duration"] == "00h 00m" ) { $this->getElement('add_show_duration')->setErrors(array('Cannot have duration 00h 00m')); $valid = false; - }elseif(strpos($formData["add_show_duration"], 'h') !== false && intval(substr($formData["add_show_duration"], 0, strpos($formData["add_show_duration"], 'h'))) > 24) { - $this->getElement('add_show_duration')->setErrors(array('Cannot have duration greater than 24h')); - $valid = false; + }elseif(strpos($formData["add_show_duration"], 'h') !== false && $hours >= 24) { + if ($hours > 24 || ($hours == 24 && $minutes > 0)) { + $this->getElement('add_show_duration')->setErrors(array('Cannot have duration greater than 24h')); + $valid = false; + } }elseif( strstr($formData["add_show_duration"], '-') ){ - $this->getElement('add_show_duration')->setErrors(array('Cannot have duration < 0m')); + $this->getElement('add_show_duration')->setErrors(array('Cannot have duration < 0m')); $valid = false; } diff --git a/airtime_mvc/application/forms/LiveStreamingPreferences.php b/airtime_mvc/application/forms/LiveStreamingPreferences.php index b922bc8fe..2933ab554 100644 --- a/airtime_mvc/application/forms/LiveStreamingPreferences.php +++ b/airtime_mvc/application/forms/LiveStreamingPreferences.php @@ -5,6 +5,10 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm public function init() { + global $CC_CONFIG; + $isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1; + $isStreamConfigable = Application_Model_Preference::GetEnableStreamConf() == "true"; + $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true; $defaultFade = Application_Model_Preference::GetDefaultTransitionFade(); if($defaultFade == ""){ @@ -32,7 +36,12 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm $this->addElement($master_username); //Master password - $master_password = new Zend_Form_Element_Password('master_password'); + if($isDemo){ + $master_password = new Zend_Form_Element_Text('master_password'); + }else{ + $master_password = new Zend_Form_Element_Password('master_password'); + $master_password->setAttrib('renderPassword','true'); + } $master_password->setAttrib('autocomplete', 'off') ->setAttrib('renderPassword','true') ->setAllowEmpty(true) @@ -81,15 +90,29 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm ->setDecorators(array('ViewHelper')); $this->addElement($live_dj_mount); } + // demo only code + if(!$isStreamConfigable){ + $elements = $this->getElements(); + foreach ($elements as $element) + { + if ($element->getType() != 'Zend_Form_Element_Hidden') + { + $element->setAttrib("disabled", "disabled"); + } + } + } } public function updateVariables(){ + global $CC_CONFIG; + $m_port = Application_Model_StreamSetting::GetMasterLiveSteamPort(); $m_mount = Application_Model_StreamSetting::GetMasterLiveSteamMountPoint(); $l_port = Application_Model_StreamSetting::GetDJLiveSteamPort(); $l_mount = Application_Model_StreamSetting::GetDJLiveSteamMountPoint(); $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true; - + $isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1; + $master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL(); $live_dj_connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL(); @@ -102,9 +125,9 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm if($l_port=="" || $l_mount==""){ $live_dj_connection_url = "N/A"; } - + $this->setDecorators(array( - array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml', 'master_dj_connection_url'=>$master_dj_connection_url, 'live_dj_connection_url'=>$live_dj_connection_url, 'isSaas' => $isSaas)) + array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml', 'master_dj_connection_url'=>$master_dj_connection_url, 'live_dj_connection_url'=>$live_dj_connection_url, 'isSaas' => $isSaas, 'isDemo' => $isDemo)) )); } diff --git a/airtime_mvc/application/forms/StreamSetting.php b/airtime_mvc/application/forms/StreamSetting.php index 0168c8c2a..f8d9e6bb0 100644 --- a/airtime_mvc/application/forms/StreamSetting.php +++ b/airtime_mvc/application/forms/StreamSetting.php @@ -37,17 +37,7 @@ class Application_Form_StreamSetting extends Zend_Form } $this->addElement($output_type); } - - # tooltip - $description = 'This option enables metadata for OGG streams (stream - metadata is the track title, artist, and show name that is - displayed in an audio player). VLC and mplayer have a - serious bug when playing an OGG/VORBIS stream that has - metadata information enabled: they will disconnect from the - stream after every song. If you are using an OGG stream and - your listeners do not require support for these audio - players, then feel free to enable this option.'; - + $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata'); $icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata') ->setDescription($description) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 57c505713..5486e6aa2 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1782,6 +1782,7 @@ class Application_Model_Show { "end_timestamp"=>$rows[$i-1]['end_timestamp'], "starts"=>$rows[$i-1]['starts'], "ends"=>$rows[$i-1]['ends'], + "record"=>$rows[$i-1]['record'], "type"=>"show"); } @@ -1797,6 +1798,7 @@ class Application_Model_Show { "end_timestamp"=>$rows[$i+1]['end_timestamp'], "starts"=>$rows[$i+1]['starts'], "ends"=>$rows[$i+1]['ends'], + "record"=>$rows[$i+1]['record'], "type"=>"show"); } @@ -1817,6 +1819,7 @@ class Application_Model_Show { "end_timestamp"=>$rows[$i]['end_timestamp'], "starts"=>$rows[$i]['starts'], "ends"=>$rows[$i]['ends'], + "record"=>$rows[$i]['record'], "type"=>"show"); break; } @@ -1832,6 +1835,7 @@ class Application_Model_Show { "end_timestamp"=>$rows[$previousShowIndex]['end_timestamp'], "starts"=>$rows[$previousShowIndex]['starts'], "ends"=>$rows[$previousShowIndex]['ends'], + "record"=>$rows[$previousShowIndex]['record'], "type"=>"show"); } diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index ab911c19c..8d612e721 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -855,7 +855,6 @@ Logging::log("getting media! - 2"); Logging::log('copyFileToStor: moving file '.$audio_file); $md5 = md5_file($audio_file); $duplicate = Application_Model_StoredFile::RecallByMd5($md5, true); - $result = null; if ($duplicate) { @@ -886,14 +885,22 @@ Logging::log("getting media! - 2"); Logging::log("Warning: couldn't change permissions of $audio_file to 0644"); } - //Martin K.: changed to rename: Much less load + quicker since this is an atomic operation - $r = @rename($audio_file, $audio_stor); + // Check if file is playable + $command = sprintf("/usr/bin/airtime-liquidsoap -c 'output.dummy(audio_to_stereo(single(\"%s\")))' > /dev/null 2>&1", $audio_file); + exec($command, $output, $rv); + if ($rv != 0) { + $result = array("code" => 110, "message" => "This file appears to be corrupted and could not be uploaded."); + } + else { + //Martin K.: changed to rename: Much less load + quicker since this is an atomic operation + $r = @rename($audio_file, $audio_stor); - if ($r === false) { - #something went wrong likely there wasn't enough space in the audio_stor to move the file too. - #warn the user that the file wasn't uploaded and they should check if there is enough disk space. - unlink($audio_file);//remove the file from the organize after failed rename - $result = array("code" => 108, "message" => "The file was not uploaded, this error will occur if the computer hard drive does not have enough disk space."); + if ($r === false) { + #something went wrong likely there wasn't enough space in the audio_stor to move the file too. + #warn the user that the file wasn't uploaded and they should check if there is enough disk space. + unlink($audio_file);//remove the file from the organize after failed rename + $result = array("code" => 108, "message" => "The file was not uploaded, this error will occur if the computer hard drive does not have enough disk space."); + } } } } diff --git a/airtime_mvc/application/views/scripts/form/add-show-live-stream.phtml b/airtime_mvc/application/views/scripts/form/add-show-live-stream.phtml index 6028cf399..86272f3ce 100644 --- a/airtime_mvc/application/views/scripts/form/add-show-live-stream.phtml +++ b/airtime_mvc/application/views/scripts/form/add-show-live-stream.phtml @@ -3,11 +3,7 @@
@@ -16,11 +12,7 @@
diff --git a/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml b/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml index 428af66fd..8449c9e2b 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml @@ -79,7 +79,7 @@
master_dj_connection_url ?> - isSaas ){?> + isSaas && !$this->isDemo){?> override  
@@ -122,7 +122,7 @@
live_dj_connection_url ?> - isSaas ){?> + isSaas && !$this->isDemo ){?> override  
diff --git a/airtime_mvc/application/views/scripts/form/register-dialog.phtml b/airtime_mvc/application/views/scripts/form/register-dialog.phtml index 8faeb5913..ba204baca 100644 --- a/airtime_mvc/application/views/scripts/form/register-dialog.phtml +++ b/airtime_mvc/application/views/scripts/form/register-dialog.phtml @@ -3,8 +3,12 @@
- Help Airtime improve by letting us know you are using it. This info - will be collected regularly in order to improve your user experience. + Help Airtime improve by letting us know how you are using it. This info + will be collected regularly in order to improve your user experience. +

+ In additon to that, this is how you vote for existing features. We actively remove + features that are not used, so be sure to click "Yes, help Airtime" to keep + your favourite features around.