public function startFrom() { $setting = $this->setting; if (Application_Model_Preference::GetPlanLevel() == 'disabled') { $output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device'); $output_sound_device->setLabel('Hardware Audio Output')->setRequired(false)->setValue($setting['output_sound_device'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper')); if (Application_Model_Preference::GetEnableStreamConf() == "false") { $output_sound_device->setAttrib("readonly", true); } $this->addElement($output_sound_device); $output_types = array("ALSA" => "ALSA", "AO" => "AO", "OSS" => "OSS", "Portaudio" => "Portaudio", "Pulseaudio" => "Pulseaudio"); $output_type = new Zend_Form_Element_Select('output_sound_device_type'); $output_type->setLabel("Output Type")->setMultiOptions($output_types)->setValue($setting['output_sound_device_type'])->setDecorators(array('ViewHelper')); if ($setting['output_sound_device'] != "true") { $output_type->setAttrib("disabled", "disabled"); } $this->addElement($output_type); } $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata'); $icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')->setRequired(false)->setValue($setting['icecast_vorbis_metadata'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper')); if (Application_Model_Preference::GetEnableStreamConf() == "false") { $icecast_vorbis_metadata->setAttrib("readonly", true); } $this->addElement($icecast_vorbis_metadata); $stream_format = new Zend_Form_Element_Radio('streamFormat'); $stream_format->setLabel('Stream Label:'); $stream_format->setMultiOptions(array("Artist - Title", "Show - Artist - Title", "Station name - Show name")); $stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat()); $stream_format->setDecorators(array('ViewHelper')); $this->addElement($stream_format); }
public function startFrom() { $setting = $this->setting; if (Application_Model_Preference::GetPlanLevel() == 'disabled') { $output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device'); $output_sound_device->setLabel(_('Hardware Audio Output'))->setRequired(false)->setValue($setting['output_sound_device'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper')); if (Application_Model_Preference::GetEnableStreamConf() == "false") { $output_sound_device->setAttrib("readonly", true); } $this->addElement($output_sound_device); $output_types = array("ALSA" => "ALSA", "AO" => "AO", "OSS" => "OSS", "Portaudio" => "Portaudio", "Pulseaudio" => "Pulseaudio"); $output_type = new Zend_Form_Element_Select('output_sound_device_type'); $output_type->setLabel(_("Output Type"))->setMultiOptions($output_types)->setValue($setting['output_sound_device_type'])->setDecorators(array('ViewHelper')); if ($setting['output_sound_device'] != "true") { $output_type->setAttrib("disabled", "disabled"); } $this->addElement($output_type); } $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata'); $icecast_vorbis_metadata->setLabel(_('Icecast Vorbis Metadata'))->setRequired(false)->setValue($setting['icecast_vorbis_metadata'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper')); if (Application_Model_Preference::GetEnableStreamConf() == "false") { $icecast_vorbis_metadata->setAttrib("readonly", true); } $this->addElement($icecast_vorbis_metadata); $stream_format = new Zend_Form_Element_Radio('streamFormat'); $stream_format->setLabel(_('Stream Label:')); $stream_format->setMultiOptions(array(_("Artist - Title"), _("Show - Artist - Title"), _("Station name - Show name"))); $stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat()); $stream_format->setDecorators(array('ViewHelper')); $this->addElement($stream_format); $offAirMeta = new Zend_Form_Element_Text('offAirMeta'); $offAirMeta->setLabel(_('Off Air Metadata'))->setValue(Application_Model_StreamSetting::getOffAirMeta())->setDecorators(array('ViewHelper')); $this->addElement($offAirMeta); $enable_replay_gain = new Zend_Form_Element_Checkbox("enableReplayGain"); $enable_replay_gain->setLabel(_("Enable Replay Gain"))->setValue(Application_Model_Preference::GetEnableReplayGain())->setDecorators(array('ViewHelper')); $this->addElement($enable_replay_gain); $replay_gain = new Zend_Form_Element_Hidden("replayGainModifier"); $replay_gain->setLabel(_("Replay Gain Modifier"))->setValue(Application_Model_Preference::getReplayGainModifier())->setAttribs(array('style' => "border: 0; color: #f6931f; font-weight: bold;"))->setDecorators(array('ViewHelper')); $this->addElement($replay_gain); }
public function init() { $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_general.phtml')))); $defaultFade = Application_Model_Preference::GetDefaultFade(); if ($defaultFade == "") { $defaultFade = '00:00:00.000000'; } //Station name $this->addElement('text', 'stationName', array('class' => 'input_text', 'label' => 'Station Name', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetValue("station_name"), 'decorators' => array('ViewHelper'))); //Default station fade $this->addElement('text', 'stationDefaultFade', array('class' => 'input_text', 'label' => 'Default Fade:', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', false, array('/^[0-2][0-3]:[0-5][0-9]:[0-5][0-9](\\.\\d{1,6})?$/', 'messages' => 'enter a time 00:00:00{.000000}'))), 'value' => $defaultFade, 'decorators' => array('ViewHelper'))); $stream_format = new Zend_Form_Element_Radio('streamFormat'); $stream_format->setLabel('Stream Label:'); $stream_format->setMultiOptions(array("Artist - Title", "Show - Artist - Title", "Station name - Show name")); $stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat()); $stream_format->setDecorators(array('ViewHelper')); $this->addElement($stream_format); $third_party_api = new Zend_Form_Element_Radio('thirdPartyApi'); $third_party_api->setLabel('Allow Remote Websites To Access "Schedule" Info?<br> (Enable this to make front-end widgets work.)'); $third_party_api->setMultiOptions(array("Disabled", "Enabled")); $third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi()); $third_party_api->setDecorators(array('ViewHelper')); $this->addElement($third_party_api); }
public function getBootstrapInfoAction() { $live_dj = Application_Model_Preference::GetSourceSwitchStatus('live_dj'); $master_dj = Application_Model_Preference::GetSourceSwitchStatus('master_dj'); $scheduled_play = Application_Model_Preference::GetSourceSwitchStatus('scheduled_play'); $res = array("live_dj" => $live_dj, "master_dj" => $master_dj, "scheduled_play" => $scheduled_play); $this->view->switch_status = $res; $this->view->station_name = Application_Model_Preference::GetStationName(); $this->view->stream_label = Application_Model_Preference::GetStreamLabelFormat(); $this->view->transition_fade = Application_Model_Preference::GetDefaultTransitionFade(); }
/** * Export the schedule in json formatted for pypo (the liquidsoap scheduler) * * @param string $p_fromDateTime * In the format "YYYY-MM-DD-HH-mm-SS" * @param string $p_toDateTime * In the format "YYYY-MM-DD-HH-mm-SS" */ public static function GetScheduledPlaylists($p_fromDateTime = null, $p_toDateTime = null) { global $CC_CONFIG, $CC_DBC; if (is_null($p_fromDateTime)) { $t1 = new DateTime(); $range_start = $t1->format("Y-m-d H:i:s"); } else { $range_start = Schedule::PypoTimeToAirtimeTime($p_fromDateTime); } if (is_null($p_fromDateTime)) { $t2 = new DateTime(); $t2->add(new DateInterval("PT24H")); $range_end = $t2->format("Y-m-d H:i:s"); } else { $range_end = Schedule::PypoTimeToAirtimeTime($p_toDateTime); } // Scheduler wants everything in a playlist $data = Schedule::GetItems($range_start, $range_end, true); $playlists = array(); if (is_array($data)) { foreach ($data as $dx) { $start = $dx['start']; //chop off subseconds $start = substr($start, 0, 19); //Start time is the array key, needs to be in the format "YYYY-MM-DD-HH-mm-ss" $pkey = Schedule::AirtimeTimeToPypoTime($start); $timestamp = strtotime($start); $playlists[$pkey]['source'] = "PLAYLIST"; $playlists[$pkey]['x_ident'] = $dx['group_id']; //$playlists[$pkey]['subtype'] = '1'; // Just needs to be between 1 and 4 inclusive $playlists[$pkey]['timestamp'] = $timestamp; $playlists[$pkey]['duration'] = $dx['clip_length']; $playlists[$pkey]['played'] = '0'; $playlists[$pkey]['schedule_id'] = $dx['group_id']; $playlists[$pkey]['show_name'] = $dx['show_name']; $playlists[$pkey]['show_start'] = Schedule::AirtimeTimeToPypoTime($dx['show_start']); $playlists[$pkey]['show_end'] = Schedule::AirtimeTimeToPypoTime($dx['show_end']); $playlists[$pkey]['user_id'] = 0; $playlists[$pkey]['id'] = $dx['group_id']; $playlists[$pkey]['start'] = Schedule::AirtimeTimeToPypoTime($dx["start"]); $playlists[$pkey]['end'] = Schedule::AirtimeTimeToPypoTime($dx["end"]); } } foreach ($playlists as &$playlist) { $scheduleGroup = new ScheduleGroup($playlist["schedule_id"]); $items = $scheduleGroup->getItems(); $medias = array(); foreach ($items as $item) { $storedFile = StoredFile::Recall($item["file_id"]); $uri = $storedFile->getFileUrl(); $starts = Schedule::AirtimeTimeToPypoTime($item["starts"]); $medias[$starts] = array('row_id' => $item["id"], 'id' => $storedFile->getGunid(), 'uri' => $uri, 'fade_in' => Schedule::WallTimeToMillisecs($item["fade_in"]), 'fade_out' => Schedule::WallTimeToMillisecs($item["fade_out"]), 'fade_cross' => 0, 'cue_in' => DateHelper::CalculateLengthInSeconds($item["cue_in"]), 'cue_out' => DateHelper::CalculateLengthInSeconds($item["cue_out"]), 'export_source' => 'scheduler', 'start' => $starts, 'end' => Schedule::AirtimeTimeToPypoTime($item["ends"])); } $playlist['medias'] = $medias; } $result = array(); $result['status'] = array('range' => array('start' => $range_start, 'end' => $range_end), 'version' => AIRTIME_REST_VERSION); $result['playlists'] = $playlists; $result['check'] = 1; $result['stream_metadata'] = array(); $result['stream_metadata']['format'] = Application_Model_Preference::GetStreamLabelFormat(); $result['stream_metadata']['station_name'] = Application_Model_Preference::GetStationName(); $result['server_timezone'] = date('O'); return $result; }