Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
martin 2011-06-28 12:50:15 -04:00
commit e8c36be242
5 changed files with 44 additions and 22 deletions

View File

@ -1,5 +1,6 @@
$(document).ready(function(){
var dialogGlob;
$.get("/Preference/register", {format:"json"}, function(json){
var dialog = $(json.dialog);
dialogGlob = dialog;
@ -51,12 +52,18 @@ $(document).ready(function(){
$("#SupportFeedback").live('click', function(){
var pub = $("#Publicise");
var privacy = $("#Privacy");
var button = $("#help_airtime");
if( !$(this).is(':checked') ){
pub.removeAttr("checked");
pub.attr("disabled", true);
$("#public-info").hide();
button.attr('disabled', 'disabled' ).addClass('ui-state-disabled');
}else{
pub.removeAttr("disabled");
if(privacy.is(':checked')){
button.removeAttr('disabled').removeClass('ui-state-disabled');
}
}
});
@ -69,8 +76,9 @@ $(document).ready(function(){
});
$("#Privacy").live('click', function(){
var support = $("#SupportFeedback");
var button = $("#help_airtime");
if($(this).is(':checked')){
if($(this).is(':checked') && support.is(':checked')){
button.removeAttr('disabled').removeClass('ui-state-disabled');
}else{
button.attr('disabled', 'disabled' ).addClass('ui-state-disabled');

View File

@ -151,7 +151,7 @@ AirtimeInstall::CreateZendPhpLogFile();
$hour = rand(0,23);
$minute = rand(0,59);
$fp = fopen('/etc/cron.d/airtime-crons','a');
$fp = fopen('/etc/cron.d/airtime-crons','w');
fwrite($fp, "$minute $hour * * * root /usr/lib/airtime/utils/phone_home_stat\n");
fclose($fp);

View File

@ -12,9 +12,15 @@ from airtimefilemonitor.airtimeprocessevent import AirtimeProcessEvent
from airtimefilemonitor.mediaconfig import AirtimeMediaConfig
def handleSigTERM(signum, frame):
logger = logging.getLogger()
logger.info("Main Process Shutdown, TERM signal caught. %d")
if p is not None:
for p in processes:
p.terminate()
logger.info("Killed process. %d", p.pid)
notifier_daemon_pid = open('/var/run/airtime-notifier.pid', 'r').read()
os.kill(int(notifier_daemon_pid), 9)
logger.info("Killed process. %d", int(notifier_daemon_pid))
sys.exit(0)
@ -27,7 +33,7 @@ except Exception, e:
sys.exit()
logger = logging.getLogger()
p = None
processes = []
try:
config = AirtimeMediaConfig()
@ -40,7 +46,7 @@ try:
#create 5 worker processes
for i in range(5):
p = Process(target=notifier.process_file_events, args=(pe.multi_queue,))
p.daemon = True
processes.append(p)
p.start()
signal.signal(signal.SIGTERM, handleSigTERM)

View File

@ -31,6 +31,7 @@ class AirtimeProcessEvent(ProcessEvent):
self.supported_file_formats = ['mp3', 'ogg']
self.temp_files = {}
self.moved_files = {}
self.gui_replaced = {}
self.renamed_files = {}
self.file_events = []
self.multi_queue = mpQueue()
@ -222,16 +223,18 @@ class AirtimeProcessEvent(ProcessEvent):
def process_IN_MODIFY(self, event):
if not event.dir:
#self.logger.info("%s: %s", event.maskname, event.pathname)
self.logger.info("%s: %s", event.maskname, event.pathname)
if event.pathname in self.renamed_files:
pass
elif self.is_audio_file(event.name):
self.file_events.append({'filepath': event.pathname, 'mode': self.config.MODE_MODIFY})
def process_IN_MOVED_FROM(self, event):
#self.logger.info("%s: %s", event.maskname, event.pathname)
self.logger.info("%s: %s", event.maskname, event.pathname)
if not event.dir:
if event.pathname in self.temp_files:
if "goutputstream" in event.pathname:
self.gui_replaced[event.cookie] = None
elif event.pathname in self.temp_files:
del self.temp_files[event.pathname]
self.temp_files[event.cookie] = event.pathname
elif event.pathname in self.renamed_files:
@ -240,13 +243,16 @@ class AirtimeProcessEvent(ProcessEvent):
self.moved_files[event.cookie] = event.pathname
def process_IN_MOVED_TO(self, event):
#self.logger.info("%s: %s", event.maskname, event.pathname)
self.logger.info("%s: %s", event.maskname, event.pathname)
#if stuff dropped in stor via a UI move must change file permissions.
self.set_needed_file_permissions(event.pathname, event.dir)
if not event.dir:
if event.cookie in self.temp_files:
del self.temp_files[event.cookie]
self.file_events.append({'filepath': event.pathname, 'mode': self.config.MODE_MODIFY})
elif event.cookie in self.gui_replaced:
del self.gui_replaced[event.cookie]
self.file_events.append({'filepath': event.pathname, 'mode': self.config.MODE_MODIFY})
elif event.cookie in self.moved_files:
old_filepath = self.moved_files[event.cookie]
del self.moved_files[event.cookie]

View File

@ -55,17 +55,19 @@ if (PEAR::isError($CC_DBC)) {
echo "* Connected to database".PHP_EOL;
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
}
$infoArray = Application_Model_Preference::GetSystemInfo(true);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, 'http://stat.sourcefabric.org/index.php?p=airtime');
$data = json_encode($infoArray);
$dataArray = array("data" => $data );
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataArray);
$result = curl_exec($ch);
if(Application_Model_Preference::GetSupportFeedback() == '1'){
$infoArray = Application_Model_Preference::GetSystemInfo(true);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, 'http://stat.sourcefabric.org/index.php?p=airtime');
$data = json_encode($infoArray);
$dataArray = array("data" => $data );
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataArray);
$result = curl_exec($ch);
}
?>