Skip to content

Commit

Permalink
New upstream version 3.0.0~alpha.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Robbertze committed Aug 19, 2019
1 parent a29f711 commit 7afc365
Show file tree
Hide file tree
Showing 191 changed files with 16,857 additions and 894 deletions.
17 changes: 10 additions & 7 deletions README.md
@@ -1,17 +1,20 @@
# LibreTime
![](https://github.com/LibreTime/libretime/raw/master/logo/logotype.png)

[![Build Status](https://travis-ci.org/LibreTime/libretime.svg?branch=master)](https://travis-ci.org/LibreTime/libretime)
[![Backers](https://opencollective.com/libretime/tiers/backer/badge.svg?label=backer&color=brightgreen)](https://opencollective.com/libretime)
[![Sponsors](https://opencollective.com/libretime/tiers/sponsor/badge.svg?label=sponsor&color=brightgreen)](https://opencollective.com/libretime)

LibreTime makes it easy to run your own online or terrestrial radio station. It is a community managed fork of the AirTime project.
LibreTime makes it easy to run your own online or terrestrial radio station. It
is a community managed fork of the AirTime project.

It is managed by a friendly inclusive community of stations
from around the globe that use, document and improve LibreTime.
Join us in fixing bugs and in defining how we manage the
codebase going forward.
It is managed by a friendly inclusive community of stations from around the
globe that use, document and improve LibreTime. Join us in fixing bugs and in
defining how we manage the codebase going forward.

We are currently ramping up development on this repository.

Check out the [documentation](http://libretime.org) for more information and start broadcasting!
Check out the [documentation](http://libretime.org) for more information and
start broadcasting!

Please note that LibreTime is released with a [Contributor Code
of Conduct](https://github.com/LibreTime/code-of-conduct/blob/master/CODE_OF_CONDUCT.md).
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
3.0.0-alpha.7
3.0.0-alpha.8
16 changes: 2 additions & 14 deletions Vagrantfile
Expand Up @@ -45,25 +45,13 @@ Vagrant.configure("2") do |config|
os.vm.box = "bento/ubuntu-16.04"
provision_libretime(os, "debian.sh", installer_args)
end
config.vm.define "ubuntu-trusty" do |os|
STDERR.puts 'WARNING: The "ubuntu-trusty" option is deprecated. Please migrate to "ubuntu-bionic".'
STDERR.puts
os.vm.box = "bento/ubuntu-14.04"
provision_libretime(os, "debian.sh", installer_args)
end
config.vm.define "debian-jessie" do |os|
os.vm.box = "bento/debian-8.7"
provision_libretime(os, "debian.sh", installer_args)
end
config.vm.define "debian-stretch" do |os|
os.vm.box = "bento/debian-9.6"
provision_libretime(os, "debian.sh", installer_args)
end
config.vm.define "debian-buster" do |os|
# TODO: Replace with generic/debian10 once it is released
os.vm.box = "fujimakishouten/debian-buster64"
# TODO: Remove the manual flags after buster is released
provision_libretime(os, "debian.sh", installer_args + "--distribution=debian --release=buster")
os.vm.box = "generic/debian10"
provision_libretime(os, "debian.sh", installer_args)
end
config.vm.define "centos" do |os|
os.vm.box = 'centos/7'
Expand Down
14 changes: 8 additions & 6 deletions airtime_mvc/application/common/WidgetHelper.php
Expand Up @@ -4,7 +4,7 @@

class WidgetHelper
{
public static function getWeekInfo($timezone)
public static function getWeekInfo($userDefinedTimezone)
{
//weekStart is in station time.
$weekStartDateTime = Application_Common_DateHelper::getWeekStartDateTime();
Expand All @@ -17,10 +17,12 @@ public static function getWeekInfo($timezone)

// default to the station timezone
$timezone = Application_Model_Preference::GetDefaultTimezone();
$userDefinedTimezone = strtolower($timezone);
// if the timezone defined by the user exists, use that
if (array_key_exists($userDefinedTimezone, timezone_abbreviations_list())) {
$timezone = $userDefinedTimezone;
if ($userDefinedTimezone) {
$userDefinedTimezone = strtolower($userDefinedTimezone);
// if the timezone defined by the user exists, use that
if (array_key_exists($userDefinedTimezone, timezone_abbreviations_list())) {
$timezone = $userDefinedTimezone;
}
}
$utcTimezone = new DateTimeZone("UTC");

Expand Down Expand Up @@ -170,4 +172,4 @@ public static function findAndConvertPaths(&$arr)
}
}
}
}
}
2 changes: 2 additions & 0 deletions airtime_mvc/application/configs/ACL.php
Expand Up @@ -26,6 +26,7 @@
->add(new Zend_Acl_Resource('playouthistory'))
->add(new Zend_Acl_Resource('playouthistorytemplate'))
->add(new Zend_Acl_Resource('listenerstat'))
->add(new Zend_Acl_Resource('showlistenerstat'))
->add(new Zend_Acl_Resource('usersettings'))
->add(new Zend_Acl_Resource('audiopreview'))
->add(new Zend_Acl_Resource('webstream'))
Expand Down Expand Up @@ -84,6 +85,7 @@
->allow('H', 'playlist')
->allow('H', 'playouthistory')
->allow('H', 'listenerstat')
->allow('H', 'showlistenerstat')
->allow('A', 'playouthistorytemplate')
->allow('A', 'user')
->allow('A', 'systemstatus')
Expand Down
10 changes: 9 additions & 1 deletion airtime_mvc/application/configs/navigation.php
Expand Up @@ -138,6 +138,14 @@
'action' => 'index',
'resource' => 'listenerstat'
),
array(
'label' => _('Show Listener Stats'),
'module' => 'default',
'controller' => 'listenerstat',
'action' => 'show',
'resource' => 'showlistenerstat'
),

)
);
if (LIBRETIME_ENABLE_BILLING === true) {
Expand Down Expand Up @@ -221,4 +229,4 @@
$container->id = "nav";

//store it in the registry:
Zend_Registry::set('Zend_Navigation', $container);
Zend_Registry::set('Zend_Navigation', $container);
67 changes: 65 additions & 2 deletions airtime_mvc/application/controllers/ListenerstatController.php
Expand Up @@ -26,7 +26,6 @@ public function indexAction()
$this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');

$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);

list($startsDT, $endsDT) = Application_Common_HTTPHelper::getStartEndFromRequest($request);
Expand Down Expand Up @@ -56,12 +55,76 @@ public function indexAction()
$this->view->errorStatus = $out;
$this->view->date_form = $form;
}
public function showAction() {
$CC_CONFIG = Config::getConfig();

$request = $this->getRequest();
$baseUrl = Application_Common_OsPath::getBaseDir();
$headScript = $this->view->headScript();
AirtimeTableView::injectTableJavaScriptDependencies($headScript, $baseUrl, $CC_CONFIG['airtime_version']);
Zend_Layout::getMvcInstance()->assign('parent_page', 'Analytics');
$this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/listenerstat/showlistenerstat.js?'.$CC_CONFIG['airtime_version'],'text/javascript');



$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/dataTables.colReorder.min.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'js/datatables/plugin/TableTools-2.1.5/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'css/show_analytics.css'.$CC_CONFIG['airtime_version']);

$user = Application_Model_User::getCurrentUser();
if ($user->isUserType(array(UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$this->view->showAllShows = true;
}
$data = [];
$this->view->showData = $data;

$form = new Application_Form_ShowListenerStat();

list($startsDT, $endsDT) = Application_Common_HTTPHelper::getStartEndFromRequest($request);
$userTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
$startsDT->setTimezone($userTimezone);
$endsDT->setTimezone($userTimezone);
$form->populate(array(
'his_date_start' => $startsDT->format("Y-m-d"),
'his_time_start' => $startsDT->format("H:i"),
'his_date_end' => $endsDT->format("Y-m-d"),
'his_time_end' => $endsDT->format("H:i")
));

$this->view->date_form = $form;
}

public function getDataAction(){
list($startsDT, $endsDT) = Application_Common_HTTPHelper::getStartEndFromRequest($this->getRequest());

$data = Application_Model_ListenerStat::getDataPointsWithinRange($startsDT->format(DEFAULT_TIMESTAMP_FORMAT),
$endsDT->format(DEFAULT_TIMESTAMP_FORMAT));
$this->_helper->json->sendJson($data);
}

public function getShowDataAction(){
list($startsDT, $endsDT) = Application_Common_HTTPHelper::getStartEndFromRequest($this->getRequest());
$show_id = $this->getRequest()->getParam("show_id", null);
$data = Application_Model_ListenerStat::getShowDataPointsWithinRange($startsDT->format(DEFAULT_TIMESTAMP_FORMAT),
$endsDT->format(DEFAULT_TIMESTAMP_FORMAT),$show_id);
$this->_helper->json->sendJson($data);
}
public function getAllShowData(){
list($startsDT, $endsDT) = Application_Common_HTTPHelper::getStartEndFromRequest($this->getRequest());
$data = Application_Model_ListenerStat::getAllShowDataPointsWithinRange($startsDT->format(DEFAULT_TIMESTAMP_FORMAT),
$endsDT->format(DEFAULT_TIMESTAMP_FORMAT));
return $data;
}

public function getAllShowDataAction(){
list($startsDT, $endsDT) = Application_Common_HTTPHelper::getStartEndFromRequest($this->getRequest());
$show_id = $this->getRequest()->getParam("show_id", null);
$data = Application_Model_ListenerStat::getAllShowDataPointsWithinRange($startsDT->format(DEFAULT_TIMESTAMP_FORMAT),
$endsDT->format(DEFAULT_TIMESTAMP_FORMAT));
$this->_helper->json->sendJson($data);
}
}
68 changes: 68 additions & 0 deletions airtime_mvc/application/forms/ShowListenerStat.php
@@ -0,0 +1,68 @@
<?php

class Application_Form_ShowListenerStat extends Zend_Form_SubForm
{

public function init()
{
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/daterange.phtml'))
));

// Add start date element
$startDate = new Zend_Form_Element_Text('his_date_start');
$startDate->class = 'input_text';
$startDate->setRequired(true)
->setLabel(_('Date Start:'))
->setValue(date("Y-m-d"))
->setFilters(array('StringTrim'))
->setValidators(array(
'NotEmpty',
array('date', false, array('YYYY-MM-DD'))))
->setDecorators(array('ViewHelper'));
$startDate->setAttrib('alt', 'date');
$this->addElement($startDate);

// Add start time element
$startTime = new Zend_Form_Element_Text('his_time_start');
$startTime->class = 'input_text';
$startTime->setRequired(true)
->setValue('00:00')
->setFilters(array('StringTrim'))
->setValidators(array(
'NotEmpty',
array('date', false, array('HH:mm')),
array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
$startTime->setAttrib('alt', 'time');
$this->addElement($startTime);

// Add end date element
$endDate = new Zend_Form_Element_Text('his_date_end');
$endDate->class = 'input_text';
$endDate->setRequired(true)
->setLabel(_('Date End:'))
->setValue(date("Y-m-d"))
->setFilters(array('StringTrim'))
->setValidators(array(
'NotEmpty',
array('date', false, array('YYYY-MM-DD'))))
->setDecorators(array('ViewHelper'));
$endDate->setAttrib('alt', 'date');
$this->addElement($endDate);

// Add end time element
$endTime = new Zend_Form_Element_Text('his_time_end');
$endTime->class = 'input_text';
$endTime->setRequired(true)
->setValue('01:00')
->setFilters(array('StringTrim'))
->setValidators(array(
'NotEmpty',
array('date', false, array('HH:mm')),
array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
$endTime->setAttrib('alt', 'time');
$this->addElement($endTime);
}
}
4 changes: 3 additions & 1 deletion airtime_mvc/application/forms/SmartBlockCriteria.php
Expand Up @@ -171,7 +171,9 @@ private function getSortOptions()
$this->sortOptions = array(
"random" => _("Randomly"),
"newest" => _("Newest"),
"oldest" => _("Oldest")
"oldest" => _("Oldest"),
"mostrecentplay" => ("Most recently played"),
"leastrecentplay" => ("Least recently played")
);
}
return $this->sortOptions;
Expand Down
18 changes: 8 additions & 10 deletions airtime_mvc/application/models/Block.php
Expand Up @@ -1202,7 +1202,6 @@ public function storeCriteriaIntoDb($p_criteriaData)
// that might contradict itself we group them based upon their original position on the form
$criteriaGroup = $i;
foreach ($p_criteriaData['criteria'][$critKeys[$i]] as $d) {
Logging::info($d);
$field = $d['sp_criteria_field'];
$value = $d['sp_criteria_value'];
$modifier = $d['sp_criteria_modifier'];
Expand Down Expand Up @@ -1586,7 +1585,6 @@ public function getCriteriaGrouped()
$storedCrit = array();

foreach ($out as $crit) {
Logging::info($crit);
$criteria = $crit->getDbCriteria();
$modifier = $crit->getDbModifier();
$value = $crit->getDbValue();
Expand Down Expand Up @@ -1614,8 +1612,6 @@ public function getCriteriaGrouped()
"display_modifier"=>$modifierOptions[$modifier]);
}
}

Logging::info($storedCrit);
return $storedCrit;

}
Expand Down Expand Up @@ -1730,14 +1726,9 @@ public function getListofFilesMeetCriteria($showLimit = null)
if ($spCriteria == "owner_id") {
$spCriteria = "subj.login";
}
Logging::info($i);
Logging::info($group);
Logging::info($prevgroup);
if ($i > 0 && $prevgroup == $group) {
Logging::info('adding or');
$qry->addOr($spCriteria, $spCriteriaValue, $spCriteriaModifier);
} else {
Logging::info('adding and');
$qry->addAnd($spCriteria, $spCriteriaValue, $spCriteriaModifier);
}
// only add this NOT LIKE null if you aren't also matching on another criteria
Expand All @@ -1758,6 +1749,7 @@ public function getListofFilesMeetCriteria($showLimit = null)
// check if file exists
$qry->add("file_exists", "true", Criteria::EQUAL);
$qry->add("hidden", "false", Criteria::EQUAL);

$sortTracks = 'random';
if (isset($storedCrit['sort'])) {
$sortTracks = $storedCrit['sort']['value'];
Expand All @@ -1768,6 +1760,13 @@ public function getListofFilesMeetCriteria($showLimit = null)
else if ($sortTracks == 'oldest') {
$qry->addAscendingOrderByColumn('utime');
}
// these sort additions are needed to override the default postgres NULL sort behavior
else if ($sortTracks == 'mostrecentplay') {
$qry->addDescendingOrderByColumn('(lptime IS NULL), lptime');
}
else if ($sortTracks == 'leastrecentplay') {
$qry->addAscendingOrderByColumn('(lptime IS NOT NULL), lptime');
}
else if ($sortTracks == 'random') {
$qry->addAscendingOrderByColumn('random()');
} else {
Expand Down Expand Up @@ -1812,7 +1811,6 @@ public function getListofFilesMeetCriteria($showLimit = null)

try {
$out = $qry->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find();

return array("files"=>$out, "limit"=>$limits, "repeat_tracks"=> $repeatTracks, "overflow_tracks"=> $overflowTracks, "count"=>$out->count());
} catch (Exception $e) {
Logging::info($e);
Expand Down

0 comments on commit 7afc365

Please sign in to comment.