From 48bb19d758f97283d78e9b97a1abfb6b68a4ea9f Mon Sep 17 00:00:00 2001 From: James Date: Tue, 21 Feb 2012 17:58:05 -0500 Subject: [PATCH] CC-3224: "On-the-fly" stream rebroadcasting - web interface - auth script for liquidsoap - DB changes --- .../application/controllers/ApiController.php | 25 +- .../controllers/PreferenceController.php | 27 +- .../controllers/ScheduleController.php | 2 + .../application/forms/AddShowLiveStream.php | 31 ++- .../forms/LiveStreamingPreferences.php | 8 +- airtime_mvc/application/forms/Preferences.php | 3 - .../application/forms/StreamSetting.php | 3 +- .../forms/StreamSettingSubForm.php | 13 +- airtime_mvc/application/models/Preference.php | 5 +- airtime_mvc/application/models/Show.php | 22 ++ .../models/airtime/map/CcShowTableMap.php | 5 + .../models/airtime/om/BaseCcShow.php | 242 +++++++++++++++++- .../models/airtime/om/BaseCcShowPeer.php | 51 +++- .../models/airtime/om/BaseCcShowQuery.php | 115 +++++++++ .../scripts/form/add-show-live-stream.phtml | 36 ++- .../views/scripts/form/preferences.phtml | 6 - .../scripts/form/preferences_livestream.phtml | 20 +- .../scripts/preference/stream-setting.phtml | 7 +- airtime_mvc/build/schema.xml | 5 + airtime_mvc/build/sql/schema.sql | 5 + airtime_mvc/public/css/styles.css | 8 +- .../upgrades/airtime-2.0.1/api_client.cfg.201 | 28 ++ python_apps/api_clients/api_client.cfg | 23 ++ python_apps/api_clients/api_client.py | 23 ++ .../liquidsoap_scripts/liquidsoap_auth.py | 19 ++ .../pypo/liquidsoap_scripts/ls_script.liq | 19 +- 26 files changed, 650 insertions(+), 101 deletions(-) create mode 100644 python_apps/pypo/liquidsoap_scripts/liquidsoap_auth.py diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 128782ec0..6247af399 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -28,6 +28,7 @@ class ApiController extends Zend_Controller_Action ->addActionContext('update-file-system-mount', 'json') ->addActionContext('handle-watched-dir-missing', 'json') ->addActionContext('rabbitmq-do-push', 'json') + ->addActionContext('check-live-stream-auth', 'json') ->initContext(); } @@ -958,7 +959,6 @@ class ApiController extends Zend_Controller_Action Application_Model_MusicDir::removeWatchedDir($dir, false); } - /* This action is for use by our dev scripts, that make * a change to the database and we want rabbitmq to send * out a message to pypo that a potential change has been made. */ @@ -973,10 +973,31 @@ class ApiController extends Zend_Controller_Action print 'You are not allowed to access this resource.'; exit; } - Logging::log("Notifying RabbitMQ to send message to pypo"); Application_Model_RabbitMq::PushSchedule(); } + public function checkLiveStreamAuthAction(){ + global $CC_CONFIG; + + $request = $this->getRequest(); + $api_key = $request->getParam('api_key'); + + $username = $request->getParam('username'); + $password = $request->getParam('password'); + + if (!in_array($api_key, $CC_CONFIG["apiKey"])) + { + header('HTTP/1.0 401 Unauthorized'); + print 'You are not allowed to access this resource.'; + exit; + } + //check against master + if($username == Application_Model_Preference::GetLiveSteamMasterUsername() && $password == Application_Model_Preference::GetLiveSteamMasterPassword()){ + $this->view->msg = true; + }else{ + $this->view->msg = false; + } + } } diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index f9b2009a7..b15ea93ed 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -47,11 +47,6 @@ class PreferenceController extends Zend_Controller_Action Application_Model_Preference::SetSoundCloudTags($values["preferences_soundcloud"]["SoundCloudTags"]); Application_Model_Preference::SetSoundCloudGenre($values["preferences_soundcloud"]["SoundCloudGenre"]); Application_Model_Preference::SetSoundCloudTrackType($values["preferences_soundcloud"]["SoundCloudTrackType"]); - - Application_Model_Preference::SetLiveSteamAutoEnable($values["preferences_livestream"]["auto_enable_live_stream"]); - Application_Model_Preference::SetLiveSteamMasterUsername($values["preferences_livestream"]["master_username"]); - Application_Model_Preference::SetLiveSteamMasterPassword($values["preferences_livestream"]["master_password"]); - Application_Model_Preference::SetSoundCloudLicense($values["preferences_soundcloud"]["SoundCloudLicense"]); $this->view->statusMsg = "
Preferences updated.
"; @@ -180,6 +175,9 @@ class PreferenceController extends Zend_Controller_Action $form->setSetting($setting); $form->startFrom(); + + $live_stream_subform = new Application_Form_LiveStreamingPreferences(); + $form->addSubForm($live_stream_subform, "live_stream_subform"); for($i=1; $i<=$num_of_stream; $i++){ $subform = new Application_Form_StreamSettingSubForm(); @@ -194,17 +192,8 @@ class PreferenceController extends Zend_Controller_Action $post_data = $request->getPost(); $error = false; - $values = array(); - for($i=1; $i<=$num_of_stream; $i++){ - if(!$form->getSubForm("s".$i."_subform")->isValid($post_data["s".$i."_data"])){ - $error = true; - }else{ - // getValues returne array of size 1, so reorganized it - foreach($form->getSubForm("s".$i."_subform")->getValues() as $key => $d){ - $values[$key] = $d; - } - } - } + $values = $post_data; + if($form->isValid($post_data)){ if(Application_Model_Preference::GetPlanLevel() == 'disabled'){ $values['output_sound_device'] = $form->getValue('output_sound_device'); @@ -215,8 +204,6 @@ class PreferenceController extends Zend_Controller_Action $values['output_sound_device_type'] = $form->getValue('output_sound_device_type'); $values['streamFormat'] = $form->getValue('streamFormat'); - } - if(!$error){ Application_Model_StreamSetting::setStreamSetting($values); $data = array(); $data['setting'] = Application_Model_StreamSetting::getStreamSetting(); @@ -225,6 +212,10 @@ class PreferenceController extends Zend_Controller_Action } // this goes into cc_pref table Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']); + Application_Model_Preference::SetLiveSteamAutoEnable($values["auto_enable_live_stream"]); + Application_Model_Preference::SetLiveSteamMasterUsername($values["master_username"]); + Application_Model_Preference::SetLiveSteamMasterPassword($values["master_password"]); + // store stream update timestamp Application_Model_Preference::SetStreamUpdateTimestamp(); Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data); diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 430ba5bca..5fb6198fd 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -478,6 +478,8 @@ class ScheduleController extends Zend_Controller_Action $formWho->populate(array('add_show_hosts' => $hosts)); $formStyle->populate(array('add_show_background_color' => $show->getBackgroundColor(), 'add_show_color' => $show->getColor())); + + $formLive->populate($show->getLiveStreamInfo()); if(!$isSaas){ $formRecord = new Application_Form_AddShowRR(); diff --git a/airtime_mvc/application/forms/AddShowLiveStream.php b/airtime_mvc/application/forms/AddShowLiveStream.php index eeb56b9fe..8c79f5274 100644 --- a/airtime_mvc/application/forms/AddShowLiveStream.php +++ b/airtime_mvc/application/forms/AddShowLiveStream.php @@ -6,10 +6,6 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm public function init() { - $this->setDecorators(array( - array('ViewScript', array('viewScript' => 'form/add-show-live-stream.phtml')) - )); - $allow_live_stream = new Zend_Form_Element_Checkbox("allow_live_stream_override"); $allow_live_stream->setLabel("Allow Live Stream Override") ->setRequired(false) @@ -17,20 +13,20 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm $this->addElement($allow_live_stream); $description1 = "This follows the same security pattern for the shows: if no users are explicitly set for the show, then anyone with a valid airtime login can connect to the stream, otherwise if there are users assigned to the show, then only those users can connect."; - $security_setting1 = new Zend_Form_Element_Checkbox("security_setting1"); - $security_setting1->setLabel("Connect using Airtime username & password") + $cb_airtime_auth = new Zend_Form_Element_Checkbox("cb_airtime_auth"); + $cb_airtime_auth->setLabel("Connect using Airtime username & password") ->setDescription($description1) ->setRequired(false) ->setDecorators(array('ViewHelper')); - $this->addElement($security_setting1); + $this->addElement($cb_airtime_auth); $description2 = "Specifiy custom athentification which will work for only the show."; - $security_setting2 = new Zend_Form_Element_Checkbox("security_setting2"); - $security_setting2 ->setLabel("Custom") + $cb_custom_auth = new Zend_Form_Element_Checkbox("cb_custom_auth"); + $cb_custom_auth ->setLabel("Custom") ->setDescription($description2) ->setRequired(false) ->setDecorators(array('ViewHelper')); - $this->addElement($security_setting2); + $this->addElement($cb_custom_auth); //custom username $custom_username = new Zend_Form_Element_Text('custom_username'); @@ -40,8 +36,8 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm ->setLabel('Custom Username') ->setFilters(array('StringTrim')) ->setValidators(array( - new ConditionalNotEmpty(array("security_setting2"=>"1")))) - //fix//->setValue(Application_Model_Preference::GetLiveSteamMasterUsername()) + new ConditionalNotEmpty(array("cb_custom_auth"=>"1")))) + ->setValue(Application_Model_Preference::GetLiveSteamMasterUsername()) ->setDecorators(array('ViewHelper')); $this->addElement($custom_username); @@ -54,9 +50,18 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm ->setLabel('Custom Password') ->setFilters(array('StringTrim')) ->setValidators(array( - new ConditionalNotEmpty(array("security_setting2"=>"1")))) + new ConditionalNotEmpty(array("cb_custom_auth"=>"1")))) //fix//->setValue(Application_Model_Preference::GetLiveSteamMasterUsername()) ->setDecorators(array('ViewHelper')); $this->addElement($custom_password); + + // hardcoded for now + $liquidsoap_host = 'localhost'; + $liquidsoap_port = "8080"; + $liquidsoap_mount_point = "test"; + + $this->setDecorators(array( + array('ViewScript', array('viewScript' => 'form/add-show-live-stream.phtml', "connection_url"=>"http://$liquidsoap_host:$liquidsoap_port/$liquidsoap_mount_point")) + )); } } \ No newline at end of file diff --git a/airtime_mvc/application/forms/LiveStreamingPreferences.php b/airtime_mvc/application/forms/LiveStreamingPreferences.php index 9bfba6891..346dbfc5a 100644 --- a/airtime_mvc/application/forms/LiveStreamingPreferences.php +++ b/airtime_mvc/application/forms/LiveStreamingPreferences.php @@ -19,8 +19,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm //Master username $master_username = new Zend_Form_Element_Text('master_username'); - $master_username->setAttrib('class', 'input_text') - ->setAttrib('autocomplete', 'off') + $master_username->setAttrib('autocomplete', 'off') ->setAllowEmpty(true) ->setLabel('Master Username') ->setFilters(array('StringTrim')) @@ -30,14 +29,11 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm //Master password $master_password = new Zend_Form_Element_Password('master_password'); - $master_password->setAttrib('class', 'input_text') - ->setAttrib('autocomplete', 'off') + $master_password->setAttrib('autocomplete', 'off') ->setAttrib('renderPassword','true') ->setAllowEmpty(true) ->setLabel('Master Password') ->setFilters(array('StringTrim')) - ->setValue(Application_Model_Preference::GetLiveSteamMasterPassword()) - ->setDecorators(array('ViewHelper')); $this->addElement($master_password); } diff --git a/airtime_mvc/application/forms/Preferences.php b/airtime_mvc/application/forms/Preferences.php index c4b3851f3..fbabf0849 100644 --- a/airtime_mvc/application/forms/Preferences.php +++ b/airtime_mvc/application/forms/Preferences.php @@ -20,9 +20,6 @@ class Application_Form_Preferences extends Zend_Form $soundcloud_pref = new Application_Form_SoundcloudPreferences(); $this->addSubForm($soundcloud_pref, 'preferences_soundcloud'); - - /*$support_pref = new Application_Form_SupportPreferences(); - $this->addSubForm($support_pref, 'preferences_support');*/ $this->addElement('submit', 'submit', array( 'class' => 'ui-button ui-state-default right-floated', diff --git a/airtime_mvc/application/forms/StreamSetting.php b/airtime_mvc/application/forms/StreamSetting.php index 127706d48..0168c8c2a 100644 --- a/airtime_mvc/application/forms/StreamSetting.php +++ b/airtime_mvc/application/forms/StreamSetting.php @@ -80,6 +80,7 @@ class Application_Form_StreamSetting extends Zend_Form $d["streamFormat"] = $data['streamFormat']; $this->populate($d); } - return true; + $isValid = parent::isValid($data); + return $isValid; } } diff --git a/airtime_mvc/application/forms/StreamSettingSubForm.php b/airtime_mvc/application/forms/StreamSettingSubForm.php index bbda6576c..a520b8cec 100644 --- a/airtime_mvc/application/forms/StreamSettingSubForm.php +++ b/airtime_mvc/application/forms/StreamSettingSubForm.php @@ -177,20 +177,21 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{ } public function isValid ($data){ - $isValid = parent::isValid($data); - if($data['enable'] == 1){ - if($data['host'] == ''){ + $f_data = $data['s'.$this->prefix."_data"]; + $isValid = parent::isValid($f_data); + if($f_data['enable'] == 1){ + if($f_data['host'] == ''){ $element = $this->getElement("host"); $element->addError("Server cannot be empty."); $isValid = false; } - if($data['port'] == ''){ + if($f_data['port'] == ''){ $element = $this->getElement("port"); $element->addError("Port cannot be empty."); $isValid = false; } - if($data['output'] == 'icecast'){ - if($data['mount'] == ''){ + if($f_data['output'] == 'icecast'){ + if($f_data['mount'] == ''){ $element = $this->getElement("mount"); $element->addError("Mount cannot be empty with Icecast server."); $isValid = false; diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 72a191b06..94b0acc23 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -60,10 +60,10 @@ class Application_Model_Preference public static function GetValue($key, $isUserValue = false){ global $CC_CONFIG, $CC_DBC; + //Check if key already exists $sql = "SELECT COUNT(*) FROM cc_pref" ." WHERE keystr = '$key'"; - //For user specific preference, check if id matches as well if($isUserValue) { $auth = Zend_Auth::getInstance(); @@ -72,7 +72,6 @@ class Application_Model_Preference $sql .= " AND subjid = '$id'"; } } - $result = $CC_DBC->GetOne($sql); if ($result == 0) @@ -723,7 +722,7 @@ class Application_Model_Preference } public static function SetLiveSteamMasterPassword($value){ - self::SetValue("live_stream_master_password", $value, false); + self::SetValue("live_stream_master_password", md5($value), false); } public static function GetLiveSteamMasterPassword(){ diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 1bca7c7a2..47a5fcdd2 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -771,6 +771,23 @@ class Application_Model_Show { return $showInstance; } + + /** + * returns info about live stream override info + */ + public function getLiveStreamInfo(){ + $info = array(); + if($this->_showId == null){ + return $info; + }else{ + $ccShow = CcShowQuery::create()->findPK($this->_showId); + $info['custom_username'] = $ccShow->getDbLiveStreamUser(); + $info['allow_live_stream_override'] = $ccShow->getDbAllowLiveStream(); + $info['cb_airtime_auth'] = $ccShow->getDbLiveStreamUsingAirtimeAuth(); + $info['cb_custom_auth'] = $ccShow->getDbLiveStreamUsingCustomAuth(); + return $info; + } + } /* Only used for shows that are repeating. Note that this will return * true even for dates that only have a "modified" show instance (does not @@ -959,6 +976,11 @@ class Application_Model_Show { $ccShow->setDbGenre($data['add_show_genre']); $ccShow->setDbColor($data['add_show_color']); $ccShow->setDbBackgroundColor($data['add_show_background_color']); + $ccShow->setDbAllowLiveStream($data['allow_live_stream_override'] == 1?true:false); + $ccShow->setDbLiveStreamUsingAirtimeAuth($data['cb_airtime_auth'] == 1?true:false); + $ccShow->setDbLiveStreamUsingCustomAuth($data['cb_custom_auth'] == 1?true:false); + $ccShow->setDbLiveStreamUser($data['custom_username']); + $ccShow->setDbLiveStreamPass($data['custom_password']); $ccShow->save(); $showId = $ccShow->getDbId(); diff --git a/airtime_mvc/application/models/airtime/map/CcShowTableMap.php b/airtime_mvc/application/models/airtime/map/CcShowTableMap.php index b558b6e93..7ca5b8cc2 100644 --- a/airtime_mvc/application/models/airtime/map/CcShowTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcShowTableMap.php @@ -45,6 +45,11 @@ class CcShowTableMap extends TableMap { $this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null); $this->addColumn('COLOR', 'DbColor', 'VARCHAR', false, 6, null); $this->addColumn('BACKGROUND_COLOR', 'DbBackgroundColor', 'VARCHAR', false, 6, null); + $this->addColumn('ALLOW_LIVE_STREAM', 'DbAllowLiveStream', 'BOOLEAN', false, null, null); + $this->addColumn('LIVE_STREAM_USING_AIRTIME_AUTH', 'DbLiveStreamUsingAirtimeAuth', 'BOOLEAN', false, null, null); + $this->addColumn('LIVE_STREAM_USING_CUSTOM_AUTH', 'DbLiveStreamUsingCustomAuth', 'BOOLEAN', false, null, null); + $this->addColumn('LIVE_STREAM_USER', 'DbLiveStreamUser', 'VARCHAR', false, 255, null); + $this->addColumn('LIVE_STREAM_PASS', 'DbLiveStreamPass', 'VARCHAR', false, 255, null); // validators } // initialize() diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShow.php b/airtime_mvc/application/models/airtime/om/BaseCcShow.php index b2ab6b257..26b6b1d1c 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcShow.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcShow.php @@ -69,6 +69,36 @@ abstract class BaseCcShow extends BaseObject implements Persistent */ protected $background_color; + /** + * The value for the allow_live_stream field. + * @var boolean + */ + protected $allow_live_stream; + + /** + * The value for the live_stream_using_airtime_auth field. + * @var boolean + */ + protected $live_stream_using_airtime_auth; + + /** + * The value for the live_stream_using_custom_auth field. + * @var boolean + */ + protected $live_stream_using_custom_auth; + + /** + * The value for the live_stream_user field. + * @var string + */ + protected $live_stream_user; + + /** + * The value for the live_stream_pass field. + * @var string + */ + protected $live_stream_pass; + /** * @var array CcShowInstances[] Collection to store aggregation of CcShowInstances objects. */ @@ -196,6 +226,56 @@ abstract class BaseCcShow extends BaseObject implements Persistent return $this->background_color; } + /** + * Get the [allow_live_stream] column value. + * + * @return boolean + */ + public function getDbAllowLiveStream() + { + return $this->allow_live_stream; + } + + /** + * Get the [live_stream_using_airtime_auth] column value. + * + * @return boolean + */ + public function getDbLiveStreamUsingAirtimeAuth() + { + return $this->live_stream_using_airtime_auth; + } + + /** + * Get the [live_stream_using_custom_auth] column value. + * + * @return boolean + */ + public function getDbLiveStreamUsingCustomAuth() + { + return $this->live_stream_using_custom_auth; + } + + /** + * Get the [live_stream_user] column value. + * + * @return string + */ + public function getDbLiveStreamUser() + { + return $this->live_stream_user; + } + + /** + * Get the [live_stream_pass] column value. + * + * @return string + */ + public function getDbLiveStreamPass() + { + return $this->live_stream_pass; + } + /** * Set the value of [id] column. * @@ -336,6 +416,106 @@ abstract class BaseCcShow extends BaseObject implements Persistent return $this; } // setDbBackgroundColor() + /** + * Set the value of [allow_live_stream] column. + * + * @param boolean $v new value + * @return CcShow The current object (for fluent API support) + */ + public function setDbAllowLiveStream($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->allow_live_stream !== $v) { + $this->allow_live_stream = $v; + $this->modifiedColumns[] = CcShowPeer::ALLOW_LIVE_STREAM; + } + + return $this; + } // setDbAllowLiveStream() + + /** + * Set the value of [live_stream_using_airtime_auth] column. + * + * @param boolean $v new value + * @return CcShow The current object (for fluent API support) + */ + public function setDbLiveStreamUsingAirtimeAuth($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->live_stream_using_airtime_auth !== $v) { + $this->live_stream_using_airtime_auth = $v; + $this->modifiedColumns[] = CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH; + } + + return $this; + } // setDbLiveStreamUsingAirtimeAuth() + + /** + * Set the value of [live_stream_using_custom_auth] column. + * + * @param boolean $v new value + * @return CcShow The current object (for fluent API support) + */ + public function setDbLiveStreamUsingCustomAuth($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->live_stream_using_custom_auth !== $v) { + $this->live_stream_using_custom_auth = $v; + $this->modifiedColumns[] = CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH; + } + + return $this; + } // setDbLiveStreamUsingCustomAuth() + + /** + * Set the value of [live_stream_user] column. + * + * @param string $v new value + * @return CcShow The current object (for fluent API support) + */ + public function setDbLiveStreamUser($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->live_stream_user !== $v) { + $this->live_stream_user = $v; + $this->modifiedColumns[] = CcShowPeer::LIVE_STREAM_USER; + } + + return $this; + } // setDbLiveStreamUser() + + /** + * Set the value of [live_stream_pass] column. + * + * @param string $v new value + * @return CcShow The current object (for fluent API support) + */ + public function setDbLiveStreamPass($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->live_stream_pass !== $v) { + $this->live_stream_pass = $v; + $this->modifiedColumns[] = CcShowPeer::LIVE_STREAM_PASS; + } + + return $this; + } // setDbLiveStreamPass() + /** * Indicates whether the columns in this object are only set to default values. * @@ -387,6 +567,11 @@ abstract class BaseCcShow extends BaseObject implements Persistent $this->description = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null; $this->color = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; $this->background_color = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; + $this->allow_live_stream = ($row[$startcol + 7] !== null) ? (boolean) $row[$startcol + 7] : null; + $this->live_stream_using_airtime_auth = ($row[$startcol + 8] !== null) ? (boolean) $row[$startcol + 8] : null; + $this->live_stream_using_custom_auth = ($row[$startcol + 9] !== null) ? (boolean) $row[$startcol + 9] : null; + $this->live_stream_user = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; + $this->live_stream_pass = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null; $this->resetModified(); $this->setNew(false); @@ -395,7 +580,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent $this->ensureConsistency(); } - return $startcol + 7; // 7 = CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 12; // 12 = CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating CcShow object", $e); @@ -787,6 +972,21 @@ abstract class BaseCcShow extends BaseObject implements Persistent case 6: return $this->getDbBackgroundColor(); break; + case 7: + return $this->getDbAllowLiveStream(); + break; + case 8: + return $this->getDbLiveStreamUsingAirtimeAuth(); + break; + case 9: + return $this->getDbLiveStreamUsingCustomAuth(); + break; + case 10: + return $this->getDbLiveStreamUser(); + break; + case 11: + return $this->getDbLiveStreamPass(); + break; default: return null; break; @@ -817,6 +1017,11 @@ abstract class BaseCcShow extends BaseObject implements Persistent $keys[4] => $this->getDbDescription(), $keys[5] => $this->getDbColor(), $keys[6] => $this->getDbBackgroundColor(), + $keys[7] => $this->getDbAllowLiveStream(), + $keys[8] => $this->getDbLiveStreamUsingAirtimeAuth(), + $keys[9] => $this->getDbLiveStreamUsingCustomAuth(), + $keys[10] => $this->getDbLiveStreamUser(), + $keys[11] => $this->getDbLiveStreamPass(), ); return $result; } @@ -869,6 +1074,21 @@ abstract class BaseCcShow extends BaseObject implements Persistent case 6: $this->setDbBackgroundColor($value); break; + case 7: + $this->setDbAllowLiveStream($value); + break; + case 8: + $this->setDbLiveStreamUsingAirtimeAuth($value); + break; + case 9: + $this->setDbLiveStreamUsingCustomAuth($value); + break; + case 10: + $this->setDbLiveStreamUser($value); + break; + case 11: + $this->setDbLiveStreamPass($value); + break; } // switch() } @@ -900,6 +1120,11 @@ abstract class BaseCcShow extends BaseObject implements Persistent if (array_key_exists($keys[4], $arr)) $this->setDbDescription($arr[$keys[4]]); if (array_key_exists($keys[5], $arr)) $this->setDbColor($arr[$keys[5]]); if (array_key_exists($keys[6], $arr)) $this->setDbBackgroundColor($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setDbAllowLiveStream($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setDbLiveStreamUsingAirtimeAuth($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setDbLiveStreamUsingCustomAuth($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setDbLiveStreamUser($arr[$keys[10]]); + if (array_key_exists($keys[11], $arr)) $this->setDbLiveStreamPass($arr[$keys[11]]); } /** @@ -918,6 +1143,11 @@ abstract class BaseCcShow extends BaseObject implements Persistent if ($this->isColumnModified(CcShowPeer::DESCRIPTION)) $criteria->add(CcShowPeer::DESCRIPTION, $this->description); if ($this->isColumnModified(CcShowPeer::COLOR)) $criteria->add(CcShowPeer::COLOR, $this->color); if ($this->isColumnModified(CcShowPeer::BACKGROUND_COLOR)) $criteria->add(CcShowPeer::BACKGROUND_COLOR, $this->background_color); + if ($this->isColumnModified(CcShowPeer::ALLOW_LIVE_STREAM)) $criteria->add(CcShowPeer::ALLOW_LIVE_STREAM, $this->allow_live_stream); + if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH)) $criteria->add(CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH, $this->live_stream_using_airtime_auth); + if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH)) $criteria->add(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH, $this->live_stream_using_custom_auth); + if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USER)) $criteria->add(CcShowPeer::LIVE_STREAM_USER, $this->live_stream_user); + if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_PASS)) $criteria->add(CcShowPeer::LIVE_STREAM_PASS, $this->live_stream_pass); return $criteria; } @@ -985,6 +1215,11 @@ abstract class BaseCcShow extends BaseObject implements Persistent $copyObj->setDbDescription($this->description); $copyObj->setDbColor($this->color); $copyObj->setDbBackgroundColor($this->background_color); + $copyObj->setDbAllowLiveStream($this->allow_live_stream); + $copyObj->setDbLiveStreamUsingAirtimeAuth($this->live_stream_using_airtime_auth); + $copyObj->setDbLiveStreamUsingCustomAuth($this->live_stream_using_custom_auth); + $copyObj->setDbLiveStreamUser($this->live_stream_user); + $copyObj->setDbLiveStreamPass($this->live_stream_pass); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of @@ -1583,6 +1818,11 @@ abstract class BaseCcShow extends BaseObject implements Persistent $this->description = null; $this->color = null; $this->background_color = null; + $this->allow_live_stream = null; + $this->live_stream_using_airtime_auth = null; + $this->live_stream_using_custom_auth = null; + $this->live_stream_user = null; + $this->live_stream_pass = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->clearAllReferences(); diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcShowPeer.php index 110c08101..e6b4e75e3 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcShowPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcShowPeer.php @@ -26,7 +26,7 @@ abstract class BaseCcShowPeer { const TM_CLASS = 'CcShowTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 7; + const NUM_COLUMNS = 12; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -52,6 +52,21 @@ abstract class BaseCcShowPeer { /** the column name for the BACKGROUND_COLOR field */ const BACKGROUND_COLOR = 'cc_show.BACKGROUND_COLOR'; + /** the column name for the ALLOW_LIVE_STREAM field */ + const ALLOW_LIVE_STREAM = 'cc_show.ALLOW_LIVE_STREAM'; + + /** the column name for the LIVE_STREAM_USING_AIRTIME_AUTH field */ + const LIVE_STREAM_USING_AIRTIME_AUTH = 'cc_show.LIVE_STREAM_USING_AIRTIME_AUTH'; + + /** the column name for the LIVE_STREAM_USING_CUSTOM_AUTH field */ + const LIVE_STREAM_USING_CUSTOM_AUTH = 'cc_show.LIVE_STREAM_USING_CUSTOM_AUTH'; + + /** the column name for the LIVE_STREAM_USER field */ + const LIVE_STREAM_USER = 'cc_show.LIVE_STREAM_USER'; + + /** the column name for the LIVE_STREAM_PASS field */ + const LIVE_STREAM_PASS = 'cc_show.LIVE_STREAM_PASS'; + /** * An identiy map to hold any loaded instances of CcShow objects. * This must be public so that other peer classes can access this when hydrating from JOIN @@ -68,12 +83,12 @@ abstract class BaseCcShowPeer { * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbUrl', 'DbGenre', 'DbDescription', 'DbColor', 'DbBackgroundColor', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbUrl', 'dbGenre', 'dbDescription', 'dbColor', 'dbBackgroundColor', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::URL, self::GENRE, self::DESCRIPTION, self::COLOR, self::BACKGROUND_COLOR, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'URL', 'GENRE', 'DESCRIPTION', 'COLOR', 'BACKGROUND_COLOR', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'url', 'genre', 'description', 'color', 'background_color', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbUrl', 'DbGenre', 'DbDescription', 'DbColor', 'DbBackgroundColor', 'DbAllowLiveStream', 'DbLiveStreamUsingAirtimeAuth', 'DbLiveStreamUsingCustomAuth', 'DbLiveStreamUser', 'DbLiveStreamPass', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbUrl', 'dbGenre', 'dbDescription', 'dbColor', 'dbBackgroundColor', 'dbAllowLiveStream', 'dbLiveStreamUsingAirtimeAuth', 'dbLiveStreamUsingCustomAuth', 'dbLiveStreamUser', 'dbLiveStreamPass', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::URL, self::GENRE, self::DESCRIPTION, self::COLOR, self::BACKGROUND_COLOR, self::ALLOW_LIVE_STREAM, self::LIVE_STREAM_USING_AIRTIME_AUTH, self::LIVE_STREAM_USING_CUSTOM_AUTH, self::LIVE_STREAM_USER, self::LIVE_STREAM_PASS, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'URL', 'GENRE', 'DESCRIPTION', 'COLOR', 'BACKGROUND_COLOR', 'ALLOW_LIVE_STREAM', 'LIVE_STREAM_USING_AIRTIME_AUTH', 'LIVE_STREAM_USING_CUSTOM_AUTH', 'LIVE_STREAM_USER', 'LIVE_STREAM_PASS', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'url', 'genre', 'description', 'color', 'background_color', 'allow_live_stream', 'live_stream_using_airtime_auth', 'live_stream_using_custom_auth', 'live_stream_user', 'live_stream_pass', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) ); /** @@ -83,12 +98,12 @@ abstract class BaseCcShowPeer { * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbUrl' => 2, 'DbGenre' => 3, 'DbDescription' => 4, 'DbColor' => 5, 'DbBackgroundColor' => 6, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbUrl' => 2, 'dbGenre' => 3, 'dbDescription' => 4, 'dbColor' => 5, 'dbBackgroundColor' => 6, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::URL => 2, self::GENRE => 3, self::DESCRIPTION => 4, self::COLOR => 5, self::BACKGROUND_COLOR => 6, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'URL' => 2, 'GENRE' => 3, 'DESCRIPTION' => 4, 'COLOR' => 5, 'BACKGROUND_COLOR' => 6, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'url' => 2, 'genre' => 3, 'description' => 4, 'color' => 5, 'background_color' => 6, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbUrl' => 2, 'DbGenre' => 3, 'DbDescription' => 4, 'DbColor' => 5, 'DbBackgroundColor' => 6, 'DbAllowLiveStream' => 7, 'DbLiveStreamUsingAirtimeAuth' => 8, 'DbLiveStreamUsingCustomAuth' => 9, 'DbLiveStreamUser' => 10, 'DbLiveStreamPass' => 11, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbUrl' => 2, 'dbGenre' => 3, 'dbDescription' => 4, 'dbColor' => 5, 'dbBackgroundColor' => 6, 'dbAllowLiveStream' => 7, 'dbLiveStreamUsingAirtimeAuth' => 8, 'dbLiveStreamUsingCustomAuth' => 9, 'dbLiveStreamUser' => 10, 'dbLiveStreamPass' => 11, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::URL => 2, self::GENRE => 3, self::DESCRIPTION => 4, self::COLOR => 5, self::BACKGROUND_COLOR => 6, self::ALLOW_LIVE_STREAM => 7, self::LIVE_STREAM_USING_AIRTIME_AUTH => 8, self::LIVE_STREAM_USING_CUSTOM_AUTH => 9, self::LIVE_STREAM_USER => 10, self::LIVE_STREAM_PASS => 11, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'URL' => 2, 'GENRE' => 3, 'DESCRIPTION' => 4, 'COLOR' => 5, 'BACKGROUND_COLOR' => 6, 'ALLOW_LIVE_STREAM' => 7, 'LIVE_STREAM_USING_AIRTIME_AUTH' => 8, 'LIVE_STREAM_USING_CUSTOM_AUTH' => 9, 'LIVE_STREAM_USER' => 10, 'LIVE_STREAM_PASS' => 11, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'url' => 2, 'genre' => 3, 'description' => 4, 'color' => 5, 'background_color' => 6, 'allow_live_stream' => 7, 'live_stream_using_airtime_auth' => 8, 'live_stream_using_custom_auth' => 9, 'live_stream_user' => 10, 'live_stream_pass' => 11, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ) ); /** @@ -167,6 +182,11 @@ abstract class BaseCcShowPeer { $criteria->addSelectColumn(CcShowPeer::DESCRIPTION); $criteria->addSelectColumn(CcShowPeer::COLOR); $criteria->addSelectColumn(CcShowPeer::BACKGROUND_COLOR); + $criteria->addSelectColumn(CcShowPeer::ALLOW_LIVE_STREAM); + $criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH); + $criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH); + $criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_USER); + $criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_PASS); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.NAME'); @@ -175,6 +195,11 @@ abstract class BaseCcShowPeer { $criteria->addSelectColumn($alias . '.DESCRIPTION'); $criteria->addSelectColumn($alias . '.COLOR'); $criteria->addSelectColumn($alias . '.BACKGROUND_COLOR'); + $criteria->addSelectColumn($alias . '.ALLOW_LIVE_STREAM'); + $criteria->addSelectColumn($alias . '.LIVE_STREAM_USING_AIRTIME_AUTH'); + $criteria->addSelectColumn($alias . '.LIVE_STREAM_USING_CUSTOM_AUTH'); + $criteria->addSelectColumn($alias . '.LIVE_STREAM_USER'); + $criteria->addSelectColumn($alias . '.LIVE_STREAM_PASS'); } } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcShowQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcShowQuery.php index 10f9dac11..ed0b7faba 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcShowQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcShowQuery.php @@ -13,6 +13,11 @@ * @method CcShowQuery orderByDbDescription($order = Criteria::ASC) Order by the description column * @method CcShowQuery orderByDbColor($order = Criteria::ASC) Order by the color column * @method CcShowQuery orderByDbBackgroundColor($order = Criteria::ASC) Order by the background_color column + * @method CcShowQuery orderByDbAllowLiveStream($order = Criteria::ASC) Order by the allow_live_stream column + * @method CcShowQuery orderByDbLiveStreamUsingAirtimeAuth($order = Criteria::ASC) Order by the live_stream_using_airtime_auth column + * @method CcShowQuery orderByDbLiveStreamUsingCustomAuth($order = Criteria::ASC) Order by the live_stream_using_custom_auth column + * @method CcShowQuery orderByDbLiveStreamUser($order = Criteria::ASC) Order by the live_stream_user column + * @method CcShowQuery orderByDbLiveStreamPass($order = Criteria::ASC) Order by the live_stream_pass column * * @method CcShowQuery groupByDbId() Group by the id column * @method CcShowQuery groupByDbName() Group by the name column @@ -21,6 +26,11 @@ * @method CcShowQuery groupByDbDescription() Group by the description column * @method CcShowQuery groupByDbColor() Group by the color column * @method CcShowQuery groupByDbBackgroundColor() Group by the background_color column + * @method CcShowQuery groupByDbAllowLiveStream() Group by the allow_live_stream column + * @method CcShowQuery groupByDbLiveStreamUsingAirtimeAuth() Group by the live_stream_using_airtime_auth column + * @method CcShowQuery groupByDbLiveStreamUsingCustomAuth() Group by the live_stream_using_custom_auth column + * @method CcShowQuery groupByDbLiveStreamUser() Group by the live_stream_user column + * @method CcShowQuery groupByDbLiveStreamPass() Group by the live_stream_pass column * * @method CcShowQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method CcShowQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query @@ -52,6 +62,11 @@ * @method CcShow findOneByDbDescription(string $description) Return the first CcShow filtered by the description column * @method CcShow findOneByDbColor(string $color) Return the first CcShow filtered by the color column * @method CcShow findOneByDbBackgroundColor(string $background_color) Return the first CcShow filtered by the background_color column + * @method CcShow findOneByDbAllowLiveStream(boolean $allow_live_stream) Return the first CcShow filtered by the allow_live_stream column + * @method CcShow findOneByDbLiveStreamUsingAirtimeAuth(boolean $live_stream_using_airtime_auth) Return the first CcShow filtered by the live_stream_using_airtime_auth column + * @method CcShow findOneByDbLiveStreamUsingCustomAuth(boolean $live_stream_using_custom_auth) Return the first CcShow filtered by the live_stream_using_custom_auth column + * @method CcShow findOneByDbLiveStreamUser(string $live_stream_user) Return the first CcShow filtered by the live_stream_user column + * @method CcShow findOneByDbLiveStreamPass(string $live_stream_pass) Return the first CcShow filtered by the live_stream_pass column * * @method array findByDbId(int $id) Return CcShow objects filtered by the id column * @method array findByDbName(string $name) Return CcShow objects filtered by the name column @@ -60,6 +75,11 @@ * @method array findByDbDescription(string $description) Return CcShow objects filtered by the description column * @method array findByDbColor(string $color) Return CcShow objects filtered by the color column * @method array findByDbBackgroundColor(string $background_color) Return CcShow objects filtered by the background_color column + * @method array findByDbAllowLiveStream(boolean $allow_live_stream) Return CcShow objects filtered by the allow_live_stream column + * @method array findByDbLiveStreamUsingAirtimeAuth(boolean $live_stream_using_airtime_auth) Return CcShow objects filtered by the live_stream_using_airtime_auth column + * @method array findByDbLiveStreamUsingCustomAuth(boolean $live_stream_using_custom_auth) Return CcShow objects filtered by the live_stream_using_custom_auth column + * @method array findByDbLiveStreamUser(string $live_stream_user) Return CcShow objects filtered by the live_stream_user column + * @method array findByDbLiveStreamPass(string $live_stream_pass) Return CcShow objects filtered by the live_stream_pass column * * @package propel.generator.airtime.om */ @@ -318,6 +338,101 @@ abstract class BaseCcShowQuery extends ModelCriteria return $this->addUsingAlias(CcShowPeer::BACKGROUND_COLOR, $dbBackgroundColor, $comparison); } + /** + * Filter the query on the allow_live_stream column + * + * @param boolean|string $dbAllowLiveStream The value to use as filter. + * Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByDbAllowLiveStream($dbAllowLiveStream = null, $comparison = null) + { + if (is_string($dbAllowLiveStream)) { + $allow_live_stream = in_array(strtolower($dbAllowLiveStream), array('false', 'off', '-', 'no', 'n', '0')) ? false : true; + } + return $this->addUsingAlias(CcShowPeer::ALLOW_LIVE_STREAM, $dbAllowLiveStream, $comparison); + } + + /** + * Filter the query on the live_stream_using_airtime_auth column + * + * @param boolean|string $dbLiveStreamUsingAirtimeAuth The value to use as filter. + * Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByDbLiveStreamUsingAirtimeAuth($dbLiveStreamUsingAirtimeAuth = null, $comparison = null) + { + if (is_string($dbLiveStreamUsingAirtimeAuth)) { + $live_stream_using_airtime_auth = in_array(strtolower($dbLiveStreamUsingAirtimeAuth), array('false', 'off', '-', 'no', 'n', '0')) ? false : true; + } + return $this->addUsingAlias(CcShowPeer::LIVE_STREAM_USING_AIRTIME_AUTH, $dbLiveStreamUsingAirtimeAuth, $comparison); + } + + /** + * Filter the query on the live_stream_using_custom_auth column + * + * @param boolean|string $dbLiveStreamUsingCustomAuth The value to use as filter. + * Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByDbLiveStreamUsingCustomAuth($dbLiveStreamUsingCustomAuth = null, $comparison = null) + { + if (is_string($dbLiveStreamUsingCustomAuth)) { + $live_stream_using_custom_auth = in_array(strtolower($dbLiveStreamUsingCustomAuth), array('false', 'off', '-', 'no', 'n', '0')) ? false : true; + } + return $this->addUsingAlias(CcShowPeer::LIVE_STREAM_USING_CUSTOM_AUTH, $dbLiveStreamUsingCustomAuth, $comparison); + } + + /** + * Filter the query on the live_stream_user column + * + * @param string $dbLiveStreamUser The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByDbLiveStreamUser($dbLiveStreamUser = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbLiveStreamUser)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbLiveStreamUser)) { + $dbLiveStreamUser = str_replace('*', '%', $dbLiveStreamUser); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcShowPeer::LIVE_STREAM_USER, $dbLiveStreamUser, $comparison); + } + + /** + * Filter the query on the live_stream_pass column + * + * @param string $dbLiveStreamPass The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcShowQuery The current query, for fluid interface + */ + public function filterByDbLiveStreamPass($dbLiveStreamPass = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbLiveStreamPass)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbLiveStreamPass)) { + $dbLiveStreamPass = str_replace('*', '%', $dbLiveStreamPass); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcShowPeer::LIVE_STREAM_PASS, $dbLiveStreamPass, $comparison); + } + /** * Filter the query by a related CcShowInstances object * 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 3759792b7..ba96cecf8 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 @@ -8,21 +8,31 @@
element->getElement('allow_live_stream_override') ?>
-
-
+
-
- element->getElement('security_setting1') ?> +
+ element->getElement('cb_airtime_auth') ?>
-
-
+
-
- element->getElement('security_setting2') ?> +
+ element->getElement('cb_custom_auth') ?>
@@ -54,6 +64,12 @@ +
+ +
+
+ connection_url; ?> +
diff --git a/airtime_mvc/application/views/scripts/form/preferences.phtml b/airtime_mvc/application/views/scripts/form/preferences.phtml index 9473b453b..412d5aa01 100644 --- a/airtime_mvc/application/views/scripts/form/preferences.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences.phtml @@ -2,12 +2,6 @@ element->getSubform('preferences_general') ?> -

On-the-fly Live Stream Settings

- - -

SoundCloud Settings

+
num_stream;$i++){ echo $this->form->getSubform("s".$i."_subform"); @@ -77,5 +81,6 @@
- + + \ No newline at end of file diff --git a/airtime_mvc/build/schema.xml b/airtime_mvc/build/schema.xml index fc0d7284b..f9e471ec9 100644 --- a/airtime_mvc/build/schema.xml +++ b/airtime_mvc/build/schema.xml @@ -146,6 +146,11 @@ + + + + + diff --git a/airtime_mvc/build/sql/schema.sql b/airtime_mvc/build/sql/schema.sql index e3074c01c..eb31e1fb6 100644 --- a/airtime_mvc/build/sql/schema.sql +++ b/airtime_mvc/build/sql/schema.sql @@ -178,6 +178,11 @@ CREATE TABLE "cc_show" "description" VARCHAR(512), "color" VARCHAR(6), "background_color" VARCHAR(6), + "allow_live_stream" BOOLEAN, + "live_stream_using_airtime_auth" BOOLEAN, + "live_stream_using_custom_auth" BOOLEAN, + "live_stream_user" VARCHAR(255), + "live_stream_pass" VARCHAR(255), PRIMARY KEY ("id") ); diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css index a7de7fa82..4a91acfe9 100644 --- a/airtime_mvc/public/css/styles.css +++ b/airtime_mvc/public/css/styles.css @@ -1762,10 +1762,14 @@ div.errors{ .medium-icon.finishedplaying { background:url(images/icon_finishedplaying_m.png) no-repeat 0 0; } -.preferences, .manage-folders, .stream-config { +.preferences, .manage-folders { width: 500px; } +.stream-config { + width: 1080px; +} + .preferences .padded { margin-top: 5px; /* Firefox needs this */ } @@ -2096,7 +2100,7 @@ dd .info-text-small { /*width:98.5%;*/ min-width:152px; } -.stream-config .display_field dd input[type="text"], .stream-config .display_field dd textarea { +.stream-config .display_field dd input[type="text"], .stream-config .display_field dd input[type="password"], .stream-config .display_field dd textarea { min-width:99%; padding: 4px 3px; } diff --git a/install_minimal/upgrades/airtime-2.0.1/api_client.cfg.201 b/install_minimal/upgrades/airtime-2.0.1/api_client.cfg.201 index f7c63bee8..b511cf43f 100644 --- a/install_minimal/upgrades/airtime-2.0.1/api_client.cfg.201 +++ b/install_minimal/upgrades/airtime-2.0.1/api_client.cfg.201 @@ -48,6 +48,12 @@ remove_watched_dir = 'remove-watched-dir/format/json/api_key/%%api_key%%/path/%% # URL to tell Airtime we want to add watched directory set_storage_dir = 'set-storage-dir/format/json/api_key/%%api_key%%/path/%%path%%' +# URL to tell Airtime about file system mount change +update_fs_mount = 'update-file-system-mount/format/json/api_key/%%api_key%%' + +# URL to tell Airtime about file system mount change +handle_watched_dir_missing = 'handle-watched-dir-missing/format/json/api_key/%%api_key%%/dir/%%dir%%' + ############################# ## Config for Recorder ############################# @@ -95,3 +101,25 @@ get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/' #URL to update liquidsoap status update_liquidsoap_status = 'update-liquidsoap-status/format/json/api_key/%%api_key%%/msg/%%msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%' +#URL to checkl live stream auth +check_live_stream_auth = 'check-live-stream-auth/format/json/api_key/%%api_key%%/username/%%username%%/password/%%password%%' + +############## +# OBP config # +############## + +# URL to get the version number of the server API +#version_url = 'api/pypo/status/json' + +# Schedule export path. +# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm +# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm + +# Update whether an item has been played. +#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%' + +# Update whether an item is currently playing. +#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%' + +# ??? +#generate_range_url = 'api/pypo/generate_range_dp/' diff --git a/python_apps/api_clients/api_client.cfg b/python_apps/api_clients/api_client.cfg index 1e7e01edc..784385094 100644 --- a/python_apps/api_clients/api_client.cfg +++ b/python_apps/api_clients/api_client.cfg @@ -101,3 +101,26 @@ get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/' #URL to update liquidsoap status update_liquidsoap_status = 'update-liquidsoap-status/format/json/api_key/%%api_key%%/msg/%%msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%' +#URL to checkl live stream auth +check_live_stream_auth = 'check-live-stream-auth/format/json/api_key/%%api_key%%/username/%%username%%/password/%%password%%' + +############## +# OBP config # +############## + +# URL to get the version number of the server API +#version_url = 'api/pypo/status/json' + +# Schedule export path. +# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm +# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm + +# Update whether an item has been played. +#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%' + +# Update whether an item is currently playing. +#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%' + +# ??? +#generate_range_url = 'api/pypo/generate_range_dp/' + diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index 1148dcdc1..a40fe1cf1 100755 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -21,6 +21,7 @@ from urlparse import urlparse import base64 from configobj import ConfigObj import string +import hashlib AIRTIME_VERSION = "2.1.0" @@ -363,6 +364,28 @@ class AirTimeApiClient(ApiClientInterface): time.sleep(retries_wait) return response + + def check_live_stream_auth(self, username, password): + #logger = logging.getLogger() + response = '' + try: + url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["check_live_stream_auth"]) + + url = url.replace("%%api_key%%", self.config["api_key"]) + url = url.replace("%%username%%", username) + url = url.replace("%%password%%", hashlib.md5(password).hexdigest()) + + req = urllib2.Request(url) + response = urllib2.urlopen(req).read() + response = json.loads(response) + except Exception, e: + import traceback + top = traceback.format_exc() + print "Exception: %s", e + print "traceback: %s", top + response = None + + return response def setup_media_monitor(self): logger = self.logger diff --git a/python_apps/pypo/liquidsoap_scripts/liquidsoap_auth.py b/python_apps/pypo/liquidsoap_scripts/liquidsoap_auth.py new file mode 100644 index 000000000..57bf6e709 --- /dev/null +++ b/python_apps/pypo/liquidsoap_scripts/liquidsoap_auth.py @@ -0,0 +1,19 @@ +from api_clients import * +from configobj import ConfigObj +import sys +import json + +try: + config = ConfigObj('/etc/airtime/pypo.cfg') + +except Exception, e: + print 'error: ', e + sys.exit() + +api_clients = api_client.api_client_factory(config) + +username = sys.argv[1] +password = sys.argv[2] +response = api_clients.check_live_stream_auth(username, password) + +print response['msg'] \ No newline at end of file diff --git a/python_apps/pypo/liquidsoap_scripts/ls_script.liq b/python_apps/pypo/liquidsoap_scripts/ls_script.liq index 9154de6ba..8ade43327 100644 --- a/python_apps/pypo/liquidsoap_scripts/ls_script.liq +++ b/python_apps/pypo/liquidsoap_scripts/ls_script.liq @@ -41,15 +41,20 @@ default = rewrite_metadata([("artist","Airtime"), ("title", "offline")],default) #live stream setup set("harbor.bind_addr", "0.0.0.0") #auth function for live stream -def auth(user, password) = - if user == 'james' and password == 'james' then - true - else - false - end +def check_client(user,password) = + #get the output of the php script + ret = get_process_lines("python /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_auth.py #{user} #{password}") + #ret has now the value of the live client (dj1,dj2, or djx), or "ERROR"/"unknown" ... + ret = list.hd(ret) + #return true to let the client transmit data, or false to tell harbor to decline + if (ret == "True") then + true + else + false + end end -live = input.harbor("test", port=8080, auth=auth) +live = input.harbor("test", port=8080, auth=check_client) s = fallback(track_sensitive=false, [live, queue, default])