CC-3224: "On-the-fly" stream rebroadcasting
- frond-end implementation for master dj and live dj - db implementation - liquidsoap is broken on this commit
This commit is contained in:
parent
96c4462adc
commit
128a497059
16 changed files with 304 additions and 99 deletions
|
@ -728,22 +728,6 @@ class Application_Model_Preference
|
|||
public static function GetLiveSteamMasterPassword(){
|
||||
return self::GetValue("live_stream_master_password");
|
||||
}
|
||||
|
||||
public static function SetLiveSteamPort($value){
|
||||
self::SetValue("live_stream_port", $value, false);
|
||||
}
|
||||
|
||||
public static function GetLiveSteamPort(){
|
||||
return self::GetValue("live_stream_port");
|
||||
}
|
||||
|
||||
public static function SetLiveSteamMountPoint($value){
|
||||
self::SetValue("live_stream_mp", $value, false);
|
||||
}
|
||||
|
||||
public static function GetLiveSteamMountPoint(){
|
||||
return self::GetValue("live_stream_mp");
|
||||
}
|
||||
/* User specific preferences end */
|
||||
}
|
||||
|
||||
|
|
|
@ -104,6 +104,19 @@ class Application_Model_Show {
|
|||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function getHostsIds()
|
||||
{
|
||||
global $CC_DBC;
|
||||
|
||||
$sql = "SELECT subjs_id
|
||||
FROM cc_show_hosts
|
||||
WHERE show_id = {$this->_showId}";
|
||||
|
||||
$hosts = $CC_DBC->GetAll($sql);
|
||||
|
||||
return $hosts;
|
||||
}
|
||||
|
||||
//remove everything about this show.
|
||||
public function delete()
|
||||
|
@ -785,6 +798,8 @@ class Application_Model_Show {
|
|||
$info['allow_live_stream_override'] = $ccShow->getDbAllowLiveStream();
|
||||
$info['cb_airtime_auth'] = $ccShow->getDbLiveStreamUsingAirtimeAuth();
|
||||
$info['cb_custom_auth'] = $ccShow->getDbLiveStreamUsingCustomAuth();
|
||||
$info['custom_username'] = $ccShow->getDbLiveStreamUser();
|
||||
$info['custom_password'] = $ccShow->getDbLiveStreamPass();
|
||||
return $info;
|
||||
}
|
||||
}
|
||||
|
@ -1698,9 +1713,13 @@ class Application_Model_Show {
|
|||
* @param String $timeNow - current time (in UTC)
|
||||
* @return array - show being played right now
|
||||
*/
|
||||
public static function GetCurrentShow($timeNow)
|
||||
public static function GetCurrentShow($timeNow=null)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
if($timeNow == null){
|
||||
$date = new Application_Model_DateHelper;
|
||||
$timeNow = $date->getUtcTimestamp();
|
||||
}
|
||||
//TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin
|
||||
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id, si.id as instance_id, si.record, s.url, starts, ends"
|
||||
." FROM $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
|
||||
|
|
|
@ -1,5 +1,48 @@
|
|||
<?php
|
||||
class Application_Model_StreamSetting {
|
||||
|
||||
public static function SetValue($key, $value, $type){
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
$key = pg_escape_string($key);
|
||||
$value = pg_escape_string($value);
|
||||
|
||||
//Check if key already exists
|
||||
$sql = "SELECT COUNT(*) FROM cc_stream_setting"
|
||||
." WHERE keyname = '$key'";
|
||||
|
||||
$result = $CC_DBC->GetOne($sql);
|
||||
|
||||
if($result == 1) {
|
||||
$sql = "UPDATE cc_stream_setting"
|
||||
." SET value = '$value', type='$type'"
|
||||
." WHERE keyname = '$key'";
|
||||
} else {
|
||||
$sql = "INSERT INTO cc_stream_setting (keyname, value, type)"
|
||||
." VALUES ('$key', '$value', '$type')";
|
||||
}
|
||||
|
||||
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_stream_setting"
|
||||
." WHERE keyname = '$key'";
|
||||
$result = $CC_DBC->GetOne($sql);
|
||||
|
||||
if ($result == 0)
|
||||
return "";
|
||||
else {
|
||||
$sql = "SELECT value FROM cc_stream_setting"
|
||||
." WHERE keyname = '$key'";
|
||||
|
||||
$result = $CC_DBC->GetOne($sql);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns the id's of all streams that are enabled in an array. An
|
||||
* example of the array returned in JSON notation is ["s1", "s2", "s3"] */
|
||||
|
@ -63,6 +106,18 @@ class Application_Model_StreamSetting {
|
|||
." WHERE keyname not like '%_error'";
|
||||
|
||||
$rows = $CC_DBC->getAll($sql);
|
||||
if(isset($rows["master_harbor_input_port"])){
|
||||
$rows[] = (array("keyname" =>"master_harbor_input_port", "value"=>self::GetMasterLiveSteamPort(), "type"=>"integer"));
|
||||
}
|
||||
if(isset($rows["master_harbor_input_mount_point"])){
|
||||
$rows[] = (array("keyname" =>"master_harbor_input_mount_point", "value"=>self::GetMasterLiveSteamMountPoint(), "type"=>"string"));
|
||||
}
|
||||
if(isset($rows["dj_harbor_input_port"])){
|
||||
$rows[] = (array("keyname" =>"dj_harbor_input_port", "value"=>self::GetDJLiveSteamPort(), "type"=>"integer"));
|
||||
}
|
||||
if(isset($rows["dj_harbor_input_mount_point"])){
|
||||
$rows[] = (array("keyname" =>"dj_harbor_input_mount_point", "value"=>self::GetDJLiveSteamMountPoint(), "type"=>"string"));
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
@ -197,4 +252,36 @@ class Application_Model_StreamSetting {
|
|||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
public static function SetMasterLiveSteamPort($value){
|
||||
self::SetValue("master_live_stream_port", $value, "integer");
|
||||
}
|
||||
|
||||
public static function GetMasterLiveSteamPort(){
|
||||
return self::GetValue("master_live_stream_port");
|
||||
}
|
||||
|
||||
public static function SetMasterLiveSteamMountPoint($value){
|
||||
self::SetValue("master_live_stream_mp", $value, "string");
|
||||
}
|
||||
|
||||
public static function GetMasterLiveSteamMountPoint(){
|
||||
return self::GetValue("master_live_stream_mp");
|
||||
}
|
||||
|
||||
public static function SetDJLiveSteamPort($value){
|
||||
self::SetValue("dj_live_stream_port", $value, "integer");
|
||||
}
|
||||
|
||||
public static function GetDJLiveSteamPort(){
|
||||
return self::GetValue("dj_live_stream_port");
|
||||
}
|
||||
|
||||
public static function SetDJLiveSteamMountPoint($value){
|
||||
self::SetValue("dj_live_stream_mp", $value, "string");
|
||||
}
|
||||
|
||||
public static function GetDJLiveSteamMountPoint(){
|
||||
return self::GetValue("dj_live_stream_mp");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue