Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Martin Konecny 2013-01-08 12:37:53 -05:00
commit c632ad00f9
26 changed files with 2835 additions and 2539 deletions

View file

@ -34,13 +34,7 @@ $front->registerPlugin(new RabbitMqPlugin());
//localization configuration
$codeset = 'UTF-8';
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$id = $auth->getIdentity()->id;
$lang = Application_Model_Preference::GetCurrentUserLocale($id).'.'.$codeset;
} else {
$lang = Application_Model_Preference::GetLocale().'.'.$codeset;
}
$lang = Application_Model_Preference::GetLocale().'.'.$codeset;
putenv("LC_ALL=$lang");
putenv("LANG=$lang");

View file

@ -195,6 +195,7 @@ class LibraryController extends Zend_Controller_Action
} elseif ($type === "playlist" || $type === "block") {
if ($type === 'playlist') {
$obj = new Application_Model_Playlist($id);
$menu["duplicate"] = array("name" => _("Duplicate Playlist"), "icon" => "edit", "url" => $baseUrl."/library/duplicate");
} elseif ($type === 'block') {
$obj = new Application_Model_Block($id);
if (!$obj->isStatic()) {
@ -216,7 +217,6 @@ class LibraryController extends Zend_Controller_Action
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
$menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."/library/delete");
}
$menu["duplicate"] = array("name" => _("Duplicate Playlist"), "icon" => "edit", "url" => $baseUrl."/library/duplicate");
} elseif ($type == "stream") {
$webstream = CcWebstreamQuery::create()->findPK($id);
$obj = new Application_Model_Webstream($webstream);

View file

@ -44,7 +44,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view);
Application_Model_Preference::SetDefaultFade($values["stationDefaultFade"]);
Application_Model_Preference::SetAllow3rdPartyApi($values["thirdPartyApi"]);
Application_Model_Preference::SetLocale($values["locale"]);
Application_Model_Preference::SetDefaultLocale($values["locale"]);
Application_Model_Preference::SetTimezone($values["timezone"]);
Application_Model_Preference::SetWeekStartDay($values["weekStartDay"]);
@ -284,6 +284,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_StreamSetting::setMasterLiveStreamMountPoint($values["master_harbor_input_mount_point"]);
Application_Model_StreamSetting::setDjLiveStreamPort($values["dj_harbor_input_port"]);
Application_Model_StreamSetting::setDjLiveStreamMountPoint($values["dj_harbor_input_mount_point"]);
Application_Model_StreamSetting::setOffAirMeta($values['offAirMeta']);
// store stream update timestamp
Application_Model_Preference::SetStreamUpdateTimestamp();

View file

@ -98,7 +98,7 @@ class Application_Form_EditUser extends Zend_Form
$this->addElement($jabber);
$locale = new Zend_Form_Element_Select("cu_locale");
$locale->setLabel(_("Language"));
$locale->setLabel(_("Language:"));
$locale->setMultiOptions(Application_Model_Locale::getLocales());
$locale->setValue(Application_Model_Preference::GetUserLocale($currentUser->getId()));
$locale->setDecorators(array('ViewHelper'));

View file

@ -51,11 +51,11 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
$third_party_api->setDecorators(array('ViewHelper'));
$this->addElement($third_party_api);
$locale = new Zend_Form_Element_Select("locale");
$locale->setLabel(_("Language"));
$locale->setLabel(_("Default Interface Language"));
$locale->setMultiOptions(Application_Model_Locale::getLocales());
$locale->setValue(Application_Model_Preference::GetLocale());
$locale->setValue(Application_Model_Preference::GetDefaultLocale());
$locale->setDecorators(array('ViewHelper'));
$this->addElement($locale);

View file

@ -59,6 +59,12 @@ class Application_Form_StreamSetting extends Zend_Form
$stream_format->setDecorators(array('ViewHelper'));
$this->addElement($stream_format);
$offAirMeta = new Zend_Form_Element_Text('offAirMeta');
$offAirMeta->setLabel(_('Off Air Meatadata'))
->setValue(Application_Model_StreamSetting::getOffAirMeta())
->setDecorators(array('ViewHelper'));
$this->addElement($offAirMeta);
$replay_gain = new Zend_Form_Element_Hidden("replayGainModifier");
$replay_gain->setLabel(_("Replay Gain Modifier"))
->setValue(Application_Model_Preference::getReplayGainModifier())

View file

@ -395,8 +395,10 @@ SQL;
$entry["id"] = $obj->getDbId();
$entry["pos"] = $pos;
$entry["cliplength"] = $obj->getDbLength();
$entry["cuein"] = $obj->getDbCuein();
$entry["cueout"] = $obj->getDbCueout();
if ($obj instanceof CcFiles && $obj) {
$entry["cuein"] = $obj->getDbCuein();
$entry["cueout"] = $obj->getDbCueout();
}
$entry["ftype"] = $objType;
}

View file

@ -446,17 +446,17 @@ class Application_Model_Preference
}
// This is the language setting on preferences page
public static function SetLocale($locale)
public static function SetDefaultLocale($locale)
{
self::setValue("locale", $locale);
}
public static function GetLocale()
public static function GetDefaultLocale()
{
return self::getValue("locale");
}
public static function GetCurrentUserLocale($id)
public static function GetUserLocale($id)
{
return self::getValue("user_".$id."_locale", true);
}
@ -466,14 +466,20 @@ class Application_Model_Preference
// When a new user is created they will get the default locale
// setting which the admin sets on preferences page
if (is_null($locale)) {
$locale = self::GetLocale();
$locale = self::GetDefaultLocale();
}
self::setValue("user_".$userId."_locale", $locale, true, $userId);
}
public static function GetUserLocale($userId)
public static function GetLocale()
{
return self::getValue("user_".$userId."_locale");
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$id = $auth->getIdentity()->id;
return self::GetUserLocale($id);
} else {
return self::GetDefaultLocale();
}
}
public static function SetStationLogo($imagePath)

View file

@ -1801,6 +1801,8 @@ SQL;
$options["show_empty"] = (array_key_exists($show['instance_id'],
$content_count)) ? 0 : 1;
$options["show_partial_filled"] = $showInstance->showPartialFilled();
$events[] = &self::makeFullCalendarEvent($show, $options,
$startsDT, $endsDT, $startsEpochStr, $endsEpochStr);

View file

@ -687,6 +687,22 @@ SQL;
}
public function showPartialFilled()
{
$sql = <<<SQL
SELECT time_filled > '00:00:00'
AND time_filled < ends - starts
AND file_id IS null AS partial_filled
FROM cc_show_instances
WHERE id = :instance_id
SQL;
$res = Application_Common_Database::prepareAndExecute($sql,
array(':instance_id' => $this->_instanceId), 'all');
return $res[0]["partial_filled"];
}
public function showEmpty()
{
$sql = <<<SQL

View file

@ -201,6 +201,13 @@ class Application_Model_StreamSetting
"value"=>self::getDjLiveStreamMountPoint(),
"type"=>"string");
}
$sql = "SELECT *"
." FROM cc_pref"
." WHERE keystr = 'off_air_meta'";
$out = $con->query($sql)->fetchAll();
$rows[] = array("keyname" => $out[0]["keystr"], "value"=>$out[0]["valstr"], "type"=>"string");
return $rows;
}
@ -449,4 +456,12 @@ class Application_Model_StreamSetting
public static function setAdminPass($stream, $v){
self::setValue($stream."_admin_pass", $v, "string");
}
public static function getOffAirMeta(){
return self::getValue("off_air_meta");
}
public static function setOffAirMeta($offAirMeta){
self::setValue("off_air_meta", $offAirMeta, "string");
}
}

View file

@ -67,8 +67,8 @@
</dd>
<dt id="timezone-label" class="block-display">
<label class="required" for="timezone"><?php echo $this->element->getElement('timezone')->getLabel() ?>
<span class="info-text-small"><?php _("(Required)") ?></span> :
<label class="required" for="timezone"><?php echo $this->element->getElement('timezone')->getLabel() ?>:
<span class="info-text-small"><?php _("(Required)") ?></span>
</label>
</dt>
<dd id="timezone-element" class="block-display">

View file

@ -63,6 +63,14 @@
</ul>
<?php endif; ?>
</dd>
<dt id="offAirMeta-label">
<label>
<?php echo $this->form->getElement('offAirMeta')->getLabel() ?> :
</label>
</dt>
<dd id="offAirMeta-element">
<?php echo $this->form->getElement('offAirMeta') ?>
</dd>
<dt id="replayGainModifier-label" class="block-display">
<label><?php echo $this->form->getElement('replayGainModifier')->getLabel() ?>:
</label>

View file

@ -1,4 +1,7 @@
INSERT INTO cc_subjs ("login", "type", "pass") VALUES ('admin', 'A', md5('admin'));
-- added in 2.3
INSERT INTO cc_pref("keystr", "valstr") VALUES('off_air_meta', 'Airtime - offline');
-- end of added in 2.3
-- added in 2.1
INSERT INTO cc_pref("keystr", "valstr") VALUES('scheduled_play_switch', 'on');

File diff suppressed because it is too large Load diff

View file

@ -1981,6 +1981,9 @@ span.errors.sp-errors{
.small-icon.show-empty {
background:url(images/icon_alert_cal_alt.png) no-repeat 0 0;
}
.small-icon.show-partial-filled {
background:url(images/icon_alert_cal_alt.png) no-repeat 0 0;
}
.medium-icon {
display:block;
width:25px;

View file

@ -1051,6 +1051,9 @@ function addQtipToSCIcons(){
my: "left top",
viewport: $(window)
},
style: {
classes: "ui-tooltip-dark file-md-long"
},
show: {
ready: true // Needed to make it show on first mouseover
// event
@ -1080,6 +1083,9 @@ function addQtipToSCIcons(){
my: "left top",
viewport: $(window)
},
style: {
classes: "ui-tooltip-dark file-md-long"
},
show: {
ready: true // Needed to make it show on first mouseover
// event
@ -1109,6 +1115,9 @@ function addQtipToSCIcons(){
my: "left top",
viewport: $(window)
},
style: {
classes: "ui-tooltip-dark file-md-long"
},
show: {
ready: true // Needed to make it show on first mouseover
// event

View file

@ -257,13 +257,21 @@ function eventRender(event, element, view) {
if (event.show_empty === 1 && event.record === 0 && event.rebroadcast === 0) {
$(element)
.find(".fc-event-time")
.before('<span id="'+event.id+'" title="'+$.i18n._("Show is empty")+'" class="small-icon show-empty"></span>');
.before('<span id="'+event.id+'" class="small-icon show-empty"></span>');
} else if (event.show_partial_filled === true) {
$(element)
.find(".fc-event-time")
.before('<span id="'+event.id+'" class="small-icon show-partial-filled"></span>');
}
} else if (view.name === 'month') {
if (event.show_empty === 1 && event.record === 0 && event.rebroadcast === 0) {
$(element)
.find(".fc-event-title")
.after('<span id="'+event.id+'" title="'+$.i18n._("Show is empty")+'" class="small-icon show-empty"></span>');
} else if (event.show_partial_filled === true) {
$(element)
.find(".fc-event-title")
.after('<span id="'+event.id+'" title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>');
}
}
@ -280,7 +288,7 @@ function eventRender(event, element, view) {
function eventAfterRender( event, element, view ) {
$(element).find(".small-icon").live('mouseover',function(){
addQtipToSCIcons($(this));
addQtipsToIcons($(this));
});
}
@ -398,7 +406,8 @@ function getCurrentShow(){
});
}
function addQtipToSCIcons(ele){
function addQtipsToIcons(ele){
var id = $(ele).attr("id");
if($(ele).hasClass("progress")){
@ -415,6 +424,9 @@ function addQtipToSCIcons(ele){
my: "left top",
viewport: $(window)
},
style: {
classes: "ui-tooltip-dark file-md-long"
},
show: {
ready: true // Needed to make it show on first mouseover event
}
@ -426,7 +438,7 @@ function addQtipToSCIcons(ele){
ajax: {
url: baseUrl+"/Library/get-upload-to-soundcloud-status",
type: "post",
data: ({format: "json", id : id, type: "file"}),
data: ({format: "json", id : id, type: "show"}),
success: function(json, status){
this.set('content.text', $.i18n._("The soundcloud id for this file is: ")+json.sc_id);
}
@ -441,6 +453,9 @@ function addQtipToSCIcons(ele){
my: "left top",
viewport: $(window)
},
style: {
classes: "ui-tooltip-dark file-md-long"
},
show: {
ready: true // Needed to make it show on first mouseover event
}
@ -468,6 +483,9 @@ function addQtipToSCIcons(ele){
my: "left top",
viewport: $(window)
},
style: {
classes: "ui-tooltip-dark file-md-long"
},
show: {
ready: true // Needed to make it show on first mouseover event
}
@ -486,45 +504,36 @@ function addQtipToSCIcons(ele){
my: "left top",
viewport: $(window)
},
style: {
classes: "ui-tooltip-dark file-md-long"
},
show: {
ready: true // Needed to make it show on first mouseover event
}
});
} else if ($(ele).hasClass("show-partial-filled")){
$(ele).qtip({
content: {
text: $.i18n._("This show is not completely filled with content.")
},
position:{
adjust: {
resize: true,
method: "flip flip"
},
at: "right center",
my: "left top",
viewport: $(window)
},
style: {
classes: "ui-tooltip-dark file-md-long"
},
show: {
ready: true // Needed to make it show on first mouseover event
}
});
}
}
/* This functions does two things:
* 1. Checks if each event(i.e. a show) is over and removes the show empty icon if it is
* 2. Else, if an event is passed in, it checks if the event(i.e. a show) is over
* This gets checked when we are deciding if the show-empty icon should be added
* at the beginning of an event render callback.
*/
/*
function checkEmptyShowStatus(e) {
var currDate = new Date();
var endTime;
if (e === undefined) {
var events = $('#schedule_calendar').fullCalendar('clientEvents');
$.each(events, function(i, event){
endTime = event.end;
$emptyIcon = $("span[id="+event.id+"][class='small-icon show-empty']");
if (currDate.getTime() > endTime.getTime() && $emptyIcon.length === 1) {
$emptyIcon.remove();
}
});
} else {
endTime = e.end;
var showOver = false;
if (currDate.getTime() > endTime.getTime()) {
showOver = true;
}
return showOver;
}
}
*/
//Alert the error and reload the page
//this function is used to resolve concurrency issue
function alertShowErrorAndReload(){
@ -535,7 +544,6 @@ function alertShowErrorAndReload(){
$(document).ready(function(){
setInterval( "checkSCUploadStatus()", 5000 );
setInterval( "getCurrentShow()", 5000 );
//setInterval( "checkEmptyShowStatus()", 5000 );
});
var view_name;

View file

@ -122,7 +122,7 @@ $(document).ready(function() {
case 'P':
$(this).attr('id', 'user-type-P');
$(this).attr('user-rights',
$.i18n._('Progam Managers can do the following:')+'<br><br>'+
$.i18n._('Program Managers can do the following:')+'<br><br>'+
$.i18n._('View schedule')+'<br>'+
$.i18n._('View and manage show content')+'<br>'+
$.i18n._('Schedule shows')+'<br>'+

View file

@ -1,2 +1,2 @@
[main]
liquidsoap_tar_url = http://dl.dropbox.com/u/256410/airtime/savonet.tar.gz
liquidsoap_tar_url = https://dl.dropbox.com/u/256410/airtime/liquidsoap-jan-02-2013.tar.gz

View file

@ -99,7 +99,7 @@ def create_fresh_os(vm_name, debian=False):
do_local('VBoxManage startvm %s'%vm_name)
print "Please wait while attempting to acquire IP address"
time.sleep(15)
time.sleep(30)
try_again = True
while try_again:
@ -115,7 +115,7 @@ def create_fresh_os(vm_name, debian=False):
env.host_string = ip_addr
if debian:
append('/etc/apt/sources.list', "deb http://www.debian-multimedia.org squeeze main non-free", use_sudo=True)
append('/etc/apt/sources.list', "deb http://backports.debian.org/debian-backports squeeze-backports main", use_sudo=True)
def ubuntu_lucid_32(fresh_os=True):
if (fresh_os):
@ -157,6 +157,14 @@ def ubuntu_precise_32(fresh_os=True):
if (fresh_os):
create_fresh_os('Ubuntu_12.04_32')
def ubuntu_quantal_32(fresh_os=True):
if (fresh_os):
create_fresh_os('Ubuntu_12.10_32')
def ubuntu_quantal_64(fresh_os=True):
if (fresh_os):
create_fresh_os('Ubuntu_12.10_64')
def debian_squeeze_32(fresh_os=True):
if (fresh_os):
create_fresh_os('Debian_Squeeze_32', debian=True)
@ -165,6 +173,14 @@ def debian_squeeze_64(fresh_os=True):
if (fresh_os):
create_fresh_os('Debian_Squeeze_64', debian=True)
def debian_wheezy_32(fresh_os=True):
if (fresh_os):
create_fresh_os('Debian_Wheezy_32')
def debian_wheezy_64(fresh_os=True):
if (fresh_os):
create_fresh_os('Debian_Wheezy_64')
def compile_liquidsoap(filename="liquidsoap"):
@ -179,11 +195,11 @@ def compile_liquidsoap(filename="liquidsoap"):
do_sudo('''apt-get install -y --force-yes ocaml-findlib libao-ocaml-dev libportaudio-ocaml-dev \
libmad-ocaml-dev libtaglib-ocaml-dev libalsa-ocaml-dev libtaglib-ocaml-dev libvorbis-ocaml-dev \
libspeex-dev libspeexdsp-dev speex libladspa-ocaml-dev festival festival-dev \
libsamplerate-dev libxmlplaylist-ocaml-dev libxmlrpc-light-ocaml-dev libflac-dev \
libsamplerate-dev libxmlplaylist-ocaml-dev libflac-dev \
libxml-dom-perl libxml-dom-xpath-perl patch autoconf libmp3lame-dev \
libcamomile-ocaml-dev libcamlimages-ocaml-dev libtool libpulse-dev libjack-dev
libcamomile-ocaml-dev libcamlimages-ocaml-dev libtool libpulse-dev libjack-dev \
camlidl libfaad-dev libpcre-ocaml-dev''')
#libxmlrpc-light-ocaml-dev
root = '/home/martin/src'
do_run('mkdir -p %s' % root)
@ -202,13 +218,14 @@ camlidl libfaad-dev libpcre-ocaml-dev''')
#do_run('cd %s/liquidsoap-1.0.1-full && make' % root)
#get('%s/liquidsoap-1.0.1-full/liquidsoap-1.0.1/src/liquidsoap' % root, filename)
do_run('cd %s/savonet && cp PACKAGES.minimal PACKAGES' % root)
sed('%s/savonet/PACKAGES' % root, '#ocaml-portaudio', 'ocaml-portaudio')
sed('%s/savonet/PACKAGES' % root, '#ocaml-alsa', 'ocaml-alsa')
sed('%s/savonet/PACKAGES' % root, '#ocaml-pulseaudio', 'ocaml-pulseaudio')
sed('%s/savonet/PACKAGES' % root, '#ocaml-faad', 'ocaml-faad')
do_run('cd %s/savonet && make clean' % root)
do_run('cd %s/savonet && ./bootstrap' % root)
do_run('cd %s/savonet && ./configure' % root)
do_run('cd %s/savonet && make' % root)
get('%s/savonet/liquidsoap/src/liquidsoap' % root, filename)
do_run('cd %s/liquidsoap && cp PACKAGES.minimal PACKAGES' % root)
sed('%s/liquidsoap/PACKAGES' % root, '#ocaml-portaudio', 'ocaml-portaudio')
sed('%s/liquidsoap/PACKAGES' % root, '#ocaml-alsa', 'ocaml-alsa')
sed('%s/liquidsoap/PACKAGES' % root, '#ocaml-pulseaudio', 'ocaml-pulseaudio')
sed('%s/liquidsoap/PACKAGES' % root, '#ocaml-faad', 'ocaml-faad')
do_run('cd %s/liquidsoap && ./bootstrap' % root)
do_run('cd %s/liquidsoap && ./configure' % root)
do_run('cd %s/liquidsoap && make clean' % root)
do_run('cd %s/liquidsoap && make' % root)
do_sudo('chmod 755 %s/liquidsoap/liquidsoap/src/liquidsoap' % root)
get('%s/liquidsoap/liquidsoap/src/liquidsoap' % root, filename)

View file

@ -2,8 +2,9 @@
exec 2>&1
ubuntu_versions=("ubuntu_lucid_32" "ubuntu_lucid_64" "ubuntu_maverick_32" "ubuntu_maverick_64" "ubuntu_natty_32" "ubuntu_natty_64" "ubuntu_oneiric_32" "ubuntu_oneiric_64" "debian_squeeze_32" "debian_squeeze_64" "ubuntu_precise_32" "ubuntu_precise_64")
ubuntu_versions=("ubuntu_lucid_32" "ubuntu_lucid_64" "ubuntu_natty_32" "ubuntu_natty_64" "ubuntu_oneiric_32" "ubuntu_oneiric_64" "debian_squeeze_32" "debian_squeeze_64" "ubuntu_precise_32" "ubuntu_precise_64" "ubuntu_quantal_32" "ubuntu_quantal_64" "debian_wheezy_32" "debian_wheezy_64")
#ubuntu_versions=("ubuntu_quantal_64")
num1=${#ubuntu_versions[@]}
mkdir -p ./upgrade_logs2

View file

@ -7,6 +7,9 @@ if [[ $EUID -ne 0 ]]; then
exit 1
fi
echo "Generating locales"
for i in `ls /usr/share/airtime/locale | grep ".._.."`; do locale-gen "$i.utf8"; done
# Absolute path to this script, e.g. /home/user/bin/foo.sh
SCRIPT=`readlink -f $0`
# Absolute path this script is in, thus /home/user/bin

View file

@ -38,27 +38,6 @@ def get_os_codename():
return ("unknown", "unknown")
def generate_liquidsoap_config(ss):
data = ss['msg']
fh = open('/etc/airtime/liquidsoap.cfg', 'w')
fh.write("################################################\n")
fh.write("# THIS FILE IS AUTO GENERATED. DO NOT CHANGE!! #\n")
fh.write("################################################\n")
for d in data:
buffer = d[u'keyname'] + " = "
if(d[u'type'] == 'string'):
temp = d[u'value']
buffer += '"%s"' % temp
else:
temp = d[u'value']
if(temp == ""):
temp = "0"
buffer += temp
buffer += "\n"
fh.write(api_client.encode_to(buffer))
fh.write('log_file = "/var/log/airtime/pypo-liquidsoap/<script>.log"\n')
fh.close()
PATH_INI_FILE = '/etc/airtime/pypo.cfg'
PATH_LIQUIDSOAP_BIN = '/usr/lib/airtime/pypo/bin/liquidsoap_bin'

View file

@ -120,7 +120,11 @@ server.register(namespace="dynamic_source",
# fun (s) -> begin log("dynamic_source.read_stop") destroy_dynamic_source_all() end)
default = amplify(id="silence_src", 0.00001, noise())
default = rewrite_metadata([("artist","Airtime"), ("title", "offline")], default)
ref_off_air_meta = ref off_air_meta
if !ref_off_air_meta == "" then
ref_off_air_meta := "Airtime - offline"
end
default = rewrite_metadata([("title", !ref_off_air_meta)], default)
ignore(output.dummy(default, fallible=true))
master_dj_enabled = ref false