Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
Conflicts: airtime_mvc/application/Bootstrap.php
This commit is contained in:
commit
61fb8a4fb9
|
@ -89,21 +89,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
$view->headScript()->appendFile($baseUrl . '/js/airtime/common/livechat.js?'.filemtime($baseDir.'/js/airtime/common/livechat.js'), 'text/javascript');
|
||||
}
|
||||
if(isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1){
|
||||
// since we need to append google analytic code right before </head> we can't use appendFile function
|
||||
// we will just store raw html into some variable
|
||||
$view->google_analytics = "<script type=\"text/javascript\">
|
||||
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-28765064-1']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
|
||||
</script>";
|
||||
$view->headScript()->appendFile($baseUrl.'/js/libs/google-analytics.js?'.filemtime($baseDir.'/js/libs/google-analytics.js'),'text/javascript');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
return;
|
||||
}
|
||||
|
||||
$res = $file->delete();
|
||||
$res = $file->delete(true);
|
||||
|
||||
if (PEAR::isError($res)) {
|
||||
$this->view->message = $res->getMessage();
|
||||
|
|
|
@ -205,6 +205,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
|
||||
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
|
||||
$values['output_sound_device_type'] = $form->getValue('output_sound_device_type');
|
||||
$values['streamFormat'] = $form->getValue('streamFormat');
|
||||
|
||||
}
|
||||
if(!$error){
|
||||
|
@ -214,6 +215,8 @@ class PreferenceController extends Zend_Controller_Action
|
|||
for($i=1;$i<=$num_of_stream;$i++){
|
||||
Application_Model_StreamSetting::setLiquidsoapError($i, "waiting");
|
||||
}
|
||||
// this goes into cc_pref table
|
||||
Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']);
|
||||
// store stream update timestamp
|
||||
Application_Model_Preference::SetStreamUpdateTimestamp();
|
||||
Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data);
|
||||
|
|
|
@ -303,7 +303,7 @@ class Application_Model_StoredFile {
|
|||
*
|
||||
* @return void|PEAR_Error
|
||||
*/
|
||||
public function delete()
|
||||
public function delete($deleteFromPlaylist=false)
|
||||
{
|
||||
if ($this->exists()) {
|
||||
if ($this->getFormat() == 'audioclip') {
|
||||
|
@ -314,8 +314,9 @@ class Application_Model_StoredFile {
|
|||
}
|
||||
}
|
||||
|
||||
// don't delete from the playslist. We might want to put a flag
|
||||
//Application_Model_Playlist::DeleteFileFromAllPlaylists($this->getId());
|
||||
if($deleteFromPlaylist){
|
||||
Application_Model_Playlist::DeleteFileFromAllPlaylists($this->getId());
|
||||
}
|
||||
|
||||
// set file_exists falg to false
|
||||
$this->_file->setDbFileExists(false);
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-28765064-1']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
|
@ -24,6 +24,7 @@ record_bitrate = 256
|
|||
record_samplerate = 44100
|
||||
record_channels = 2
|
||||
record_sample_size = 16
|
||||
record_timeout = 3600
|
||||
|
||||
#can be either ogg|mp3, mp3 recording requires installation of the package "lame"
|
||||
record_file_type = 'ogg'
|
|
@ -24,6 +24,7 @@ record_bitrate = 256
|
|||
record_samplerate = 44100
|
||||
record_channels = 2
|
||||
record_sample_size = 16
|
||||
record_timeout = 3600
|
||||
|
||||
#can be either ogg|mp3, mp3 recording requires installation of the package "lame"
|
||||
record_file_type = 'ogg'
|
||||
|
|
|
@ -179,7 +179,7 @@ class CommandListener():
|
|||
self.sr = None
|
||||
self.current_schedule = {}
|
||||
self.shows_to_record = {}
|
||||
self.time_till_next_show = 3600
|
||||
self.time_till_next_show = config["record_timeout"]
|
||||
self.logger.info("RecorderFetch: init complete")
|
||||
self.server_timezone = '';
|
||||
|
||||
|
@ -213,7 +213,7 @@ class CommandListener():
|
|||
self.parse_shows(temp)
|
||||
self.server_timezone = m['server_timezone']
|
||||
elif(command == 'cancel_recording'):
|
||||
if self.sr.is_recording():
|
||||
if self.sr is not None and self.sr.is_recording():
|
||||
self.sr.cancel_recording()
|
||||
|
||||
def parse_shows(self, shows):
|
||||
|
@ -245,7 +245,7 @@ class CommandListener():
|
|||
self.logger.debug("Next show %s", next_show)
|
||||
self.logger.debug("Now %s", tnow)
|
||||
else:
|
||||
out = 3600
|
||||
out = config["record_timeout"]
|
||||
return out
|
||||
|
||||
def start_record(self):
|
||||
|
@ -272,8 +272,7 @@ class CommandListener():
|
|||
self.sr.start()
|
||||
#remove show from shows to record.
|
||||
del self.shows_to_record[start_time]
|
||||
time_till_next_show = self.get_time_till_next_show()
|
||||
self.time_till_next_show = time_till_next_show
|
||||
self.time_till_next_show = self.get_time_till_next_show()
|
||||
except Exception,e :
|
||||
import traceback
|
||||
top = traceback.format_exc()
|
||||
|
@ -306,19 +305,40 @@ class CommandListener():
|
|||
self.logger.error(e)
|
||||
|
||||
loops = 1
|
||||
recording = False
|
||||
|
||||
while True:
|
||||
self.logger.info("Loop #%s", loops)
|
||||
try:
|
||||
# block until 5 seconds before the next show start
|
||||
self.connection.drain_events(timeout=self.time_till_next_show)
|
||||
self.connection.drain_events(timeout=int(self.time_till_next_show))
|
||||
except socket.timeout, s:
|
||||
self.logger.info(s)
|
||||
|
||||
# start_record set time_till_next_show to config["record_timeout"] so we should check before
|
||||
# if timeout amount was 1 hr..
|
||||
update_schedule = False
|
||||
if int(self.time_till_next_show) == int(config["record_timeout"]) :
|
||||
update_schedule = True
|
||||
|
||||
# start recording
|
||||
self.start_record()
|
||||
|
||||
# if real timeout happended get show schedule from airtime
|
||||
if update_schedule :
|
||||
temp = self.api_client.get_shows_to_record()
|
||||
if temp is not None:
|
||||
shows = temp['shows']
|
||||
self.server_timezone = temp['server_timezone']
|
||||
self.parse_shows(shows)
|
||||
self.logger.info("Real Timeout: the schedule has updated")
|
||||
|
||||
except Exception, e:
|
||||
self.logger.info(e)
|
||||
import traceback
|
||||
top = traceback.format_exc()
|
||||
self.logger.error('Exception: %s', e)
|
||||
self.logger.error("traceback: %s", top)
|
||||
time.sleep(3)
|
||||
|
||||
loops += 1
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue