Merge branch 'master' of dev.sourcefabric.org:airtime
This commit is contained in:
commit
5d0e224139
|
@ -8,30 +8,30 @@ class Application_Model_Preference
|
|||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$id = $auth->getIdentity()->id;
|
||||
|
||||
|
||||
//Check if key already exists
|
||||
$sql = "SELECT COUNT(*) FROM cc_pref"
|
||||
." WHERE keystr = '$key'";
|
||||
$result = $CC_DBC->GetOne($sql);
|
||||
|
||||
|
||||
if ($result == 1){
|
||||
$sql = "UPDATE cc_pref"
|
||||
." SET subjid = $id, valstr = '$value'"
|
||||
." WHERE keystr = '$key'";
|
||||
." WHERE keystr = '$key'";
|
||||
} else {
|
||||
$sql = "INSERT INTO cc_pref (subjid, keystr, valstr)"
|
||||
." VALUES ($id, '$key', '$value')";
|
||||
}
|
||||
return $CC_DBC->query($sql);
|
||||
}
|
||||
|
||||
|
||||
public static function GetValue($key){
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
//Check if key already exists
|
||||
$sql = "SELECT COUNT(*) FROM cc_pref"
|
||||
." WHERE keystr = '$key'";
|
||||
$result = $CC_DBC->GetOne($sql);
|
||||
|
||||
|
||||
if ($result == 0)
|
||||
return "";
|
||||
else {
|
||||
|
@ -40,9 +40,9 @@ class Application_Model_Preference
|
|||
$result = $CC_DBC->GetOne($sql);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function GetHeadTitle(){
|
||||
/* Caches the title name as a session variable so we dont access
|
||||
* the database on every page load. */
|
||||
|
@ -55,31 +55,32 @@ class Application_Model_Preference
|
|||
}
|
||||
if (strlen($title) > 0)
|
||||
$title .= " - ";
|
||||
|
||||
|
||||
return $title."Airtime";
|
||||
}
|
||||
|
||||
|
||||
public static function SetHeadTitle($title, $view){
|
||||
Application_Model_Preference::SetValue("station_name", $title);
|
||||
$defaultNamespace = new Zend_Session_Namespace('title_name');
|
||||
Application_Model_Preference::SetValue("station_name", $title);
|
||||
$defaultNamespace = new Zend_Session_Namespace('title_name');
|
||||
$defaultNamespace->title = $title;
|
||||
|
||||
RabbitMq::PushSchedule();
|
||||
|
||||
//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.
|
||||
$view->headTitle()->exchangeArray(array()); //clear headTitle ArrayObject
|
||||
$view->headTitle(Application_Model_Preference::GetHeadTitle());
|
||||
}
|
||||
|
||||
public static function SetShowsPopulatedUntil($timestamp) {
|
||||
Application_Model_Preference::SetValue("shows_populated_until", $timestamp);
|
||||
public static function SetShowsPopulatedUntil($timestamp) {
|
||||
Application_Model_Preference::SetValue("shows_populated_until", $timestamp);
|
||||
}
|
||||
|
||||
public static function GetShowsPopulatedUntil() {
|
||||
return Application_Model_Preference::GetValue("shows_populated_until");
|
||||
}
|
||||
|
||||
public static function SetDefaultFade($fade) {
|
||||
Application_Model_Preference::SetValue("default_fade", $fade);
|
||||
public static function SetDefaultFade($fade) {
|
||||
Application_Model_Preference::SetValue("default_fade", $fade);
|
||||
}
|
||||
|
||||
public static function GetDefaultFade() {
|
||||
|
@ -88,6 +89,7 @@ class Application_Model_Preference
|
|||
|
||||
public static function SetStreamLabelFormat($type){
|
||||
Application_Model_Preference::SetValue("stream_label_format", $type);
|
||||
RabbitMq::PushSchedule();
|
||||
}
|
||||
|
||||
public static function GetStreamLabelFormat(){
|
||||
|
@ -98,24 +100,24 @@ class Application_Model_Preference
|
|||
return Application_Model_Preference::getValue("station_name");
|
||||
}
|
||||
|
||||
public static function SetDoSoundCloudUpload($upload) {
|
||||
Application_Model_Preference::SetValue("soundcloud_upload", $upload);
|
||||
public static function SetDoSoundCloudUpload($upload) {
|
||||
Application_Model_Preference::SetValue("soundcloud_upload", $upload);
|
||||
}
|
||||
|
||||
public static function GetDoSoundCloudUpload() {
|
||||
return Application_Model_Preference::GetValue("soundcloud_upload");
|
||||
}
|
||||
|
||||
public static function SetSoundCloudUser($user) {
|
||||
Application_Model_Preference::SetValue("soundcloud_user", $user);
|
||||
public static function SetSoundCloudUser($user) {
|
||||
Application_Model_Preference::SetValue("soundcloud_user", $user);
|
||||
}
|
||||
|
||||
public static function GetSoundCloudUser() {
|
||||
return Application_Model_Preference::GetValue("soundcloud_user");
|
||||
}
|
||||
|
||||
public static function SetSoundCloudPassword($password) {
|
||||
Application_Model_Preference::SetValue("soundcloud_password", $password);
|
||||
public static function SetSoundCloudPassword($password) {
|
||||
Application_Model_Preference::SetValue("soundcloud_password", $password);
|
||||
}
|
||||
|
||||
public static function GetSoundCloudPassword() {
|
||||
|
|
|
@ -41,13 +41,11 @@ cache_for = 24 #how long to hold the cache, in hours
|
|||
|
||||
# Poll interval in seconds.
|
||||
#
|
||||
# This is how often the poll script downloads new schedules and files from the
|
||||
# server.
|
||||
# This will rarely need to be changed because any schedule changes are
|
||||
# automatically sent to pypo immediately.
|
||||
#
|
||||
# For production use, this number depends on whether you plan on making any
|
||||
# last-minute changes to your schedule. This number should be set to half of
|
||||
# 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.
|
||||
# This is how often the poll script downloads new schedules and files from the
|
||||
# server in the event that no changes are made to the schedule.
|
||||
#
|
||||
poll_interval = 3600 # in seconds.
|
||||
|
||||
|
|
|
@ -9,17 +9,8 @@ if os.geteuid() != 0:
|
|||
sys.exit(1)
|
||||
|
||||
try:
|
||||
print "Stopping daemontool script pypo"
|
||||
os.system("svc -dx /etc/service/pypo 1>/dev/null 2>&1")
|
||||
|
||||
if os.path.exists("/etc/service/pypo-fetch"):
|
||||
os.system("svc -dx /etc/service/pypo-fetch 1>/dev/null 2>&1")
|
||||
if os.path.exists("/etc/service/pypo-push"):
|
||||
os.system("svc -dx /etc/service/pypo-push 1>/dev/null 2>&1")
|
||||
|
||||
print "Stopping daemontool script pypo-liquidsoap"
|
||||
os.system("svc -dx /etc/service/pypo-liquidsoap 1>/dev/null 2>&1")
|
||||
os.system("killall liquidsoap")
|
||||
print "Stopping daemontool script recorder"
|
||||
os.system("svc -dx /etc/service/recorder 1>/dev/null 2>&1")
|
||||
|
||||
except Exception, e:
|
||||
print "exception:" + str(e)
|
||||
|
|
Loading…
Reference in New Issue