diff --git a/airtime_mvc/application/forms/LiveStreamingPreferences.php b/airtime_mvc/application/forms/LiveStreamingPreferences.php new file mode 100644 index 000000000..f1538e723 --- /dev/null +++ b/airtime_mvc/application/forms/LiveStreamingPreferences.php @@ -0,0 +1,43 @@ +setDecorators(array( + array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml')) + )); + + //enable Auto-enable for all shows + $auto_enable = new Zend_Form_Element_Checkbox('auto_enable_live_stream'); + $auto_enable->setLabel('Auto-enable for all shows') + ->setRequired(false) + ->setValue(Application_Model_Preference::GetLiveSteamAutoEnable()) + ->setDecorators(array('ViewHelper')); + $this->addElement($auto_enable); + + //Master username + $master_username = new Zend_Form_Element_Text('master_username'); + $master_username->setAttrib('class', 'input_text') + ->setLabel('Master Username') + ->setFilters(array('StringTrim')) + ->setValue(Application_Model_Preference::GetLiveSteamMasterUsername()) + ->setDecorators(array('ViewHelper')); + $this->addElement($master_username); + + //Master password + $master_password = new Zend_Form_Element_Text('master_password'); + $master_password->setAttrib('class', 'input_text') + ->setAttrib('autocomplete', 'off') + ->setAttrib('renderPassword', true) + ->setLabel('Master Password') + ->setFilters(array('StringTrim')) + ->setValidators(array(new ConditionalNotEmpty(array('auto_enable_live_stream'=>'1')))) + ->setValue(Application_Model_Preference::GetLiveSteamMasterUsername()) + ->setDecorators(array('ViewHelper')); + $this->addElement($master_password); + } +} \ No newline at end of file diff --git a/airtime_mvc/application/forms/Preferences.php b/airtime_mvc/application/forms/Preferences.php index b4783c591..c4b3851f3 100644 --- a/airtime_mvc/application/forms/Preferences.php +++ b/airtime_mvc/application/forms/Preferences.php @@ -14,6 +14,9 @@ class Application_Form_Preferences extends Zend_Form $general_pref = new Application_Form_GeneralPreferences(); $this->addSubForm($general_pref, 'preferences_general'); + + $livestream_pref = new Application_Form_LiveStreamingPreferences(); + $this->addSubForm($livestream_pref, 'preferences_livestream'); $soundcloud_pref = new Application_Form_SoundcloudPreferences(); $this->addSubForm($soundcloud_pref, 'preferences_soundcloud'); diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 061c694c8..11d96a6d1 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -700,6 +700,36 @@ class Application_Model_Preference return $val; } + /* + * $value should be 1 or 0 + */ + public static function SetLiveSteamAutoEnable($value){ + self::SetValue("live_stream_auto_enable", $value, false); + } + + public static function GetLiveSteamAutoEnable(){ + if(self::GetValue("live_stream_auto_enable") == Null){ + return 0; + } + return self::GetValue("live_stream_auto_enable"); + } + + public static function SetLiveSteamMasterUsername($value){ + self::SetValue("live_stream_master_username", $value, false); + } + + public static function GetLiveSteamMasterUsername(){ + return self::GetValue("live_stream_master_username"); + } + + public static function SetLiveSteamMasterPassword($value){ + self::SetValue("live_stream_master_password", $value, false); + } + + public static function GetLiveSteamMasterPassword(){ + return self::GetValue("live_stream_master_username"); + } + /* User specific preferences end */ } diff --git a/airtime_mvc/application/views/scripts/form/preferences.phtml b/airtime_mvc/application/views/scripts/form/preferences.phtml index d6d20ea00..9473b453b 100644 --- a/airtime_mvc/application/views/scripts/form/preferences.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences.phtml @@ -2,6 +2,11 @@ element->getSubform('preferences_general') ?> +

On-the-fly Live Stream Settings

+ +

SoundCloud Settings

diff --git a/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml b/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml new file mode 100644 index 000000000..8636dfcf6 --- /dev/null +++ b/airtime_mvc/application/views/scripts/form/preferences_livestream.phtml @@ -0,0 +1,47 @@ +
+
+
+ + element->getElement('auto_enable_live_stream')->hasErrors()) : ?> +
    + element->getElement('auto_enable_live_stream')->getMessages() as $error): ?> +
  • + +
+ +
+
+ +
+
+ element->getElement('master_username') ?> + element->getElement('master_username')->hasErrors()) : ?> +
    + element->getElement('master_username')->getMessages() as $error): ?> +
  • + +
+ +
+
+ +
+
+ element->getElement('master_password') ?> + element->getElement('master_password')->hasErrors()) : ?> +
    + element->getElement('master_password')->getMessages() as $error): ?> +
  • + +
+ +
+
+
diff --git a/python_apps/pypo/liquidsoap_scripts/ls_script.liq b/python_apps/pypo/liquidsoap_scripts/ls_script.liq index 42bc1e479..9154de6ba 100644 --- a/python_apps/pypo/liquidsoap_scripts/ls_script.liq +++ b/python_apps/pypo/liquidsoap_scripts/ls_script.liq @@ -38,7 +38,20 @@ server.register(namespace="streams", "connection_status", fun (s) -> begin "1:#{ default = amplify(0.00001, noise()) default = rewrite_metadata([("artist","Airtime"), ("title", "offline")],default) -s = fallback(track_sensitive=false, [queue, 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 +end + +live = input.harbor("test", port=8080, auth=auth) + +s = fallback(track_sensitive=false, [live, queue, default]) s = on_metadata(notify, s) s = crossfade(s)