Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
fbe9154719
7 changed files with 58 additions and 35 deletions
|
@ -8,30 +8,30 @@ class Application_Model_Preference
|
||||||
|
|
||||||
$auth = Zend_Auth::getInstance();
|
$auth = Zend_Auth::getInstance();
|
||||||
$id = $auth->getIdentity()->id;
|
$id = $auth->getIdentity()->id;
|
||||||
|
|
||||||
//Check if key already exists
|
//Check if key already exists
|
||||||
$sql = "SELECT COUNT(*) FROM cc_pref"
|
$sql = "SELECT COUNT(*) FROM cc_pref"
|
||||||
." WHERE keystr = '$key'";
|
." WHERE keystr = '$key'";
|
||||||
$result = $CC_DBC->GetOne($sql);
|
$result = $CC_DBC->GetOne($sql);
|
||||||
|
|
||||||
if ($result == 1){
|
if ($result == 1){
|
||||||
$sql = "UPDATE cc_pref"
|
$sql = "UPDATE cc_pref"
|
||||||
." SET subjid = $id, valstr = '$value'"
|
." SET subjid = $id, valstr = '$value'"
|
||||||
." WHERE keystr = '$key'";
|
." WHERE keystr = '$key'";
|
||||||
} else {
|
} else {
|
||||||
$sql = "INSERT INTO cc_pref (subjid, keystr, valstr)"
|
$sql = "INSERT INTO cc_pref (subjid, keystr, valstr)"
|
||||||
." VALUES ($id, '$key', '$value')";
|
." VALUES ($id, '$key', '$value')";
|
||||||
}
|
}
|
||||||
return $CC_DBC->query($sql);
|
return $CC_DBC->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetValue($key){
|
public static function GetValue($key){
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
//Check if key already exists
|
//Check if key already exists
|
||||||
$sql = "SELECT COUNT(*) FROM cc_pref"
|
$sql = "SELECT COUNT(*) FROM cc_pref"
|
||||||
." WHERE keystr = '$key'";
|
." WHERE keystr = '$key'";
|
||||||
$result = $CC_DBC->GetOne($sql);
|
$result = $CC_DBC->GetOne($sql);
|
||||||
|
|
||||||
if ($result == 0)
|
if ($result == 0)
|
||||||
return "";
|
return "";
|
||||||
else {
|
else {
|
||||||
|
@ -40,9 +40,9 @@ class Application_Model_Preference
|
||||||
$result = $CC_DBC->GetOne($sql);
|
$result = $CC_DBC->GetOne($sql);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetHeadTitle(){
|
public static function GetHeadTitle(){
|
||||||
/* Caches the title name as a session variable so we dont access
|
/* Caches the title name as a session variable so we dont access
|
||||||
* the database on every page load. */
|
* the database on every page load. */
|
||||||
|
@ -55,31 +55,32 @@ class Application_Model_Preference
|
||||||
}
|
}
|
||||||
if (strlen($title) > 0)
|
if (strlen($title) > 0)
|
||||||
$title .= " - ";
|
$title .= " - ";
|
||||||
|
|
||||||
return $title."Airtime";
|
return $title."Airtime";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetHeadTitle($title, $view){
|
public static function SetHeadTitle($title, $view){
|
||||||
Application_Model_Preference::SetValue("station_name", $title);
|
Application_Model_Preference::SetValue("station_name", $title);
|
||||||
$defaultNamespace = new Zend_Session_Namespace('title_name');
|
$defaultNamespace = new Zend_Session_Namespace('title_name');
|
||||||
$defaultNamespace->title = $title;
|
$defaultNamespace->title = $title;
|
||||||
|
RabbitMq::PushSchedule();
|
||||||
|
|
||||||
//set session variable to new station name so that html title is updated.
|
//set session variable to new station name so that html title is updated.
|
||||||
//should probably do this in a view helper to keep this controller as minimal as possible.
|
//should probably do this in a view helper to keep this controller as minimal as possible.
|
||||||
$view->headTitle()->exchangeArray(array()); //clear headTitle ArrayObject
|
$view->headTitle()->exchangeArray(array()); //clear headTitle ArrayObject
|
||||||
$view->headTitle(Application_Model_Preference::GetHeadTitle());
|
$view->headTitle(Application_Model_Preference::GetHeadTitle());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetShowsPopulatedUntil($timestamp) {
|
public static function SetShowsPopulatedUntil($timestamp) {
|
||||||
Application_Model_Preference::SetValue("shows_populated_until", $timestamp);
|
Application_Model_Preference::SetValue("shows_populated_until", $timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetShowsPopulatedUntil() {
|
public static function GetShowsPopulatedUntil() {
|
||||||
return Application_Model_Preference::GetValue("shows_populated_until");
|
return Application_Model_Preference::GetValue("shows_populated_until");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetDefaultFade($fade) {
|
public static function SetDefaultFade($fade) {
|
||||||
Application_Model_Preference::SetValue("default_fade", $fade);
|
Application_Model_Preference::SetValue("default_fade", $fade);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetDefaultFade() {
|
public static function GetDefaultFade() {
|
||||||
|
@ -88,6 +89,7 @@ class Application_Model_Preference
|
||||||
|
|
||||||
public static function SetStreamLabelFormat($type){
|
public static function SetStreamLabelFormat($type){
|
||||||
Application_Model_Preference::SetValue("stream_label_format", $type);
|
Application_Model_Preference::SetValue("stream_label_format", $type);
|
||||||
|
RabbitMq::PushSchedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetStreamLabelFormat(){
|
public static function GetStreamLabelFormat(){
|
||||||
|
@ -98,24 +100,24 @@ class Application_Model_Preference
|
||||||
return Application_Model_Preference::getValue("station_name");
|
return Application_Model_Preference::getValue("station_name");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetDoSoundCloudUpload($upload) {
|
public static function SetDoSoundCloudUpload($upload) {
|
||||||
Application_Model_Preference::SetValue("soundcloud_upload", $upload);
|
Application_Model_Preference::SetValue("soundcloud_upload", $upload);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetDoSoundCloudUpload() {
|
public static function GetDoSoundCloudUpload() {
|
||||||
return Application_Model_Preference::GetValue("soundcloud_upload");
|
return Application_Model_Preference::GetValue("soundcloud_upload");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetSoundCloudUser($user) {
|
public static function SetSoundCloudUser($user) {
|
||||||
Application_Model_Preference::SetValue("soundcloud_user", $user);
|
Application_Model_Preference::SetValue("soundcloud_user", $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetSoundCloudUser() {
|
public static function GetSoundCloudUser() {
|
||||||
return Application_Model_Preference::GetValue("soundcloud_user");
|
return Application_Model_Preference::GetValue("soundcloud_user");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetSoundCloudPassword($password) {
|
public static function SetSoundCloudPassword($password) {
|
||||||
Application_Model_Preference::SetValue("soundcloud_password", $password);
|
Application_Model_Preference::SetValue("soundcloud_password", $password);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetSoundCloudPassword() {
|
public static function GetSoundCloudPassword() {
|
||||||
|
|
|
@ -716,6 +716,7 @@ class Schedule {
|
||||||
$result['stream_metadata'] = array();
|
$result['stream_metadata'] = array();
|
||||||
$result['stream_metadata']['format'] = Application_Model_Preference::GetStreamLabelFormat();
|
$result['stream_metadata']['format'] = Application_Model_Preference::GetStreamLabelFormat();
|
||||||
$result['stream_metadata']['station_name'] = Application_Model_Preference::GetStationName();
|
$result['stream_metadata']['station_name'] = Application_Model_Preference::GetStationName();
|
||||||
|
$result['server_timezone'] = date_default_timezone_get();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
BIN
public/css/images/icon_rebroadcast.png
Normal file
BIN
public/css/images/icon_rebroadcast.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
BIN
public/css/images/icon_record.png
Normal file
BIN
public/css/images/icon_record.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -825,7 +825,6 @@ div.ui-datepicker {
|
||||||
#schedule_playlist_chosen li > h3 > span.ui-icon.ui-icon-triangle-1-e,
|
#schedule_playlist_chosen li > h3 > span.ui-icon.ui-icon-triangle-1-e,
|
||||||
#schedule_playlist_chosen li > h3 > span.ui-icon.ui-icon-triangle-1-s {
|
#schedule_playlist_chosen li > h3 > span.ui-icon.ui-icon-triangle-1-s {
|
||||||
float:left;
|
float:left;
|
||||||
|
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
#schedule_playlist_chosen li > h3 > span.ui-icon.ui-icon-close {
|
#schedule_playlist_chosen li > h3 > span.ui-icon.ui-icon-close {
|
||||||
|
@ -1474,9 +1473,21 @@ ul.errors li {
|
||||||
margin:-4px 3px -3px 0;
|
margin:-4px 3px -3px 0;
|
||||||
float:right;
|
float:right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.time-flow {
|
.time-flow {
|
||||||
float:right;
|
float:right;
|
||||||
margin-right:4px;
|
margin-right:4px;
|
||||||
}
|
}
|
||||||
|
.small-icon {
|
||||||
|
display:block;
|
||||||
|
width:21px;
|
||||||
|
height:10px;
|
||||||
|
float:right;
|
||||||
|
margin-left:3px;
|
||||||
|
}
|
||||||
|
.small-icon.recording {
|
||||||
|
background:url(images/icon_record.png) no-repeat 0 0;
|
||||||
|
}
|
||||||
|
.small-icon.rebroadcast {
|
||||||
|
background:url(images/icon_rebroadcast.png) no-repeat 0 0;
|
||||||
|
}
|
||||||
|
|
|
@ -41,13 +41,11 @@ cache_for = 24 #how long to hold the cache, in hours
|
||||||
|
|
||||||
# Poll interval in seconds.
|
# Poll interval in seconds.
|
||||||
#
|
#
|
||||||
# This is how often the poll script downloads new schedules and files from the
|
# This will rarely need to be changed because any schedule changes are
|
||||||
# server.
|
# automatically sent to pypo immediately.
|
||||||
#
|
#
|
||||||
# For production use, this number depends on whether you plan on making any
|
# This is how often the poll script downloads new schedules and files from the
|
||||||
# last-minute changes to your schedule. This number should be set to half of
|
# server in the event that no changes are made to the schedule.
|
||||||
# the time you expect to "lock-in" your schedule. So if your schedule is set
|
|
||||||
# 24 hours in advance, this can be set to poll every 12 hours.
|
|
||||||
#
|
#
|
||||||
poll_interval = 3600 # in seconds.
|
poll_interval = 3600 # in seconds.
|
||||||
|
|
||||||
|
|
|
@ -69,13 +69,22 @@ class PypoFetch(Thread):
|
||||||
consumer.register_callback(handle_message)
|
consumer.register_callback(handle_message)
|
||||||
consumer.consume()
|
consumer.consume()
|
||||||
|
|
||||||
logger.info("PypoFetch: init complete");
|
logger.info("PypoFetch: init complete")
|
||||||
|
|
||||||
|
|
||||||
def set_export_source(self, export_source):
|
def set_export_source(self, export_source):
|
||||||
self.export_source = export_source
|
self.export_source = export_source
|
||||||
self.cache_dir = config["cache_dir"] + self.export_source + '/'
|
self.cache_dir = config["cache_dir"] + self.export_source + '/'
|
||||||
|
|
||||||
|
def check_matching_timezones(self, server_timezone):
|
||||||
|
logger = logging.getLogger('fetch')
|
||||||
|
f = open('/etc/timezone', 'r')
|
||||||
|
pypo_timezone = f.readline().strip(' \t\n\r')
|
||||||
|
f.close()
|
||||||
|
if server_timezone != pypo_timezone:
|
||||||
|
logger.error("Server and pypo timezones do not match. Audio playback may not start when expected!")
|
||||||
|
logger.error("Server timezone: %s", server_timezone)
|
||||||
|
logger.error("Pypo timezone: %s", pypo_timezone)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Process the schedule
|
Process the schedule
|
||||||
|
@ -88,7 +97,9 @@ class PypoFetch(Thread):
|
||||||
def process_schedule(self, schedule_data, export_source):
|
def process_schedule(self, schedule_data, export_source):
|
||||||
logger = logging.getLogger('fetch')
|
logger = logging.getLogger('fetch')
|
||||||
self.schedule = schedule_data["playlists"]
|
self.schedule = schedule_data["playlists"]
|
||||||
|
|
||||||
|
self.check_matching_timezones(schedule_data["server_timezone"])
|
||||||
|
|
||||||
# Push stream metadata to liquidsoap
|
# Push stream metadata to liquidsoap
|
||||||
# TODO: THIS LIQUIDSOAP STUFF NEEDS TO BE MOVED TO PYPO-PUSH!!!
|
# TODO: THIS LIQUIDSOAP STUFF NEEDS TO BE MOVED TO PYPO-PUSH!!!
|
||||||
stream_metadata = schedule_data['stream_metadata']
|
stream_metadata = schedule_data['stream_metadata']
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue