Merge branch '2.2.x' of dev.sourcefabric.org:airtime into 2.2.x
This commit is contained in:
commit
9518769738
3 changed files with 14 additions and 6 deletions
|
@ -150,13 +150,15 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
if ($master_harbor_input_port == $dj_harbor_input_port && $master_harbor_input_port != "") {
|
if ($master_harbor_input_port == $dj_harbor_input_port && $master_harbor_input_port != "") {
|
||||||
$element = $this->getElement("dj_harbor_input_port");
|
$element = $this->getElement("dj_harbor_input_port");
|
||||||
$element->addError("You cannot use same port as Master DJ port.");
|
$element->addError("You cannot use same port as Master DJ port.");
|
||||||
|
$isValid = false;
|
||||||
}
|
}
|
||||||
if ($master_harbor_input_port != "") {
|
if ($master_harbor_input_port != "") {
|
||||||
if (is_numeric($master_harbor_input_port)) {
|
if (is_numeric($master_harbor_input_port)) {
|
||||||
if ($master_harbor_input_port != Application_Model_StreamSetting::getMasterLiveStreamPort()) {
|
if ($master_harbor_input_port != Application_Model_StreamSetting::getMasterLiveStreamPort()) {
|
||||||
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||||
$res = socket_bind($sock, 0, $master_harbor_input_port);
|
try {
|
||||||
if (!$res) {
|
socket_bind($sock, 0, $master_harbor_input_port);
|
||||||
|
} catch (Exception $e) {
|
||||||
$element = $this->getElement("master_harbor_input_port");
|
$element = $this->getElement("master_harbor_input_port");
|
||||||
$element->addError("Port '$master_harbor_input_port' is not available.");
|
$element->addError("Port '$master_harbor_input_port' is not available.");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
|
@ -171,8 +173,9 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||||
if (is_numeric($dj_harbor_input_port)) {
|
if (is_numeric($dj_harbor_input_port)) {
|
||||||
if ($dj_harbor_input_port != Application_Model_StreamSetting::getDjLiveStreamPort()) {
|
if ($dj_harbor_input_port != Application_Model_StreamSetting::getDjLiveStreamPort()) {
|
||||||
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||||
$res = socket_bind($sock, 0, $dj_harbor_input_port);
|
try {
|
||||||
if (!$res) {
|
socket_bind($sock, 0, $dj_harbor_input_port);
|
||||||
|
} catch (Exception $e) {
|
||||||
$element = $this->getElement("dj_harbor_input_port");
|
$element = $this->getElement("dj_harbor_input_port");
|
||||||
$element->addError("Port '$dj_harbor_input_port' is not available.");
|
$element->addError("Port '$dj_harbor_input_port' is not available.");
|
||||||
$isValid = false;
|
$isValid = false;
|
||||||
|
|
|
@ -687,7 +687,7 @@ SQL;
|
||||||
'end' => $end,
|
'end' => $end,
|
||||||
'show_name' => $item["show_name"],
|
'show_name' => $item["show_name"],
|
||||||
'replay_gain' => is_null($item["replay_gain"]) ? "0": $item["replay_gain"],
|
'replay_gain' => is_null($item["replay_gain"]) ? "0": $item["replay_gain"],
|
||||||
'independent_event' => true
|
'independent_event' => false
|
||||||
);
|
);
|
||||||
self::appendScheduleItem($data, $start, $schedule_item);
|
self::appendScheduleItem($data, $start, $schedule_item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,6 +120,10 @@ class PypoPush(Thread):
|
||||||
|
|
||||||
next_media_item_chain = self.get_next_schedule_chain(chains, datetime.utcnow())
|
next_media_item_chain = self.get_next_schedule_chain(chains, datetime.utcnow())
|
||||||
if next_media_item_chain is not None:
|
if next_media_item_chain is not None:
|
||||||
|
try:
|
||||||
|
chains.remove(next_media_item_chain)
|
||||||
|
except ValueError, e:
|
||||||
|
self.logger.error(str(e))
|
||||||
chain_start = datetime.strptime(next_media_item_chain[0]['start'], "%Y-%m-%d-%H-%M-%S")
|
chain_start = datetime.strptime(next_media_item_chain[0]['start'], "%Y-%m-%d-%H-%M-%S")
|
||||||
time_until_next_play = self.date_interval_to_seconds(chain_start - datetime.utcnow())
|
time_until_next_play = self.date_interval_to_seconds(chain_start - datetime.utcnow())
|
||||||
self.logger.debug("Blocking %s seconds until show start", time_until_next_play)
|
self.logger.debug("Blocking %s seconds until show start", time_until_next_play)
|
||||||
|
@ -405,8 +409,9 @@ class PypoPush(Thread):
|
||||||
closest_chain = None
|
closest_chain = None
|
||||||
for chain in chains:
|
for chain in chains:
|
||||||
chain_start = datetime.strptime(chain[0]['start'], "%Y-%m-%d-%H-%M-%S")
|
chain_start = datetime.strptime(chain[0]['start'], "%Y-%m-%d-%H-%M-%S")
|
||||||
|
chain_end = datetime.strptime(chain[-1]['end'], "%Y-%m-%d-%H-%M-%S")
|
||||||
self.logger.debug("tnow %s, chain_start %s", tnow, chain_start)
|
self.logger.debug("tnow %s, chain_start %s", tnow, chain_start)
|
||||||
if (closest_start == None or chain_start < closest_start) and chain_start > tnow:
|
if (closest_start == None or chain_start < closest_start) and (chain_start > tnow or (chain_start < tnow and chain_end > tnow)):
|
||||||
closest_start = chain_start
|
closest_start = chain_start
|
||||||
closest_chain = chain
|
closest_chain = chain
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue