Merge branch '2.2.x' of dev.sourcefabric.org:airtime into 2.2.x
This commit is contained in:
commit
5ba964c783
|
@ -48,7 +48,7 @@ class Application_Common_DateHelper
|
||||||
/**
|
/**
|
||||||
* Get the week start date of this week in the format
|
* Get the week start date of this week in the format
|
||||||
* YYYY-MM-DD
|
* YYYY-MM-DD
|
||||||
*
|
*
|
||||||
* @return String - week start date
|
* @return String - week start date
|
||||||
*/
|
*/
|
||||||
function getWeekStartDate()
|
function getWeekStartDate()
|
||||||
|
@ -231,7 +231,7 @@ class Application_Common_DateHelper
|
||||||
if (2 !== substr_count($p_time, ":")){
|
if (2 !== substr_count($p_time, ":")){
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 === substr_count($p_time, ".")){
|
if (1 === substr_count($p_time, ".")){
|
||||||
list($hhmmss, $ms) = explode(".", $p_time);
|
list($hhmmss, $ms) = explode(".", $p_time);
|
||||||
} else {
|
} else {
|
||||||
|
@ -275,17 +275,17 @@ class Application_Common_DateHelper
|
||||||
return $dateTime;
|
return $dateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convenience method to return a date formatted into a String rather than a
|
/* Convenience method to return a date formatted into a String rather than a
|
||||||
* DateTime object. Note that if an empty string is provided for $p_dateString
|
* DateTime object. Note that if an empty string is provided for $p_dateString
|
||||||
* then the current time is provided.
|
* then the current time is provided.
|
||||||
*
|
*
|
||||||
* @param $p_dateString
|
* @param $p_dateString
|
||||||
* Date string in UTC timezone.
|
* Date string in UTC timezone.
|
||||||
* @param $p_format
|
* @param $p_format
|
||||||
* Format which the string should be returned in.
|
* Format which the string should be returned in.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* Date String in localtime
|
* Date String in localtime
|
||||||
* */
|
* */
|
||||||
public static function ConvertToLocalDateTimeString($p_dateString, $p_format="Y-m-d H:i:s"){
|
public static function ConvertToLocalDateTimeString($p_dateString, $p_format="Y-m-d H:i:s"){
|
||||||
if (is_null($p_dateString) || strlen($p_dateString) == 0)
|
if (is_null($p_dateString) || strlen($p_dateString) == 0)
|
||||||
|
@ -302,7 +302,7 @@ class Application_Common_DateHelper
|
||||||
/*
|
/*
|
||||||
* Example input: "00:02:32.746562". Output is a DateInterval object
|
* Example input: "00:02:32.746562". Output is a DateInterval object
|
||||||
* representing that 2 minute, 32.746562 second interval.
|
* representing that 2 minute, 32.746562 second interval.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function getDateIntervalFromString($p_interval){
|
public static function getDateIntervalFromString($p_interval){
|
||||||
list($hour_min_sec, $subsec) = explode(".", $p_interval);
|
list($hour_min_sec, $subsec) = explode(".", $p_interval);
|
||||||
|
@ -335,7 +335,7 @@ class Application_Common_DateHelper
|
||||||
$retVal['errMsg'] = "The year '$year' must be within the range of 1753 - 9999";
|
$retVal['errMsg'] = "The year '$year' must be within the range of 1753 - 9999";
|
||||||
} else if (!checkdate($month, $day, $year)) {
|
} else if (!checkdate($month, $day, $year)) {
|
||||||
$retVal['success'] = false;
|
$retVal['success'] = false;
|
||||||
$retVal['errMsg'] = "'$year-$month-$day' is not a valid date";
|
$retVal['errMsg'] = "'$year-$month-$day' is not a valid date";
|
||||||
} else {
|
} else {
|
||||||
// check time
|
// check time
|
||||||
if (isset($timeInfo)) {
|
if (isset($timeInfo)) {
|
||||||
|
|
|
@ -926,31 +926,33 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
$data_arr = json_decode($data);
|
$data_arr = json_decode($data);
|
||||||
|
|
||||||
if (!is_null($media_id) && isset($data_arr->title) && strlen($data_arr->title) < 1024) {
|
if (!is_null($media_id)) {
|
||||||
|
if (isset($data_arr->title) &&
|
||||||
|
strlen($data_arr->title) < 1024) {
|
||||||
|
|
||||||
$previous_metadata = CcWebstreamMetadataQuery::create()
|
$previous_metadata = CcWebstreamMetadataQuery::create()
|
||||||
->orderByDbStartTime('desc')
|
->orderByDbStartTime('desc')
|
||||||
->filterByDbInstanceId($media_id)
|
->filterByDbInstanceId($media_id)
|
||||||
->findOne();
|
->findOne();
|
||||||
|
|
||||||
$do_insert = true;
|
$do_insert = true;
|
||||||
if ($previous_metadata) {
|
if ($previous_metadata) {
|
||||||
if ($previous_metadata->getDbLiquidsoapData() == $data_arr->title) {
|
if ($previous_metadata->getDbLiquidsoapData() == $data_arr->title) {
|
||||||
Logging::debug("Duplicate found: ".$data_arr->title);
|
Logging::debug("Duplicate found: ".$data_arr->title);
|
||||||
$do_insert = false;
|
$do_insert = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($do_insert) {
|
||||||
|
$webstream_metadata = new CcWebstreamMetadata();
|
||||||
|
$webstream_metadata->setDbInstanceId($media_id);
|
||||||
|
$webstream_metadata->setDbStartTime(new DateTime("now", new DateTimeZone("UTC")));
|
||||||
|
$webstream_metadata->setDbLiquidsoapData($data_arr->title);
|
||||||
|
$webstream_metadata->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($do_insert) {
|
|
||||||
$webstream_metadata = new CcWebstreamMetadata();
|
|
||||||
$webstream_metadata->setDbInstanceId($media_id);
|
|
||||||
$webstream_metadata->setDbStartTime(new DateTime("now", new DateTimeZone("UTC")));
|
|
||||||
$webstream_metadata->setDbLiquidsoapData($data_arr->title);
|
|
||||||
$webstream_metadata->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Unexpected error. media_id $media_id has a null stream value in cc_schedule!");
|
throw new Exception("Null value of media_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->response = $data;
|
$this->view->response = $data;
|
||||||
|
|
|
@ -266,8 +266,12 @@ class Application_Model_ShowBuilder
|
||||||
$row["instance"] = intval($p_item["si_id"]);
|
$row["instance"] = intval($p_item["si_id"]);
|
||||||
$row["starts"] = $schedStartDT->format("H:i:s");
|
$row["starts"] = $schedStartDT->format("H:i:s");
|
||||||
$row["ends"] = $schedEndDT->format("H:i:s");
|
$row["ends"] = $schedEndDT->format("H:i:s");
|
||||||
|
|
||||||
$formatter = new LengthFormatter($p_item['file_length']);
|
$cue_out = Application_Common_DateHelper::calculateLengthInSeconds($p_item['cue_out']);
|
||||||
|
$cue_in = Application_Common_DateHelper::calculateLengthInSeconds($p_item['cue_in']);
|
||||||
|
$run_time = $cue_out-$cue_in;
|
||||||
|
|
||||||
|
$formatter = new LengthFormatter(Application_Common_DateHelper::ConvertMSToHHMMSSmm($run_time*1000));
|
||||||
$row['runtime'] = $formatter->format();
|
$row['runtime'] = $formatter->format();
|
||||||
|
|
||||||
$row["title"] = $p_item["file_track_title"];
|
$row["title"] = $p_item["file_track_title"];
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
||||||
|
|
||||||
public function getCreatorId()
|
public function getCreatorId()
|
||||||
{
|
{
|
||||||
return $this->Webstream->getCcSubjs()->getDbId();
|
return $this->webstream->getDbCreatorId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLastModified($p_type)
|
public function getLastModified($p_type)
|
||||||
|
@ -51,7 +51,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
||||||
$di = new DateInterval("PT{$hours}H{$min}M{$sec}S");
|
$di = new DateInterval("PT{$hours}H{$min}M{$sec}S");
|
||||||
|
|
||||||
return $di->format("%Hh %Im");
|
return $di->format("%Hh %Im");
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,12 +153,24 @@ function buildplaylist(p_url, p_playIndex) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (data[index]['type'] == 1) {
|
} else if (data[index]['type'] == 1) {
|
||||||
media = {title: data[index]['element_title'],
|
var mime = data[index]['mime'];
|
||||||
artist: data[index]['element_artist'],
|
if (mime.search(/mp3/i) > 0 || mime.search(/mpeg/i) > 0) {
|
||||||
mp3:data[index]['uri']
|
key = "mp3";
|
||||||
};
|
} else if (mime.search(/og(g|a)/i) > 0 || mime.search(/vorbis/i) > 0) {
|
||||||
|
key = "oga";
|
||||||
|
} else if (mime.search(/mp4/i) > 0) {
|
||||||
|
key = "m4a";
|
||||||
|
} else if (mime.search(/wav/i) > 0) {
|
||||||
|
key = "wav";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key) {
|
||||||
|
media = {title: data[index]['element_title'],
|
||||||
|
artist: data[index]['element_artist']
|
||||||
|
};
|
||||||
|
media[key] = data[index]['uri']
|
||||||
|
}
|
||||||
}
|
}
|
||||||
console.log(data[index]);
|
|
||||||
if (media && isAudioSupported(data[index]['mime'])) {
|
if (media && isAudioSupported(data[index]['mime'])) {
|
||||||
// javascript doesn't support associative array with numeric key
|
// javascript doesn't support associative array with numeric key
|
||||||
// so we need to remove the gap if we skip any of tracks due to
|
// so we need to remove the gap if we skip any of tracks due to
|
||||||
|
|
|
@ -15,5 +15,6 @@ function isAudioSupported(mime){
|
||||||
//is adding a javascript library to do the work for you, which seems like overkill....
|
//is adding a javascript library to do the work for you, which seems like overkill....
|
||||||
return (!!audio.canPlayType && audio.canPlayType(bMime) != "") ||
|
return (!!audio.canPlayType && audio.canPlayType(bMime) != "") ||
|
||||||
(mime.indexOf("mp3") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) ||
|
(mime.indexOf("mp3") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) ||
|
||||||
(mime.indexOf("mp4") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined);
|
(mime.indexOf("mp4") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) ||
|
||||||
|
(mime.indexOf("mpeg") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined);
|
||||||
}
|
}
|
||||||
|
|
|
@ -975,7 +975,6 @@ function addProgressIcon(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkLibrarySCUploadStatus(){
|
function checkLibrarySCUploadStatus(){
|
||||||
|
|
||||||
var url = '/Library/get-upload-to-soundcloud-status',
|
var url = '/Library/get-upload-to-soundcloud-status',
|
||||||
span,
|
span,
|
||||||
id;
|
id;
|
||||||
|
@ -1028,15 +1027,22 @@ function addQtipToSCIcons(){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if($(this).hasClass("soundcloud")){
|
else if($(this).hasClass("soundcloud")){
|
||||||
|
var sc_id = $(this).parent().parent().data("aData").soundcloud_id;
|
||||||
$(this).qtip({
|
$(this).qtip({
|
||||||
content: {
|
content: {
|
||||||
|
//text: "The soundcloud id for this file is: "+sc_id
|
||||||
text: "Retrieving data from the server...",
|
text: "Retrieving data from the server...",
|
||||||
ajax: {
|
ajax: {
|
||||||
url: "/Library/get-upload-to-soundcloud-status",
|
url: "/Library/get-upload-to-soundcloud-status",
|
||||||
type: "post",
|
type: "post",
|
||||||
data: ({format: "json", id : id, type: "file"}),
|
data: ({format: "json", id : id, type: "file"}),
|
||||||
success: function(json, status){
|
success: function(json, status){
|
||||||
this.set('content.text', "The soundcloud id for this file is: "+json.sc_id);
|
id = sc_id;
|
||||||
|
if (id == undefined) {
|
||||||
|
id = json.sc_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set('content.text', "The soundcloud id for this file is: "+id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,11 +11,7 @@ set("server.telnet.port", 1234)
|
||||||
webstream_enabled = ref false
|
webstream_enabled = ref false
|
||||||
|
|
||||||
time = ref string_of(gettimeofday())
|
time = ref string_of(gettimeofday())
|
||||||
queue = audio_to_stereo(id="queue_src", mksafe(request.equeue(id="queue", length=0.5)))
|
|
||||||
queue = cue_cut(queue)
|
|
||||||
queue = amplify(1., override="replay_gain", queue)
|
|
||||||
|
|
||||||
#fallback between queue and input.harbor (for restreaming other web-streams)
|
|
||||||
#live stream setup
|
#live stream setup
|
||||||
set("harbor.bind_addr", "0.0.0.0")
|
set("harbor.bind_addr", "0.0.0.0")
|
||||||
|
|
||||||
|
@ -43,6 +39,10 @@ just_switched = ref false
|
||||||
#web_stream = on_metadata(notify_stream, web_stream)
|
#web_stream = on_metadata(notify_stream, web_stream)
|
||||||
#output.dummy(fallible=true, web_stream)
|
#output.dummy(fallible=true, web_stream)
|
||||||
|
|
||||||
|
queue = audio_to_stereo(id="queue_src", request.equeue(id="queue", length=0.5))
|
||||||
|
queue = cue_cut(queue)
|
||||||
|
queue = amplify(1., override="replay_gain", queue)
|
||||||
|
|
||||||
# the crossfade function controls fade in/out
|
# the crossfade function controls fade in/out
|
||||||
queue = crossfade_airtime(queue)
|
queue = crossfade_airtime(queue)
|
||||||
queue = on_metadata(notify, queue)
|
queue = on_metadata(notify, queue)
|
||||||
|
@ -53,11 +53,6 @@ http = input.http_restart(id="http")
|
||||||
http = cross_http(http_input_id="http",http)
|
http = cross_http(http_input_id="http",http)
|
||||||
stream_queue = http_fallback(http_input_id="http",http=http,default=queue)
|
stream_queue = http_fallback(http_input_id="http",http=http,default=queue)
|
||||||
|
|
||||||
#stream_queue = switch(id="stream_queue_switch", track_sensitive=false,
|
|
||||||
# transitions=[transition, transition],
|
|
||||||
# [({!webstream_enabled},web_stream),
|
|
||||||
# ({true}, queue)])
|
|
||||||
|
|
||||||
ignore(output.dummy(stream_queue, fallible=true))
|
ignore(output.dummy(stream_queue, fallible=true))
|
||||||
|
|
||||||
server.register(namespace="vars",
|
server.register(namespace="vars",
|
||||||
|
@ -227,6 +222,7 @@ end
|
||||||
s = switch(id="default_switch", track_sensitive=false,
|
s = switch(id="default_switch", track_sensitive=false,
|
||||||
transitions=[transition_default, transition],
|
transitions=[transition_default, transition],
|
||||||
[({!scheduled_play_enabled}, stream_queue),({true},default)])
|
[({!scheduled_play_enabled}, stream_queue),({true},default)])
|
||||||
|
|
||||||
s = append_dj_inputs(master_live_stream_port, master_live_stream_mp,
|
s = append_dj_inputs(master_live_stream_port, master_live_stream_mp,
|
||||||
dj_live_stream_port, dj_live_stream_mp, s)
|
dj_live_stream_port, dj_live_stream_mp, s)
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,7 @@ class Notify:
|
||||||
self.notify_source_status(options.source_name, options.source_status)
|
self.notify_source_status(options.source_name, options.source_status)
|
||||||
elif options.webstream:
|
elif options.webstream:
|
||||||
self.notify_webstream_data(options.webstream, options.media_id)
|
self.notify_webstream_data(options.webstream, options.media_id)
|
||||||
|
self.notify_media_start_playing(options.media_id)
|
||||||
elif options.media_id:
|
elif options.media_id:
|
||||||
self.notify_media_start_playing(options.media_id)
|
self.notify_media_start_playing(options.media_id)
|
||||||
elif options.liquidsoap_started:
|
elif options.liquidsoap_started:
|
||||||
|
|
Loading…
Reference in New Issue