Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
be214ac126
|
@ -109,7 +109,7 @@ class UserController extends Zend_Controller_Action
|
||||||
# TODO : remove this. we only use default for now not to break the UI.
|
# TODO : remove this. we only use default for now not to break the UI.
|
||||||
if (!$files_action) { # set default action
|
if (!$files_action) { # set default action
|
||||||
$files_action = "reassign_to";
|
$files_action = "reassign_to";
|
||||||
$delId = 1;
|
$new_owner = Application_Model_User::getFirstAdmin();
|
||||||
}
|
}
|
||||||
|
|
||||||
# only delete when valid action is selected for the owned files
|
# only delete when valid action is selected for the owned files
|
||||||
|
@ -132,8 +132,11 @@ class UserController extends Zend_Controller_Action
|
||||||
if ($files_action == "delete_cascade") {
|
if ($files_action == "delete_cascade") {
|
||||||
$user->deleteAllFiles();
|
$user->deleteAllFiles();
|
||||||
} elseif ($files_action == "reassign_to") {
|
} elseif ($files_action == "reassign_to") {
|
||||||
$new_owner = $this->_getParam("new_owner");
|
// TODO : fix code to actually use the line below and pick a
|
||||||
$user->reassignTo( $new_owner );
|
// real owner instead of defaulting to the first found admin
|
||||||
|
//$new_owner_id = $this->_getParam("new_owner");
|
||||||
|
//$new_owner = new Application_Model_User($new_owner_id);
|
||||||
|
$user->donateFilesTo( $new_owner );
|
||||||
}
|
}
|
||||||
# Finally delete the user
|
# Finally delete the user
|
||||||
$this->view->entries = $user->delete();
|
$this->view->entries = $user->delete();
|
||||||
|
|
|
@ -696,6 +696,7 @@ SQL;
|
||||||
'start' => $start,
|
'start' => $start,
|
||||||
'end' => $end,
|
'end' => $end,
|
||||||
'show_name' => $item["show_name"],
|
'show_name' => $item["show_name"],
|
||||||
|
'row_id' => $item["id"],
|
||||||
'independent_event' => true
|
'independent_event' => true
|
||||||
);
|
);
|
||||||
self::appendScheduleItem($data, $start, $schedule_item);
|
self::appendScheduleItem($data, $start, $schedule_item);
|
||||||
|
|
|
@ -582,7 +582,7 @@ SQL;
|
||||||
/**
|
/**
|
||||||
* Fetch the Application_Model_StoredFile by looking up its filepath.
|
* Fetch the Application_Model_StoredFile by looking up its filepath.
|
||||||
*
|
*
|
||||||
* @param string $p_filepath path of file stored in Airtime.
|
* @param string $p_filepath path of file stored in Airtime.
|
||||||
* @return Application_Model_StoredFile|NULL
|
* @return Application_Model_StoredFile|NULL
|
||||||
*/
|
*/
|
||||||
public static function RecallByFilepath($p_filepath)
|
public static function RecallByFilepath($p_filepath)
|
||||||
|
@ -678,21 +678,21 @@ SQL;
|
||||||
$fileSelect[] = $key;
|
$fileSelect[] = $key;
|
||||||
$streamSelect[] = "NULL::NUMERIC AS ".$key;
|
$streamSelect[] = "NULL::NUMERIC AS ".$key;
|
||||||
} elseif ($key === "lptime") {
|
} elseif ($key === "lptime") {
|
||||||
$plSelect[] = "NULL::TIMESTAMP AS ".$key;
|
$plSelect[] = "NULL::TIMESTAMP AS ".$key;
|
||||||
$blSelect[] = "NULL::TIMESTAMP AS ".$key;
|
$blSelect[] = "NULL::TIMESTAMP AS ".$key;
|
||||||
$fileSelect[] = $key;
|
$fileSelect[] = $key;
|
||||||
$streamSelect[] = $key;
|
$streamSelect[] = $key;
|
||||||
}
|
}
|
||||||
//same columns in each table.
|
//same columns in each table.
|
||||||
else if (in_array($key, array("length", "utime", "mtime"))) {
|
else if (in_array($key, array("length", "utime", "mtime"))) {
|
||||||
$plSelect[] = $key;
|
$plSelect[] = $key;
|
||||||
$blSelect[] = $key;
|
$blSelect[] = $key;
|
||||||
$fileSelect[] = $key;
|
$fileSelect[] = $key;
|
||||||
$streamSelect[] = $key;
|
$streamSelect[] = $key;
|
||||||
} elseif ($key === "year") {
|
} elseif ($key === "year") {
|
||||||
$plSelect[] = "EXTRACT(YEAR FROM utime)::varchar AS ".$key;
|
$plSelect[] = "EXTRACT(YEAR FROM utime)::varchar AS ".$key;
|
||||||
$blSelect[] = "EXTRACT(YEAR FROM utime)::varchar AS ".$key;
|
$blSelect[] = "EXTRACT(YEAR FROM utime)::varchar AS ".$key;
|
||||||
$fileSelect[] = "year AS ".$key;
|
$fileSelect[] = "year AS ".$key;
|
||||||
$streamSelect[] = "EXTRACT(YEAR FROM utime)::varchar AS ".$key;
|
$streamSelect[] = "EXTRACT(YEAR FROM utime)::varchar AS ".$key;
|
||||||
}
|
}
|
||||||
//need to cast certain data as ints for the union to search on.
|
//need to cast certain data as ints for the union to search on.
|
||||||
|
@ -729,6 +729,7 @@ SQL;
|
||||||
$unionTable = "({$plTable} UNION {$blTable} UNION {$fileTable} UNION {$streamTable}) AS RESULTS";
|
$unionTable = "({$plTable} UNION {$blTable} UNION {$fileTable} UNION {$streamTable}) AS RESULTS";
|
||||||
|
|
||||||
//choose which table we need to select data from.
|
//choose which table we need to select data from.
|
||||||
|
// TODO : use constants instead of numbers -- RG
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 0:
|
case 0:
|
||||||
$fromTable = $unionTable;
|
$fromTable = $unionTable;
|
||||||
|
@ -1056,12 +1057,14 @@ SQL;
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$sql = "SELECT id, filepath as fp"
|
$sql = <<<SQL
|
||||||
." FROM CC_FILES"
|
SELECT id,
|
||||||
." WHERE directory = :dir_id"
|
filepath AS fp
|
||||||
." AND file_exists = 'TRUE'"
|
FROM cc_files
|
||||||
." AND replay_gain is NULL"
|
WHERE directory = :dir_id
|
||||||
." LIMIT :lim";
|
AND file_exists = 'TRUE'
|
||||||
|
AND replay_gain IS NULL LIMIT :lim
|
||||||
|
SQL;
|
||||||
|
|
||||||
$stmt = $con->prepare($sql);
|
$stmt = $con->prepare($sql);
|
||||||
$stmt->bindParam(':dir_id', $dir_id);
|
$stmt->bindParam(':dir_id', $dir_id);
|
||||||
|
@ -1170,6 +1173,8 @@ SQL;
|
||||||
return $this->_file->getDbFileExists();
|
return $this->_file->getDbFileExists();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// note: never call this method from controllers because it does a sleep
|
||||||
public function uploadToSoundCloud()
|
public function uploadToSoundCloud()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
@ -1181,11 +1186,11 @@ SQL;
|
||||||
if (Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
if (Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||||
for ($i=0; $i<$CC_CONFIG['soundcloud-connection-retries']; $i++) {
|
for ($i=0; $i<$CC_CONFIG['soundcloud-connection-retries']; $i++) {
|
||||||
$description = $file->getDbTrackTitle();
|
$description = $file->getDbTrackTitle();
|
||||||
$tag = array();
|
$tag = array();
|
||||||
$genre = $file->getDbGenre();
|
$genre = $file->getDbGenre();
|
||||||
$release = $file->getDbYear();
|
$release = $file->getDbYear();
|
||||||
try {
|
try {
|
||||||
$soundcloud = new Application_Model_Soundcloud();
|
$soundcloud = new Application_Model_Soundcloud();
|
||||||
$soundcloud_res = $soundcloud->uploadTrack(
|
$soundcloud_res = $soundcloud->uploadTrack(
|
||||||
$this->getFilePath(), $this->getName(), $description,
|
$this->getFilePath(), $this->getName(), $description,
|
||||||
$tag, $release, $genre);
|
$tag, $release, $genre);
|
||||||
|
@ -1195,9 +1200,10 @@ SQL;
|
||||||
break;
|
break;
|
||||||
} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
|
} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
|
||||||
$code = $e->getHttpCode();
|
$code = $e->getHttpCode();
|
||||||
$msg = $e->getHttpBody();
|
$msg = $e->getHttpBody();
|
||||||
|
// TODO : Do not parse JSON by hand
|
||||||
$temp = explode('"error":',$msg);
|
$temp = explode('"error":',$msg);
|
||||||
$msg = trim($temp[1], '"}');
|
$msg = trim($temp[1], '"}');
|
||||||
$this->setSoundCloudErrorCode($code);
|
$this->setSoundCloudErrorCode($code);
|
||||||
$this->setSoundCloudErrorMsg($msg);
|
$this->setSoundCloudErrorMsg($msg);
|
||||||
// setting sc id to -3 which indicates error
|
// setting sc id to -3 which indicates error
|
||||||
|
|
|
@ -215,7 +215,7 @@ class Application_Model_User
|
||||||
return $user->getCcFilessRelatedByDbOwnerId();
|
return $user->getCcFilessRelatedByDbOwnerId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function donateFilesTo($user)
|
public function donateFilesTo($user) // $user is object not user id
|
||||||
{
|
{
|
||||||
$my_files = $this->getOwnedFiles();
|
$my_files = $this->getOwnedFiles();
|
||||||
foreach ($my_files as $file) {
|
foreach ($my_files as $file) {
|
||||||
|
@ -242,18 +242,27 @@ class Application_Model_User
|
||||||
{
|
{
|
||||||
return CcSubjsQuery::create()->filterByDbType($type)->find();
|
return CcSubjsQuery::create()->filterByDbType($type)->find();
|
||||||
}
|
}
|
||||||
public static function getFirstAdminId()
|
|
||||||
{
|
public static function getFirstAdmin() {
|
||||||
$admins = Application_Model_User::getUsersOfType('A');
|
$admins = Application_Model_User::getUsersOfType('A');
|
||||||
if (count($admins) > 0) { // found admin => pick first one
|
if (count($admins) > 0) { // found admin => pick first one
|
||||||
|
return $admins[0];
|
||||||
return $admins[0]->getDbId();
|
|
||||||
} else {
|
} else {
|
||||||
Logging::warn("Warning. no admins found in database");
|
Logging::warn("Warning. no admins found in database");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getFirstAdminId()
|
||||||
|
{
|
||||||
|
$admin = self::getFirstAdmin();
|
||||||
|
if ($admin) {
|
||||||
|
return $admin->getDbId();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static function getUsers(array $type, $search=null)
|
public static function getUsers(array $type, $search=null)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
|
@ -216,9 +216,9 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : Fix this interface
|
// TODO : Fix this interface
|
||||||
|
//This function should not be defined in the interface.
|
||||||
public function setMetadata($key, $val)
|
public function setMetadata($key, $val)
|
||||||
{
|
{
|
||||||
//This function should not be defined in the interface.
|
|
||||||
throw new Exception("Not implemented.");
|
throw new Exception("Not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,10 @@ $(document).ready(function(){
|
||||||
close: doNotShowPopup,
|
close: doNotShowPopup,
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
id: "remind_me",
|
id: "remind_me",
|
||||||
text: "Remind me in 1 week",
|
text: "Remind me in 1 week",
|
||||||
click: function() {
|
"class": "btn",
|
||||||
|
click: function() {
|
||||||
var url = '/Usersettings/remindme';
|
var url = '/Usersettings/remindme';
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
|
@ -29,6 +30,7 @@ $(document).ready(function(){
|
||||||
{
|
{
|
||||||
id: "remind_never",
|
id: "remind_never",
|
||||||
text: "Remind me never",
|
text: "Remind me never",
|
||||||
|
"class": "btn",
|
||||||
click: function() {
|
click: function() {
|
||||||
var url ='/Usersettings/remindme-never';
|
var url ='/Usersettings/remindme-never';
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -41,6 +43,7 @@ $(document).ready(function(){
|
||||||
{
|
{
|
||||||
id: "help_airtime",
|
id: "help_airtime",
|
||||||
text: "Yes, help Airtime",
|
text: "Yes, help Airtime",
|
||||||
|
"class": "btn",
|
||||||
click: function() {
|
click: function() {
|
||||||
$("#register-form").submit();
|
$("#register-form").submit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,28 +255,31 @@ function eventRender(event, element, view) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//add scheduled show content empty icon
|
//add scheduled show content empty icon
|
||||||
if (view.name === 'agendaDay' || view.name === 'agendaWeek') {
|
addIcon = checkEmptyShowStatus(event);
|
||||||
if (event.show_empty === 1 && event.record === 0 && event.rebroadcast === 0) {
|
if (!addIcon) {
|
||||||
if (event.soundcloud_id === -1) {
|
if (view.name === 'agendaDay' || view.name === 'agendaWeek') {
|
||||||
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon show-empty"></span>');
|
if (event.show_empty === 1 && event.record === 0 && event.rebroadcast === 0) {
|
||||||
} else if (event.soundcloud_id > 0) {
|
if (event.soundcloud_id === -1) {
|
||||||
|
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon show-empty"></span>');
|
||||||
} else if (event.soundcloud_id === -2) {
|
} else if (event.soundcloud_id > 0) {
|
||||||
|
|
||||||
} else if (event.soundcloud_id === -3) {
|
} else if (event.soundcloud_id === -2) {
|
||||||
|
|
||||||
|
} else if (event.soundcloud_id === -3) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (view.name === 'month') {
|
||||||
} else if (view.name === 'month') {
|
if (event.show_empty === 1 && event.record === 0 && event.rebroadcast === 0) {
|
||||||
if (event.show_empty === 1 && event.record === 0 && event.rebroadcast === 0) {
|
if (event.soundcloud_id === -1) {
|
||||||
if (event.soundcloud_id === -1) {
|
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon show-empty"></span>');
|
||||||
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon show-empty"></span>');
|
} else if (event.soundcloud_id > 0) {
|
||||||
} else if (event.soundcloud_id > 0) {
|
|
||||||
|
} else if (event.soundcloud_id === -2) {
|
||||||
} else if (event.soundcloud_id === -2) {
|
|
||||||
|
|
||||||
} else if (event.soundcloud_id === -3) {
|
|
||||||
|
|
||||||
|
} else if (event.soundcloud_id === -3) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -416,6 +419,7 @@ function getCurrentShow(){
|
||||||
|
|
||||||
function addQtipToSCIcons(ele){
|
function addQtipToSCIcons(ele){
|
||||||
var id = $(ele).attr("id");
|
var id = $(ele).attr("id");
|
||||||
|
|
||||||
if($(ele).hasClass("progress")){
|
if($(ele).hasClass("progress")){
|
||||||
$(ele).qtip({
|
$(ele).qtip({
|
||||||
content: {
|
content: {
|
||||||
|
@ -508,6 +512,36 @@ function addQtipToSCIcons(ele){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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
|
//Alert the error and reload the page
|
||||||
//this function is used to resolve concurrency issue
|
//this function is used to resolve concurrency issue
|
||||||
function alertShowErrorAndReload(){
|
function alertShowErrorAndReload(){
|
||||||
|
@ -518,6 +552,7 @@ function alertShowErrorAndReload(){
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
setInterval( "checkSCUploadStatus()", 5000 );
|
setInterval( "checkSCUploadStatus()", 5000 );
|
||||||
setInterval( "getCurrentShow()", 5000 );
|
setInterval( "getCurrentShow()", 5000 );
|
||||||
|
setInterval( "checkEmptyShowStatus()", 5000 );
|
||||||
});
|
});
|
||||||
|
|
||||||
var view_name;
|
var view_name;
|
||||||
|
|
|
@ -66,6 +66,7 @@ class Organizer(ReportHandler,Loggable):
|
||||||
|
|
||||||
# See hack in mmp.magic_move
|
# See hack in mmp.magic_move
|
||||||
def new_dir_watch(d):
|
def new_dir_watch(d):
|
||||||
|
# TODO : rewrite as return lambda : dispatcher.send(...
|
||||||
def cb():
|
def cb():
|
||||||
dispatcher.send(signal="add_subwatch", sender=self,
|
dispatcher.send(signal="add_subwatch", sender=self,
|
||||||
directory=d)
|
directory=d)
|
||||||
|
|
|
@ -41,11 +41,13 @@ stream_harbor_pass = list.hd(get_process_lines('pwgen -s -N 1 -n 20'))
|
||||||
|
|
||||||
web_stream = input.harbor("test-harbor", port=8999, password=stream_harbor_pass)
|
web_stream = input.harbor("test-harbor", port=8999, password=stream_harbor_pass)
|
||||||
web_stream = on_metadata(notify_stream, web_stream)
|
web_stream = on_metadata(notify_stream, web_stream)
|
||||||
|
output.dummy(fallible=true, web_stream)
|
||||||
|
|
||||||
queue = on_metadata(notify, queue)
|
queue = on_metadata(notify, queue)
|
||||||
queue = map_metadata(update=false, append_title, queue)
|
queue = map_metadata(update=false, append_title, queue)
|
||||||
# the crossfade function controls fade in/out
|
# the crossfade function controls fade in/out
|
||||||
queue = crossfade(queue)
|
queue = crossfade(queue)
|
||||||
|
output.dummy(fallible=true, queue)
|
||||||
|
|
||||||
|
|
||||||
stream_queue = switch(id="stream_queue_switch", track_sensitive=false,
|
stream_queue = switch(id="stream_queue_switch", track_sensitive=false,
|
||||||
|
|
|
@ -191,7 +191,7 @@ class PypoPush(Thread):
|
||||||
if self.current_stream_info is None:
|
if self.current_stream_info is None:
|
||||||
correct = False
|
correct = False
|
||||||
else:
|
else:
|
||||||
correct = self.current_stream_info['uri'] == media_item['uri']
|
correct = self.current_stream_info['row_id'] == media_item['row_id']
|
||||||
|
|
||||||
self.logger.debug("Is current item correct?: %s", str(correct))
|
self.logger.debug("Is current item correct?: %s", str(correct))
|
||||||
return correct
|
return correct
|
||||||
|
|
Loading…
Reference in New Issue