Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
c5b1e23486
|
@ -603,7 +603,6 @@ class ApiController extends Zend_Controller_Action
|
||||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||||
$filepath = str_replace("\\", "", $filepath);
|
$filepath = str_replace("\\", "", $filepath);
|
||||||
$file->setFilePath($filepath);
|
$file->setFilePath($filepath);
|
||||||
//$file->setMetadata($md);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($mode == "delete") {
|
else if ($mode == "delete") {
|
||||||
|
|
|
@ -134,7 +134,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
||||||
'readonly' => true,
|
'readonly' => true,
|
||||||
'rows' => 5,
|
'rows' => 5,
|
||||||
'cols' => 61,
|
'cols' => 61,
|
||||||
'value' => Application_Model_Preference::GetSystemInfo(),
|
'value' => Application_Model_Preference::GetSystemInfo(false, true),
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
|
|
|
@ -139,7 +139,7 @@ class Application_Form_SupportSettings extends Zend_Form
|
||||||
'readonly' => true,
|
'readonly' => true,
|
||||||
'cols' => 61,
|
'cols' => 61,
|
||||||
'rows' => 5,
|
'rows' => 5,
|
||||||
'value' => Application_Model_Preference::GetSystemInfo(),
|
'value' => Application_Model_Preference::GetSystemInfo(false, true),
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
|
|
|
@ -32,10 +32,18 @@ class Application_Model_LiveLog
|
||||||
$duration = $start->diff($end);
|
$duration = $start->diff($end);
|
||||||
$duration = $duration->format("%H:%i:%s");
|
$duration = $duration->format("%H:%i:%s");
|
||||||
$intervals = explode(":", $duration);
|
$intervals = explode(":", $duration);
|
||||||
|
for ($i = 0; $i < sizeof($intervals); $i++) {
|
||||||
|
if (!isset($intervals[$i])) {
|
||||||
|
$intervals[$i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Trim milliseconds (DateInterval does not support)
|
// Trim milliseconds (DateInterval does not support)
|
||||||
$sec = explode(".", $intervals[2]);
|
$sec = explode(".", $intervals[2]);
|
||||||
$intervals[2] = $sec[0];
|
if (isset($sec[0])) {
|
||||||
|
$intervals[2] = $sec[0];
|
||||||
|
}
|
||||||
|
|
||||||
$seconds += $intervals[2];
|
$seconds += $intervals[2];
|
||||||
if ($seconds / 60 >= 1) {
|
if ($seconds / 60 >= 1) {
|
||||||
$minutes += 1;
|
$minutes += 1;
|
||||||
|
@ -59,9 +67,12 @@ class Application_Model_LiveLog
|
||||||
}
|
}
|
||||||
//Trim milliseconds
|
//Trim milliseconds
|
||||||
$seconds = explode(".", $seconds);
|
$seconds = explode(".", $seconds);
|
||||||
$minutes = (double)(($hours*60)+$minutes . "." . $seconds[0]);
|
if (isset($seconds[0])) {
|
||||||
//$duration = new DateInterval("PT" . $minutes . "M" . $seconds[0] ."S");
|
$minutes = (double)(($hours*60)+$minutes . "." . $seconds[0]);
|
||||||
//return $duration->format("%i.%s");
|
}
|
||||||
|
else {
|
||||||
|
$minutes = (double)(($hours*60)+$minutes);
|
||||||
|
}
|
||||||
return $minutes;
|
return $minutes;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
header('HTTP/1.0 503 Service Unavailable');
|
header('HTTP/1.0 503 Service Unavailable');
|
||||||
|
@ -70,7 +81,7 @@ class Application_Model_LiveLog
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetScheduledDuration($p_keepData = false)
|
public static function GetScheduledDuration($p_keepData=false)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
@ -118,11 +129,21 @@ class Application_Model_LiveLog
|
||||||
$clip_length = $track['clip_length'];
|
$clip_length = $track['clip_length'];
|
||||||
//Convert clip_length into seconds
|
//Convert clip_length into seconds
|
||||||
$clip_length_intervals = explode(":", $clip_length);
|
$clip_length_intervals = explode(":", $clip_length);
|
||||||
|
for ($i = 0; $i < sizeof($clip_length_intervals); $i++) {
|
||||||
|
if (!isset($clip_length_intervals[$i])) {
|
||||||
|
$clip_length_intervals[$i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
$clip_length_seconds = $clip_length_intervals[0]*3600 + $clip_length_intervals[1]*60 + $clip_length_intervals[2];
|
$clip_length_seconds = $clip_length_intervals[0]*3600 + $clip_length_intervals[1]*60 + $clip_length_intervals[2];
|
||||||
|
|
||||||
$extra_time = $extra_time->format("%H:%i:%s");
|
$extra_time = $extra_time->format("%H:%i:%s");
|
||||||
//Convert extra_time into seconds;
|
//Convert extra_time into seconds;
|
||||||
$extra_time_intervals = explode(":", $extra_time);
|
$extra_time_intervals = explode(":", $extra_time);
|
||||||
|
for ($i = 0; $i < sizeof($extra_time_intervals); $i++) {
|
||||||
|
if (!isset($extra_time_intervals[$i])) {
|
||||||
|
$extra_time_intervals[$i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
$extra_time_seconds = $extra_time_intervals[0]*3600 + $extra_time_intervals[1]*60 + $extra_time_intervals[2];
|
$extra_time_seconds = $extra_time_intervals[0]*3600 + $extra_time_intervals[1]*60 + $extra_time_intervals[2];
|
||||||
|
|
||||||
$clip_length_seconds -= $extra_time_seconds;
|
$clip_length_seconds -= $extra_time_seconds;
|
||||||
|
@ -152,9 +173,16 @@ class Application_Model_LiveLog
|
||||||
}
|
}
|
||||||
|
|
||||||
$intervals = explode(":", $clip_length);
|
$intervals = explode(":", $clip_length);
|
||||||
|
for ($i = 0; $i < sizeof($intervals); $i++) {
|
||||||
|
if (!isset($intervals[$i])) {
|
||||||
|
$intervals[$i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Trim milliseconds (DateInteral does not support)
|
// Trim milliseconds (DateInteral does not support)
|
||||||
$sec = explode(".", $intervals[2]);
|
$sec = explode(".", $intervals[2]);
|
||||||
$intervals[2] = $sec[0];
|
if (isset($sec[0])) {
|
||||||
|
$intervals[2] = $sec[0];
|
||||||
|
}
|
||||||
|
|
||||||
$seconds += $intervals[2];
|
$seconds += $intervals[2];
|
||||||
if ($seconds / 60 >= 1) {
|
if ($seconds / 60 >= 1) {
|
||||||
|
@ -181,9 +209,12 @@ class Application_Model_LiveLog
|
||||||
|
|
||||||
|
|
||||||
$seconds = explode(".", $seconds);
|
$seconds = explode(".", $seconds);
|
||||||
$minutes = (double)(($hours*60)+$minutes . "." . $seconds[0]);
|
if (isset($seconds[0])) {
|
||||||
//$duration = new DateInterval("PT". $minutes . "M" . $seconds[0] ."S");
|
$minutes = (double)(($hours*60)+$minutes . "." . $seconds[0]);
|
||||||
//return $duration->format("%i.%s");
|
}
|
||||||
|
else {
|
||||||
|
$minutes = (double)(($hours*60)+$minutes);
|
||||||
|
}
|
||||||
return $minutes;
|
return $minutes;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
header('HTTP/1.0 503 Service Unavailable');
|
header('HTTP/1.0 503 Service Unavailable');
|
||||||
|
|
|
@ -400,7 +400,6 @@ class Application_Model_Preference
|
||||||
public static function GetSystemInfo($returnArray=false, $p_testing=false)
|
public static function GetSystemInfo($returnArray=false, $p_testing=false)
|
||||||
{
|
{
|
||||||
exec('/usr/bin/airtime-check-system --no-color', $output);
|
exec('/usr/bin/airtime-check-system --no-color', $output);
|
||||||
|
|
||||||
$output = preg_replace('/\s+/', ' ', $output);
|
$output = preg_replace('/\s+/', ' ', $output);
|
||||||
|
|
||||||
$systemInfoArray = array();
|
$systemInfoArray = array();
|
||||||
|
@ -409,7 +408,12 @@ class Application_Model_Preference
|
||||||
if(isset($info[1])){
|
if(isset($info[1])){
|
||||||
$key = str_replace(' ', '_', trim($info[0]));
|
$key = str_replace(' ', '_', trim($info[0]));
|
||||||
$key = strtoupper($key);
|
$key = strtoupper($key);
|
||||||
$systemInfoArray[$key] = $info[1];
|
if ($key == 'WEB_SERVER' || $key == 'CPU' || $key == 'OS' || $key == 'TOTAL_RAM' ||
|
||||||
|
$key == 'FREE_RAM' || $key == 'AIRTIME_VERSION' || $key == 'KERNAL_VERSION' ||
|
||||||
|
$key == 'MACHINE_ARCHITECTURE' || $key == 'TOTAL_MEMORY_MBYTES' || $key == 'TOTAL_SWAP_MBYTES' ||
|
||||||
|
$key == 'PLAYOUT_ENGINE_CPU_PERC' ) {
|
||||||
|
$systemInfoArray[$key] = $info[1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,26 +465,24 @@ class Application_Model_Preference
|
||||||
|
|
||||||
$outputString = "\n";
|
$outputString = "\n";
|
||||||
foreach($outputArray as $key => $out){
|
foreach($outputArray as $key => $out){
|
||||||
if($key == 'SAAS' && ($out != '' || $out != 'disabled')){
|
if($key == 'TRIAL_END_DATE' && ($out != '' || $out != 'NULL')){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if($out != '' || is_numeric($out)){
|
if($key == "STREAM_INFO"){
|
||||||
if($key == "STREAM_INFO"){
|
$outputString .= $key." :\n";
|
||||||
$outputString .= $key." :\n";
|
foreach($out as $s_info){
|
||||||
foreach($out as $s_info){
|
foreach($s_info as $k => $v){
|
||||||
foreach($s_info as $k => $v){
|
$outputString .= "\t".strtoupper($k)." : ".$v."\n";
|
||||||
$outputString .= "\t".strtoupper($k)." : ".$v."\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}else if ($key == "SOUNDCLOUD_ENABLED") {
|
|
||||||
if ($out) {
|
|
||||||
$outputString .= $key." : TRUE\n";
|
|
||||||
} else if (!$out) {
|
|
||||||
$outputString .= $key." : FALSE\n";
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
$outputString .= $key.' : '.$out."\n";
|
|
||||||
}
|
}
|
||||||
|
}else if ($key == "SOUNDCLOUD_ENABLED") {
|
||||||
|
if ($out) {
|
||||||
|
$outputString .= $key." : TRUE\n";
|
||||||
|
} else if (!$out) {
|
||||||
|
$outputString .= $key." : FALSE\n";
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$outputString .= $key.' : '.$out."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($returnArray){
|
if($returnArray){
|
||||||
|
|
|
@ -82,7 +82,7 @@ class Application_Model_RabbitMq
|
||||||
|
|
||||||
$temp['event_type'] = $event_type;
|
$temp['event_type'] = $event_type;
|
||||||
$temp['server_timezone'] = Application_Model_Preference::GetTimezone();
|
$temp['server_timezone'] = Application_Model_Preference::GetTimezone();
|
||||||
if($event_type = "update_recorder_schedule"){
|
if($event_type == "update_recorder_schedule"){
|
||||||
$temp['shows'] = Application_Model_Show::getShows($now, $end_timestamp, $excludeInstance=NULL, $onlyRecord=TRUE);
|
$temp['shows'] = Application_Model_Show::getShows($now, $end_timestamp, $excludeInstance=NULL, $onlyRecord=TRUE);
|
||||||
}
|
}
|
||||||
$data = json_encode($temp);
|
$data = json_encode($temp);
|
||||||
|
|
|
@ -651,15 +651,16 @@ class Application_Model_Scheduler {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->removeItems($remove, false);
|
$this->removeItems($remove, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$instance->setDbEnds($this->nowDT);
|
|
||||||
$instance->save($this->con);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$instance->delete($this->con);
|
$rebroadcasts = $instance->getCcShowInstancessRelatedByDbId(null, $this->con);
|
||||||
}
|
$rebroadcasts->delete($this->con);
|
||||||
|
}
|
||||||
|
|
||||||
|
$instance->setDbEnds($this->nowDT);
|
||||||
|
$instance->save($this->con);
|
||||||
|
|
||||||
$this->con->commit();
|
$this->con->commit();
|
||||||
|
|
||||||
if ($instance->getDbRecord()) {
|
if ($instance->getDbRecord()) {
|
||||||
|
|
|
@ -1753,8 +1753,7 @@ class Application_Model_Show {
|
||||||
." AND modified_instance != TRUE"
|
." AND modified_instance != TRUE"
|
||||||
." ORDER BY si.starts";
|
." ORDER BY si.starts";
|
||||||
|
|
||||||
// Convert back to local timezone
|
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$rows = $con->query($sql)->fetchAll();
|
|
||||||
$numberOfRows = count($rows);
|
$numberOfRows = count($rows);
|
||||||
|
|
||||||
$results['previousShow'] = array();
|
$results['previousShow'] = array();
|
||||||
|
@ -1771,6 +1770,7 @@ class Application_Model_Show {
|
||||||
"id"=>$rows[$i-1]['id'],
|
"id"=>$rows[$i-1]['id'],
|
||||||
"instance_id"=>$rows[$i-1]['instance_id'],
|
"instance_id"=>$rows[$i-1]['instance_id'],
|
||||||
"name"=>$rows[$i-1]['name'],
|
"name"=>$rows[$i-1]['name'],
|
||||||
|
"url"=>$rows[$i-1]['url'],
|
||||||
"start_timestamp"=>$rows[$i-1]['start_timestamp'],
|
"start_timestamp"=>$rows[$i-1]['start_timestamp'],
|
||||||
"end_timestamp"=>$rows[$i-1]['end_timestamp'],
|
"end_timestamp"=>$rows[$i-1]['end_timestamp'],
|
||||||
"starts"=>$rows[$i-1]['starts'],
|
"starts"=>$rows[$i-1]['starts'],
|
||||||
|
@ -1784,6 +1784,7 @@ class Application_Model_Show {
|
||||||
"id"=>$rows[$i+1]['id'],
|
"id"=>$rows[$i+1]['id'],
|
||||||
"instance_id"=>$rows[$i+1]['instance_id'],
|
"instance_id"=>$rows[$i+1]['instance_id'],
|
||||||
"name"=>$rows[$i+1]['name'],
|
"name"=>$rows[$i+1]['name'],
|
||||||
|
"url"=>$rows[$i+1]['url'],
|
||||||
"start_timestamp"=>$rows[$i+1]['start_timestamp'],
|
"start_timestamp"=>$rows[$i+1]['start_timestamp'],
|
||||||
"end_timestamp"=>$rows[$i+1]['end_timestamp'],
|
"end_timestamp"=>$rows[$i+1]['end_timestamp'],
|
||||||
"starts"=>$rows[$i+1]['starts'],
|
"starts"=>$rows[$i+1]['starts'],
|
||||||
|
@ -1802,6 +1803,7 @@ class Application_Model_Show {
|
||||||
"id"=>$rows[$i]['id'],
|
"id"=>$rows[$i]['id'],
|
||||||
"instance_id"=>$rows[$i]['instance_id'],
|
"instance_id"=>$rows[$i]['instance_id'],
|
||||||
"name"=>$rows[$i]['name'],
|
"name"=>$rows[$i]['name'],
|
||||||
|
"url"=>$rows[$i]['url'],
|
||||||
"start_timestamp"=>$rows[$i]['start_timestamp'],
|
"start_timestamp"=>$rows[$i]['start_timestamp'],
|
||||||
"end_timestamp"=>$rows[$i]['end_timestamp'],
|
"end_timestamp"=>$rows[$i]['end_timestamp'],
|
||||||
"starts"=>$rows[$i]['starts'],
|
"starts"=>$rows[$i]['starts'],
|
||||||
|
|
|
@ -543,9 +543,6 @@ class Application_Model_ShowInstance {
|
||||||
}
|
}
|
||||||
|
|
||||||
Application_Model_RabbitMq::PushSchedule();
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
if($recording){
|
|
||||||
Application_Model_RabbitMq::SendMessageToShowRecorder("cancel_recording");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setRecordedFile($file_id)
|
public function setRecordedFile($file_id)
|
||||||
|
@ -577,7 +574,7 @@ class Application_Model_ShowInstance {
|
||||||
{
|
{
|
||||||
$time = $this->_showInstance->getDbTimeFilled();
|
$time = $this->_showInstance->getDbTimeFilled();
|
||||||
|
|
||||||
if ($time != "00:00:00") {
|
if ($time != "00:00:00" && $time != null && strcmp($time, '')!=0) {
|
||||||
$time_arr = explode(".", $time);
|
$time_arr = explode(".", $time);
|
||||||
if (count($time_arr) > 1) {
|
if (count($time_arr) > 1) {
|
||||||
$time_arr[1] = "." . $time_arr[1];
|
$time_arr[1] = "." . $time_arr[1];
|
||||||
|
|
|
@ -92,7 +92,9 @@ class Application_Model_StoredFile {
|
||||||
else {
|
else {
|
||||||
$dbMd = array();
|
$dbMd = array();
|
||||||
foreach ($p_md as $mdConst => $mdValue) {
|
foreach ($p_md as $mdConst => $mdValue) {
|
||||||
$dbMd[constant($mdConst)] = $mdValue;
|
if (defined($mdConst)){
|
||||||
|
$dbMd[constant($mdConst)] = $mdValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->setDbColMetadata($dbMd);
|
$this->setDbColMetadata($dbMd);
|
||||||
}
|
}
|
||||||
|
@ -703,7 +705,7 @@ Logging::log("getting media! - 2");
|
||||||
$row['image'] = '<img title="Track preview" src="/css/images/icon_audioclip.png">';
|
$row['image'] = '<img title="Track preview" src="/css/images/icon_audioclip.png">';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$row['image'] = '<img src="/css/images/icon_playlist.png">';
|
$row['image'] = '<img title="Playlist preview" src="/css/images/icon_playlist.png">';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ function confirmCancelShow(show_instance_id){
|
||||||
}
|
}
|
||||||
|
|
||||||
function confirmCancelRecordedShow(show_instance_id){
|
function confirmCancelRecordedShow(show_instance_id){
|
||||||
if (confirm('Erase current show and stop recording?')) {
|
if (confirm('Stop recording current show?')) {
|
||||||
var url = "/Schedule/cancel-current-show";
|
var url = "/Schedule/cancel-current-show";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
|
|
|
@ -849,7 +849,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
data = $tr.data("aData");
|
data = $tr.data("aData");
|
||||||
|
|
||||||
if (data.record === true) {
|
if (data.record === true) {
|
||||||
msg = 'Erase current show and stop recording?';
|
msg = 'Stop recording current show?';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (confirm(msg)) {
|
if (confirm(msg)) {
|
||||||
|
|
|
@ -105,6 +105,17 @@ if [ "$LSOF_EXIST" != "0" -o "$SUDO_EXIST" != "0" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "* Making sure /etc/default/locale is set properly"
|
||||||
|
set +e
|
||||||
|
update-locale
|
||||||
|
cat /etc/default/locale | grep -i "LANG=.*UTF-\?8"
|
||||||
|
set -e
|
||||||
|
if [ "$?" != "0" ]; then
|
||||||
|
echo "non UTF-8 default locale found in /etc/default/locale."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Check if airtime exists already
|
# Check if airtime exists already
|
||||||
set +e
|
set +e
|
||||||
php --php-ini ${SCRIPTPATH}/airtime-php.ini ${SCRIPTPATH}/include/airtime-installed-check.php
|
php --php-ini ${SCRIPTPATH}/airtime-php.ini ${SCRIPTPATH}/include/airtime-installed-check.php
|
||||||
|
|
|
@ -14,7 +14,16 @@ cd ${media_monitor_path}
|
||||||
|
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
|
set +e
|
||||||
|
cat /etc/default/locale | grep -i "LANG=.*UTF-\?8"
|
||||||
|
set -e
|
||||||
|
if [ "$?" != "0" ]; then
|
||||||
|
echo "non UTF-8 default locale found in /etc/default/locale." > /var/log/airtime/media-monitor/error.log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
export PYTHONPATH=${api_client_path}
|
export PYTHONPATH=${api_client_path}
|
||||||
|
export LC_ALL=`cat /etc/default/locale | grep "LANG=" | cut -d= -f2 | tr -d "\n\""`
|
||||||
|
|
||||||
# Note the -u when calling python! we need it to get unbuffered binary stdout and stderr
|
# Note the -u when calling python! we need it to get unbuffered binary stdout and stderr
|
||||||
exec python -u ${media_monitor_path}${media_monitor_script} > /var/log/airtime/media-monitor/py-interpreter.log 2>&1
|
exec python -u ${media_monitor_path}${media_monitor_script} > /var/log/airtime/media-monitor/py-interpreter.log 2>&1
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import pyinotify
|
import pyinotify
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import hashlib
|
import hashlib
|
||||||
import mutagen
|
import mutagen
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import socket
|
import socket
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
@ -217,7 +219,7 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
#directory.
|
#directory.
|
||||||
def process_IN_MOVED_FROM(self, event):
|
def process_IN_MOVED_FROM(self, event):
|
||||||
|
|
||||||
#we only care about files that have been moved away from imported/ or organize/ dir
|
#we don't care about files that have been moved from problem_directory
|
||||||
if event.path in self.config.problem_directory:
|
if event.path in self.config.problem_directory:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from configobj import ConfigObj
|
from configobj import ConfigObj
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import grp
|
import grp
|
||||||
import pwd
|
import pwd
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from mediaconfig import AirtimeMediaConfig
|
from mediaconfig import AirtimeMediaConfig
|
||||||
import traceback
|
import traceback
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
|
@ -45,7 +47,9 @@ def configure_locale():
|
||||||
else:
|
else:
|
||||||
new_locale = default_locale
|
new_locale = default_locale
|
||||||
|
|
||||||
logger.debug("New locale set to: " + locale.setlocale(locale.LC_ALL, new_locale))
|
logger.info("New locale set to: %s", locale.setlocale(locale.LC_ALL, new_locale))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
reload(sys)
|
reload(sys)
|
||||||
sys.setdefaultencoding("UTF-8")
|
sys.setdefaultencoding("UTF-8")
|
||||||
|
|
|
@ -12,8 +12,17 @@ pypo_script="pypocli.py"
|
||||||
cd ${pypo_path}
|
cd ${pypo_path}
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
|
|
||||||
|
set +e
|
||||||
|
cat /etc/default/locale | grep -i "LANG=.*UTF-\?8"
|
||||||
|
set -e
|
||||||
|
if [ "$?" != "0" ]; then
|
||||||
|
echo "non UTF-8 default locale found in /etc/default/locale." > /var/log/airtime/pypo/error.log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
export HOME="/var/tmp/airtime/pypo/"
|
export HOME="/var/tmp/airtime/pypo/"
|
||||||
export PYTHONPATH=${api_client_path}:$PYTHONPATH
|
export PYTHONPATH=${api_client_path}:$PYTHONPATH
|
||||||
|
export LC_ALL=`cat /etc/default/locale | grep "LANG=" | cut -d= -f2 | tr -d "\n\""`
|
||||||
|
|
||||||
# Note the -u when calling python! we need it to get unbuffered binary stdout and stderr
|
# Note the -u when calling python! we need it to get unbuffered binary stdout and stderr
|
||||||
exec python -u ${pypo_path}${pypo_script} > /var/log/airtime/pypo/py-interpreter.log 2>&1
|
exec python -u ${pypo_path}${pypo_script} > /var/log/airtime/pypo/py-interpreter.log 2>&1
|
||||||
|
|
|
@ -51,6 +51,7 @@ parser.add_option("-c", "--check", help="Check the cached schedule and exit", de
|
||||||
#logging.captureWarnings(True)
|
#logging.captureWarnings(True)
|
||||||
|
|
||||||
def configure_locale():
|
def configure_locale():
|
||||||
|
logger.debug("Before %s", locale.nl_langinfo(locale.CODESET))
|
||||||
current_locale = locale.getlocale()
|
current_locale = locale.getlocale()
|
||||||
|
|
||||||
if current_locale[1] is None:
|
if current_locale[1] is None:
|
||||||
|
@ -69,13 +70,19 @@ def configure_locale():
|
||||||
else:
|
else:
|
||||||
new_locale = default_locale
|
new_locale = default_locale
|
||||||
|
|
||||||
logger.debug("New locale set to: " + locale.setlocale(locale.LC_ALL, new_locale))
|
logger.info("New locale set to: %s", locale.setlocale(locale.LC_ALL, new_locale))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
reload(sys)
|
||||||
|
sys.setdefaultencoding("UTF-8")
|
||||||
current_locale_encoding = locale.getlocale()[1].lower()
|
current_locale_encoding = locale.getlocale()[1].lower()
|
||||||
|
logger.debug("sys default encoding %s", sys.getdefaultencoding())
|
||||||
|
logger.debug("After %s", locale.nl_langinfo(locale.CODESET))
|
||||||
|
|
||||||
if current_locale_encoding not in ['utf-8', 'utf8']:
|
if current_locale_encoding not in ['utf-8', 'utf8']:
|
||||||
logger.error("Need a UTF-8 locale. Currently '%s'. Exiting..." % current_locale_encoding)
|
logger.error("Need a UTF-8 locale. Currently '%s'. Exiting..." % current_locale_encoding)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# configure logging
|
# configure logging
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from Queue import Empty
|
from Queue import Empty
|
||||||
from configobj import ConfigObj
|
from configobj import ConfigObj
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
import json
|
import json
|
||||||
|
|
|
@ -34,7 +34,7 @@ class AirtimeCheck {
|
||||||
{
|
{
|
||||||
// Need to check that we are superuser before running this.
|
// Need to check that we are superuser before running this.
|
||||||
$euid = posix_geteuid();
|
$euid = posix_geteuid();
|
||||||
$user = posix_getlogin();
|
$user = exec('whoami');
|
||||||
if($euid != 0 && $user != "www-data"){
|
if($euid != 0 && $user != "www-data"){
|
||||||
echo "Must be root user.\n";
|
echo "Must be root user.\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -282,7 +282,7 @@ function ScheduleData(data){
|
||||||
|
|
||||||
|
|
||||||
this.schedulePosixTime = convertDateToPosixTime(data.schedulerTime);
|
this.schedulePosixTime = convertDateToPosixTime(data.schedulerTime);
|
||||||
this.schedulePosixTime += parseInt(data.timezoneOffset)*1000;
|
//this.schedulePosixTime += parseInt(data.timezoneOffset, 10)*1000;
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
this.localRemoteTimeOffset = date.getTime() - this.schedulePosixTime;
|
this.localRemoteTimeOffset = date.getTime() - this.schedulePosixTime;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue