Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
7586aa37f3
|
@ -24,7 +24,7 @@ class WebstreamController extends Zend_Controller_Action
|
||||||
|
|
||||||
$webstream = new CcWebstream();
|
$webstream = new CcWebstream();
|
||||||
|
|
||||||
//we're not saving this primary key in the DB so it's OK
|
//we're not saving this primary key in the DB so it's OK to be -1
|
||||||
$webstream->setDbId(-1);
|
$webstream->setDbId(-1);
|
||||||
$webstream->setDbName("Untitled Webstream");
|
$webstream->setDbName("Untitled Webstream");
|
||||||
$webstream->setDbDescription("");
|
$webstream->setDbDescription("");
|
||||||
|
@ -34,7 +34,6 @@ class WebstreamController extends Zend_Controller_Action
|
||||||
$webstream->setDbCreatorId($userInfo->id);
|
$webstream->setDbCreatorId($userInfo->id);
|
||||||
$webstream->setDbUtime(new DateTime("now", new DateTimeZone('UTC')));
|
$webstream->setDbUtime(new DateTime("now", new DateTimeZone('UTC')));
|
||||||
$webstream->setDbMtime(new DateTime("now", new DateTimeZone('UTC')));
|
$webstream->setDbMtime(new DateTime("now", new DateTimeZone('UTC')));
|
||||||
//$webstream->save();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$type = "stream";
|
$type = "stream";
|
||||||
|
@ -50,7 +49,7 @@ class WebstreamController extends Zend_Controller_Action
|
||||||
//clear the session in case an old playlist was open: CC-4196
|
//clear the session in case an old playlist was open: CC-4196
|
||||||
Application_Model_Library::changePlaylist(null, null);
|
Application_Model_Library::changePlaylist(null, null);
|
||||||
|
|
||||||
$this->view->obj = new Application_Model_Webstream($webstream->getDbId());
|
$this->view->obj = new Application_Model_Webstream($webstream);
|
||||||
$this->view->action = "new";
|
$this->view->action = "new";
|
||||||
$this->view->html = $this->view->render('webstream/webstream.phtml');
|
$this->view->html = $this->view->render('webstream/webstream.phtml');
|
||||||
}
|
}
|
||||||
|
@ -68,7 +67,7 @@ class WebstreamController extends Zend_Controller_Action
|
||||||
if ($webstream) {
|
if ($webstream) {
|
||||||
Application_Model_Library::changePlaylist($id, "stream");
|
Application_Model_Library::changePlaylist($id, "stream");
|
||||||
}
|
}
|
||||||
$this->view->obj = new Application_Model_Webstream($webstream->getDbId());
|
$this->view->obj = new Application_Model_Webstream($webstream);
|
||||||
$this->view->action = "edit";
|
$this->view->action = "edit";
|
||||||
$this->view->html = $this->view->render('webstream/webstream.phtml');
|
$this->view->html = $this->view->render('webstream/webstream.phtml');
|
||||||
}
|
}
|
||||||
|
|
|
@ -798,6 +798,30 @@ SQL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose of this function is to iterate through the entire
|
||||||
|
* schedule array that was just built and fix the data up a bit. For
|
||||||
|
* example, if we have two consecutive webstreams, we don't need the
|
||||||
|
* first webstream to shutdown the output, when the second one will
|
||||||
|
* just switch it back on. Preventing this behaviour stops hiccups
|
||||||
|
* in output sound.
|
||||||
|
*/
|
||||||
|
private static function filterData(&$data)
|
||||||
|
{
|
||||||
|
$previous_key = null;
|
||||||
|
$previous_val = null;
|
||||||
|
foreach ($data as $k => $v) {
|
||||||
|
if ($v["type"] == "stream_buffer_start"
|
||||||
|
&& !is_null($previous_val)
|
||||||
|
&& $previous_val["type"] == "stream_output_end") {
|
||||||
|
|
||||||
|
unset($data[$previous_key]);
|
||||||
|
}
|
||||||
|
$previous_key = $k;
|
||||||
|
$previous_val = $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static function getSchedule($p_fromDateTime = null, $p_toDateTime = null)
|
public static function getSchedule($p_fromDateTime = null, $p_toDateTime = null)
|
||||||
{
|
{
|
||||||
list($range_start, $range_end) = self::getRangeStartAndEnd($p_fromDateTime, $p_toDateTime);
|
list($range_start, $range_end) = self::getRangeStartAndEnd($p_fromDateTime, $p_toDateTime);
|
||||||
|
@ -808,6 +832,8 @@ SQL;
|
||||||
self::createInputHarborKickTimes($data, $range_start, $range_end);
|
self::createInputHarborKickTimes($data, $range_start, $range_end);
|
||||||
self::createScheduledEvents($data, $range_start, $range_end);
|
self::createScheduledEvents($data, $range_start, $range_end);
|
||||||
|
|
||||||
|
self::filterData($data["media"]);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -434,7 +434,9 @@ class PypoPush(Thread):
|
||||||
self.start_web_stream_buffer(media_item)
|
self.start_web_stream_buffer(media_item)
|
||||||
self.start_web_stream(media_item)
|
self.start_web_stream(media_item)
|
||||||
elif media_item['type'] == "stream_buffer_end":
|
elif media_item['type'] == "stream_buffer_end":
|
||||||
self.stop_web_stream(media_item)
|
self.stop_web_stream_buffer(media_item)
|
||||||
|
elif media_item['type'] == "stream_output_end":
|
||||||
|
self.stop_web_stream_output(media_item)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.logger.error('Pypo Push Exception: %s', e)
|
self.logger.error('Pypo Push Exception: %s', e)
|
||||||
|
|
||||||
|
@ -509,7 +511,7 @@ class PypoPush(Thread):
|
||||||
finally:
|
finally:
|
||||||
self.telnet_lock.release()
|
self.telnet_lock.release()
|
||||||
|
|
||||||
def stop_web_stream(self, media_item):
|
def stop_web_stream_buffer(self, media_item):
|
||||||
try:
|
try:
|
||||||
self.telnet_lock.acquire()
|
self.telnet_lock.acquire()
|
||||||
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
|
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
|
||||||
|
@ -519,6 +521,21 @@ class PypoPush(Thread):
|
||||||
self.logger.debug(msg)
|
self.logger.debug(msg)
|
||||||
tn.write(msg)
|
tn.write(msg)
|
||||||
|
|
||||||
|
tn.write("exit\n")
|
||||||
|
self.logger.debug(tn.read_all())
|
||||||
|
|
||||||
|
self.current_stream_info = None
|
||||||
|
except Exception, e:
|
||||||
|
self.logger.error(str(e))
|
||||||
|
finally:
|
||||||
|
self.telnet_lock.release()
|
||||||
|
|
||||||
|
def stop_web_stream_output(self, media_item):
|
||||||
|
try:
|
||||||
|
self.telnet_lock.acquire()
|
||||||
|
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
|
||||||
|
#dynamic_source.stop http://87.230.101.24:80/top100station.mp3
|
||||||
|
|
||||||
msg = 'dynamic_source.output_stop\n'
|
msg = 'dynamic_source.output_stop\n'
|
||||||
self.logger.debug(msg)
|
self.logger.debug(msg)
|
||||||
tn.write(msg)
|
tn.write(msg)
|
||||||
|
|
Loading…
Reference in New Issue