diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index f3bf8f561..9bcba177d 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -13,6 +13,7 @@ require_once 'DB.php'; require_once 'Preference.php'; require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php'; +require_once 'soundcloud-api/Services/Soundcloud.php'; global $CC_CONFIG, $CC_DBC; $dsn = $CC_CONFIG['dsn']; diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php index 0ec295c26..50008e3f8 100644 --- a/airtime_mvc/application/configs/constants.php +++ b/airtime_mvc/application/configs/constants.php @@ -37,6 +37,6 @@ define('UI_PLAYLIST_SESSNAME', 'PLAYLIST'); // Soundcloud contants -define('SOUNDCLOUD_NULL', -1); +define('SOUNDCLOUD_NOT_UPLOADED_YET', -1); define('SOUNDCLOUD_PROGRESS', -2); define('SOUNDCLOUD_ERROR', -3); diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 7d5eb0006..cd6f64da6 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -400,7 +400,7 @@ class ApiController extends Zend_Controller_Action $tags = array_merge($hosts, array($show_name)); try { - $soundcloud = new Application_Model_AtSoundcloud(); + $soundcloud = new Application_Model_Soundcloud(); $soundcloud_id = $soundcloud->uploadTrack($file->getFilePath(), $tmpTitle, $description, $tags, $show_start_time, $show_genre); $file->setSoundCloudFileId($soundcloud_id); break; diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index 28987eb81..c69014689 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -91,7 +91,7 @@ class LibraryController extends Zend_Controller_Action $menu[] = array('action' => array('type' => 'gourl', 'url' => $url), 'title' => 'Download'); - if (Application_Model_Preference::GetDoSoundCloudUpload()) { + if (Application_Model_Preference::GetUploadToSoundcloudOption()) { $text = "Upload to Soundcloud"; if(!is_null($file->getSoundCloudId())){ $text = "Re-upload to Soundcloud"; @@ -213,7 +213,10 @@ class LibraryController extends Zend_Controller_Action $file->setDbColMetadata($formdata); $data = $file->getMetadata(); - + + // set MDATA_KEY_FILEPATH + $data['MDATA_KEY_FILEPATH'] = $file->getFilePath(); + Logging::log($data['MDATA_KEY_FILEPATH']); Application_Model_RabbitMq::SendMessageToMediaMonitor("md_update", $data); $this->_helper->redirector('index'); diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index 64d7ae4a0..25db6011b 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -37,6 +37,8 @@ class PreferenceController extends Zend_Controller_Action Application_Model_Preference::SetTimezone($values["preferences_general"]["timezone"]); Application_Model_Preference::SetDoSoundCloudUpload($values["preferences_soundcloud"]["UseSoundCloud"]); + Application_Model_Preference::SetUploadToSoundcloudOption($values["preferences_soundcloud"]["UploadToSoundcloudOption"]); + Application_Model_Preference::SetSoundCloudDownloadbleOption($values["preferences_soundcloud"]["SoundCloudDownloadbleOption"]); Application_Model_Preference::SetSoundCloudUser($values["preferences_soundcloud"]["SoundCloudUser"]); Application_Model_Preference::SetSoundCloudPassword($values["preferences_soundcloud"]["SoundCloudPassword"]); Application_Model_Preference::SetSoundCloudTags($values["preferences_soundcloud"]["SoundCloudTags"]); diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index d1ed1674d..6555f02ed 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -47,6 +47,7 @@ class ScheduleController extends Zend_Controller_Action $this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/full-calendar-functions.js','text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/add-show.js','text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/schedule.js','text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js','text/javascript'); $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery-ui-timepicker.css'); $this->view->headLink()->appendStylesheet($baseUrl.'/css/fullcalendar.css'); @@ -175,7 +176,7 @@ class ScheduleController extends Zend_Controller_Action if ($showEndDateHelper->getTimestamp() <= $epochNow && $show->isRecorded() - && Application_Model_Preference::GetDoSoundCloudUpload()) { + && Application_Model_Preference::GetUploadToSoundcloudOption()) { if(is_null($show->getSoundCloudFileId())){ $menu[] = array('action' => array('type' => 'fn', 'callback' => "window['uploadToSoundCloud']($id)"), diff --git a/airtime_mvc/application/forms/AddShowWhen.php b/airtime_mvc/application/forms/AddShowWhen.php index 3ed5d35b0..65079a21d 100644 --- a/airtime_mvc/application/forms/AddShowWhen.php +++ b/airtime_mvc/application/forms/AddShowWhen.php @@ -20,6 +20,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm 'ViewHelper', 'Description', array('Label', array('tag' =>'dt')))); + $startDate->setAttrib('alt', 'date'); $this->addElement($startDate); // Add start time element @@ -36,6 +37,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm 'ViewHelper', 'Errors', array(array('close'=>'HtmlTag'), array('tag' => 'dd', 'closeOnly'=>true)))); + $startTime->setAttrib('alt', 'time'); $this->addElement($startTime); // Add end date element @@ -53,6 +55,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm 'ViewHelper', 'Description', array('Label', array('tag' =>'dt')))); + $endDate->setAttrib('alt', 'date'); $this->addElement($endDate); // Add end time element @@ -69,6 +72,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm 'ViewHelper', 'Errors', array(array('close'=>'HtmlTag'), array('tag' => 'dd', 'closeOnly'=>true)))); + $endTime->setAttrib('alt', 'time'); $this->addElement($endTime); // Add duration element diff --git a/airtime_mvc/application/forms/SoundcloudPreferences.php b/airtime_mvc/application/forms/SoundcloudPreferences.php index 8639c675b..b9c4c782d 100644 --- a/airtime_mvc/application/forms/SoundcloudPreferences.php +++ b/airtime_mvc/application/forms/SoundcloudPreferences.php @@ -11,13 +11,33 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm //enable soundcloud uploads $this->addElement('checkbox', 'UseSoundCloud', array( - 'label' => 'Upload Recorded Shows To SoundCloud', + 'label' => 'Automatically Upload Recorded Shows', 'required' => false, 'value' => Application_Model_Preference::GetDoSoundCloudUpload(), 'decorators' => array( 'ViewHelper' ) - )); + )); + + //enable soundcloud uploads option + $this->addElement('checkbox', 'UploadToSoundcloudOption', array( + 'label' => 'Enable Soundcloud Upload', + 'required' => false, + 'value' => Application_Model_Preference::GetUploadToSoundcloudOption(), + 'decorators' => array( + 'ViewHelper' + ) + )); + + //enable downloadable for soundcloud + $this->addElement('checkbox', 'SoundCloudDownloadbleOption', array( + 'label' => 'Automatically Mark Files "Downloadable" on SoundCloud', + 'required' => false, + 'value' => Application_Model_Preference::GetSoundCloudDownloadbleOption(), + 'decorators' => array( + 'ViewHelper' + ) + )); //SoundCloud Username $this->addElement('text', 'SoundCloudUser', array( diff --git a/airtime_mvc/application/layouts/scripts/library.phtml b/airtime_mvc/application/layouts/scripts/library.phtml index e04678c0b..f84bd868c 100644 --- a/airtime_mvc/application/layouts/scripts/library.phtml +++ b/airtime_mvc/application/layouts/scripts/library.phtml @@ -20,7 +20,7 @@
-
layout()->library ?>
+
layout()->library ?>
layout()->spl ?>
diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index bd55a28eb..fb361501f 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -432,11 +432,30 @@ class Application_Model_Preference } public static function GetEnableStreamConf(){ + if(self::GetValue("enable_stream_conf") == Null){ + return "true"; + } return self::GetValue("enable_stream_conf"); } public static function GetAirtimeVersion(){ return self::GetValue("system_version"); } + + public static function SetUploadToSoundcloudOption($upload) { + self::SetValue("soundcloud_upload_option", $upload); + } + + public static function GetUploadToSoundcloudOption() { + return self::GetValue("soundcloud_upload_option"); + } + + public static function SetSoundCloudDownloadbleOption($upload) { + self::SetValue("soundcloud_downloadable", $upload); + } + + public static function GetSoundCloudDownloadbleOption() { + return self::GetValue("soundcloud_downloadable"); + } } diff --git a/airtime_mvc/application/models/Soundcloud.php b/airtime_mvc/application/models/Soundcloud.php index 29ad98772..c962a5646 100644 --- a/airtime_mvc/application/models/Soundcloud.php +++ b/airtime_mvc/application/models/Soundcloud.php @@ -1,8 +1,6 @@ 'private', 'track[title]' => $filename, 'track[asset_data]' => '@' . $filepath, 'track[tag_list]' => $tags, 'track[description]' => $description, - 'track[downloadable]' => true, + 'track[downloadable]' => $downloadable, ); diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 4bb172c8b..15ffa6d28 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -931,21 +931,20 @@ class Application_Model_StoredFile { public function uploadToSoundCloud() { global $CC_CONFIG; - + $file = $this->_file; if(is_null($file)) { return "File does not exist"; } - if(Application_Model_Preference::GetDoSoundCloudUpload()) + if(Application_Model_Preference::GetUploadToSoundcloudOption()) { for($i=0; $i<$CC_CONFIG['soundcloud-connection-retries']; $i++) { $description = $file->getDbTrackTitle(); $tag = ""; $genre = $file->getDbGenre(); $release = $file->getDbYear(); - try { - $soundcloud = new Application_Model_AtSoundcloud(); + $soundcloud = new Application_Model_Soundcloud(); $soundcloud_id = $soundcloud->uploadTrack($this->getFilePath(), $this->getName(), $description, $tag, $release, $genre); $this->setSoundCloudFileId($soundcloud_id); break; diff --git a/airtime_mvc/application/views/scripts/form/preferences_soundcloud.phtml b/airtime_mvc/application/views/scripts/form/preferences_soundcloud.phtml index 3ee3ad54e..99456616a 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_soundcloud.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_soundcloud.phtml @@ -1,6 +1,19 @@
-
+
+ + element->getElement('UploadToSoundcloudOption')->hasErrors()) : ?> +
    + element->getElement('UploadToSoundcloudOption')->getMessages() as $error): ?> +
  • + +
+ +
+
+
+ + element->getElement('SoundCloudDownloadbleOption')->hasErrors()) : ?> +
    + element->getElement('SoundCloudDownloadbleOption')->getMessages() as $error): ?> +
  • + +
+ +
diff --git a/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml b/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml index 5d36c5dfc..66c12949b 100644 --- a/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml +++ b/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml @@ -2,7 +2,7 @@ $s_name = "s".$this->stream_number; ?>

Stream stream_number?>

-
+
stream_number != '1'?'style="display: none;':''?> id="-config">
@@ -64,10 +64,10 @@ Additional Options
-
+
-
+
element->getElement('user')?> element->getElement('user')->hasErrors()) : ?>
    @@ -77,10 +77,10 @@
-
+
-
+
element->getElement('pass')?> element->getElement('pass')->hasErrors()) : ?>
    @@ -93,10 +93,10 @@
    The following info will be displayed to listeners in their media player:
    -
    +
    -
    +
    element->getElement('description')?> element->getElement('description')->hasErrors()) : ?>
      @@ -106,10 +106,10 @@
    -
    +
    -
    +
    element->getElement('url')?> (Your radio station website) element->getElement('url')->hasErrors()) : ?> @@ -120,10 +120,10 @@
-
+
-
+
element->getElement('genre')?> element->getElement('genre')->hasErrors()) : ?>
    @@ -133,10 +133,10 @@
-
+
-
+
element->getElement('mount')?> element->getElement('mount')->hasErrors()) : ?>
    @@ -148,11 +148,11 @@
-
+
-
-

+
+
diff --git a/airtime_mvc/application/views/scripts/plupload/index.phtml b/airtime_mvc/application/views/scripts/plupload/index.phtml index 92c98cc93..cf236b8d6 100644 --- a/airtime_mvc/application/views/scripts/plupload/index.phtml +++ b/airtime_mvc/application/views/scripts/plupload/index.phtml @@ -1,3 +1,8 @@ +
diff --git a/airtime_mvc/application/views/scripts/preference/stream-setting.phtml b/airtime_mvc/application/views/scripts/preference/stream-setting.phtml index aa413857b..b86bbc855 100644 --- a/airtime_mvc/application/views/scripts/preference/stream-setting.phtml +++ b/airtime_mvc/application/views/scripts/preference/stream-setting.phtml @@ -1,5 +1,5 @@
-

Stream Settings

+

enable_stream_conf == "true"){?>style="float:left">Stream Settings

enable_stream_conf == "true"){?>
diff --git a/airtime_mvc/public/css/images/icon_soundcloud_error2.png b/airtime_mvc/public/css/images/icon_soundcloud_error2.png index 5f6145c0b..4263e32bd 100644 Binary files a/airtime_mvc/public/css/images/icon_soundcloud_error2.png and b/airtime_mvc/public/css/images/icon_soundcloud_error2.png differ diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css index 6cd9305f6..05fdd1423 100644 --- a/airtime_mvc/public/css/styles.css +++ b/airtime_mvc/public/css/styles.css @@ -1566,6 +1566,10 @@ div.success{ background:url(images/icon_soundcloud.png) no-repeat 0 0; width:21px; } +.small-icon.sc-error { + background:url(images/icon_soundcloud_error2.png) no-repeat 0 0; + width:21px; +} .small-icon.progress { background:url(images/upload-icon.gif) no-repeat; background-color:black; diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index 6ff2770da..ee28ae30f 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -154,8 +154,12 @@ function dtDrawCallback() { } function addProgressIcon(id) { - $("#au_"+id).find("td:eq(0)").append('') - $("span[id="+id+"]").addClass("progress"); + if($("#au_"+id).find("td:eq(0)").find("span").length > 0){ + $("#au_"+id).find("td:eq(0)").find("span").removeClass(); + $("span[id="+id+"]").addClass("small-icon progress"); + }else{ + $("#au_"+id).find("td:eq(0)").append('') + } } function checkSCUploadStatus(){ diff --git a/airtime_mvc/public/js/airtime/preferences/musicdirs.js b/airtime_mvc/public/js/airtime/preferences/musicdirs.js index a71e7aa31..44974d483 100644 --- a/airtime_mvc/public/js/airtime/preferences/musicdirs.js +++ b/airtime_mvc/public/js/airtime/preferences/musicdirs.js @@ -69,6 +69,7 @@ function setWatchedDirEvents() { function(json) { $("#watched-folder-section").empty(); + $("#watched-folder-section").append("

Manage Media Folders

"); $("#watched-folder-section").append(json.subform); setWatchedDirEvents(); }); @@ -86,6 +87,7 @@ function setWatchedDirEvents() { function(json) { $("#watched-folder-section").empty(); + $("#watched-folder-section").append("

Manage Media Folders

"); $("#watched-folder-section").append(json.subform); setWatchedDirEvents(); }); diff --git a/airtime_mvc/public/js/airtime/preferences/streamsetting.js b/airtime_mvc/public/js/airtime/preferences/streamsetting.js index 3562f7ba2..fab7d5b13 100644 --- a/airtime_mvc/public/js/airtime/preferences/streamsetting.js +++ b/airtime_mvc/public/js/airtime/preferences/streamsetting.js @@ -120,6 +120,12 @@ $(document).ready(function() { return false; }); + $('.collapsible-header').click(function() { + $(this).next().toggle('fast'); + $(this).toggleClass("close"); + return false; + }) + showErrorSections() diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index eaa7d44fa..41193dd4e 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -419,10 +419,16 @@ function showErrorSections() { $("#schedule-record-rebroadcast").show(); $("#add_show_rebroadcast_relative").show(); } + $('input:text').setMask() } $(document).ready(function() { - + $.mask.masks = $.extend($.mask.masks,{ + date:{ mask: '9999-19-39'}, + time:{ mask: '29:69'} + }) + + $('input:text').setMask() //setAddShowEvents(); }); @@ -438,6 +444,13 @@ $(window).resize(function(){ }); $(window).load(function() { - + $.mask.masks = $.extend($.mask.masks,{ + date:{ mask: '9999-19-39'}, + time:{ mask: '29:69'} + }) + + $('input:text').setMask() + setAddShowEvents(); + }); diff --git a/airtime_mvc/public/js/meioMask/jquery.meio.mask.js b/airtime_mvc/public/js/meioMask/jquery.meio.mask.js new file mode 100644 index 000000000..b57f73de7 --- /dev/null +++ b/airtime_mvc/public/js/meioMask/jquery.meio.mask.js @@ -0,0 +1 @@ +(function(a){function d(b){var c=this;b=a.event.fix(b||window.e);b.type="paste";setTimeout(function(){a.event.handle.call(c,b)},1)}var b=window.orientation!=undefined,c=a.browser.opera||a.browser.mozilla&&parseFloat(a.browser.version.substr(0,3))<1.9?"input":"paste";a.event.special.paste={setup:function(){if(this.addEventListener)this.addEventListener(c,d,false);else if(this.attachEvent)this.attachEvent(c,d)},teardown:function(){if(this.removeEventListener)this.removeEventListener(c,d,false);else if(this.detachEvent)this.detachEvent(c,d)}};a.extend({mask:{rules:{z:/[a-z]/,Z:/[A-Z]/,a:/[a-zA-Z]/,"*":/[0-9a-zA-Z]/,"@":/[0-9a-zA-ZçÇáàãâéèêíìóòôõúùü]/},keyRepresentation:{8:"backspace",9:"tab",13:"enter",16:"shift",17:"control",18:"alt",27:"esc",33:"page up",34:"page down",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"delete",116:"f5",123:"f12",224:"command"},iphoneKeyRepresentation:{10:"go",127:"delete"},signals:{"+":"","-":"-"},options:{attr:"alt",mask:null,type:"fixed",maxLength:-1,defaultValue:"",signal:false,textAlign:true,selectCharsOnFocus:true,autoTab:true,setSize:false,fixedChars:"[(),.:/ -]",onInvalid:function(){},onValid:function(){},onOverflow:function(){}},masks:{phone:{mask:"(99) 9999-9999"},"phone-us":{mask:"(999) 999-9999"},cpf:{mask:"999.999.999-99"},cnpj:{mask:"99.999.999/9999-99"},date:{mask:"39/19/9999"},"date-us":{mask:"19/39/9999"},cep:{mask:"99999-999"},time:{mask:"29:59"},cc:{mask:"9999 9999 9999 9999"},integer:{mask:"999.999.999.999",type:"reverse"},decimal:{mask:"99,999.999.999.999",type:"reverse",defaultValue:"000"},"decimal-us":{mask:"99.999,999,999,999",type:"reverse",defaultValue:"000"},"signed-decimal":{mask:"99,999.999.999.999",type:"reverse",defaultValue:"+000"},"signed-decimal-us":{mask:"99,999.999.999.999",type:"reverse",defaultValue:"+000"}},init:function(){if(!this.hasInit){var c=this,d,e=b?this.iphoneKeyRepresentation:this.keyRepresentation;this.ignore=false;for(d=0;d<=9;d++)this.rules[d]=new RegExp("[0-"+d+"]");this.keyRep=e;this.ignoreKeys=[];a.each(e,function(a){c.ignoreKeys.push(parseInt(a))});this.hasInit=true}},set:function(b,c){var d=this,e=a(b),f="maxLength";c=c||{};this.init();return e.each(function(){if(c.attr)d.options.attr=c.attr;var b=a(this),e=a.extend({},d.options),g=b.attr(e.attr),h="";h=typeof c=="string"?c:g!=""?g:null;if(h)e.mask=h;if(d.masks[h])e=a.extend(e,d.masks[h]);if(typeof c=="object"&&c.constructor!=Array)e=a.extend(e,c);if(a.metadata)e=a.extend(e,b.metadata());if(e.mask!=null){if(b.data("mask"))d.unset(b);var i=e.defaultValue,j=e.type=="reverse",k=new RegExp(e.fixedChars,"g");if(e.maxLength==-1)e.maxLength=b.attr(f);e=a.extend({},e,{fixedCharsReg:new RegExp(e.fixedChars),fixedCharsRegG:k,maskArray:e.mask.split(""),maskNonFixedCharsArray:e.mask.replace(k,"").split("")});if((e.type=="fixed"||j)&&e.setSize&&!b.attr("size"))b.attr("size",e.mask.length);if(j&&e.textAlign)b.css("text-align","right");if(this.value!=""||i!=""){var l=d.string(this.value!=""?this.value:i,e);this.defaultValue=l;b.val(l)}if(e.type=="infinite")e.type="repeat";b.data("mask",e);b.removeAttr(f);b.bind("keydown.mask",{func:d._onKeyDown,thisObj:d},d._onMask).bind("keypress.mask",{func:d._onKeyPress,thisObj:d},d._onMask).bind("keyup.mask",{func:d._onKeyUp,thisObj:d},d._onMask).bind("paste.mask",{func:d._onPaste,thisObj:d},d._onMask).bind("focus.mask",d._onFocus).bind("blur.mask",d._onBlur).bind("change.mask",d._onChange)}})},unset:function(b){var c=a(b);return c.each(function(){var b=a(this);if(b.data("mask")){var c=b.data("mask").maxLength;if(c!=-1)b.attr("maxLength",c);b.unbind(".mask").removeData("mask")}})},string:function(b,c){this.init();var d={};if(typeof b!="string")b=String(b);switch(typeof c){case"string":if(this.masks[c])d=a.extend(d,this.masks[c]);else d.mask=c;break;case"object":d=c}if(!d.fixedChars)d.fixedChars=this.options.fixedChars;var e=new RegExp(d.fixedChars),f=new RegExp(d.fixedChars,"g");if(d.type=="reverse"&&d.defaultValue){if(typeof this.signals[d.defaultValue.charAt(0)]!="undefined"){var g=b.charAt(0);d.signal=typeof this.signals[g]!="undefined"?this.signals[g]:this.signals[d.defaultValue.charAt(0)];d.defaultValue=d.defaultValue.substring(1)}}return this.__maskArray(b.split(""),d.mask.replace(f,"").split(""),d.mask.split(""),d.type,d.maxLength,d.defaultValue,e,d.signal)},_onFocus:function(b){var c=a(this),d=c.data("mask");d.inputFocusValue=c.val();d.changed=false;if(d.selectCharsOnFocus)c.select()},_onBlur:function(b){var c=a(this),d=c.data("mask");if(d.inputFocusValue!=c.val()&&!d.changed)c.trigger("change")},_onChange:function(b){a(this).data("mask").changed=true},_onMask:function(b){var c=b.data.thisObj,d={};d._this=b.target;d.$this=a(d._this);if(d.$this.attr("readonly"))return true;d.data=d.$this.data("mask");d[d.data.type]=true;d.value=d.$this.val();d.nKey=c.__getKeyNumber(b);d.range=c.__getRange(d._this);d.valueArray=d.value.split("");return b.data.func.call(c,b,d)},_onKeyDown:function(c,d){this.ignore=a.inArray(d.nKey,this.ignoreKeys)>-1||c.ctrlKey||c.metaKey||c.altKey;if(this.ignore){var e=this.keyRep[d.nKey];d.data.onValid.call(d._this,e?e:"",d.nKey)}return b?this._keyPress(c,d):true},_onKeyUp:function(a,b){if(b.nKey==9||b.nKey==16)return true;if(b.data.type=="repeat"){this.__autoTab(b);return true}return this._onPaste(a,b)},_onPaste:function(b,c){if(c.reverse)this.__changeSignal(b.type,c);var d=this.__maskArray(c.valueArray,c.data.maskNonFixedCharsArray,c.data.maskArray,c.data.type,c.data.maxLength,c.data.defaultValue,c.data.fixedCharsReg,c.data.signal);c.$this.val(d);if(!c.reverse&&c.data.defaultValue.length&&c.range.start==c.range.end)this.__setRange(c._this,c.range.start,c.range.end);if((a.browser.msie||a.browser.safari)&&!c.reverse)this.__setRange(c._this,c.range.start,c.range.end);if(this.ignore)return true;this.__autoTab(c);return true},_onKeyPress:function(a,b){if(this.ignore)return true;if(b.reverse)this.__changeSignal(a.type,b);var c=String.fromCharCode(b.nKey),d=b.range.start,e=b.value,f=b.data.maskArray;if(b.reverse){var g=e.substr(0,d),h=e.substr(b.range.end,e.length);e=g+c+h;if(b.data.signal&&d-b.data.signal.length>0)d-=b.data.signal.length}var i=e.replace(b.data.fixedCharsRegG,"").split(""),j=this.__extraPositionsTill(d,f,b.data.fixedCharsReg);b.rsEp=d+j;if(b.repeat)b.rsEp=0;if(!this.rules[f[b.rsEp]]||b.data.maxLength!=-1&&i.length>=b.data.maxLength&&b.repeat){b.data.onOverflow.call(b._this,c,b.nKey);return false}else if(!this.rules[f[b.rsEp]].test(c)){b.data.onInvalid.call(b._this,c,b.nKey);return false}else b.data.onValid.call(b._this,c,b.nKey);var k=this.__maskArray(i,b.data.maskNonFixedCharsArray,f,b.data.type,b.data.maxLength,b.data.defaultValue,b.data.fixedCharsReg,b.data.signal,j);b.$this.val(k);return b.reverse?this._keyPressReverse(a,b):b.fixed?this._keyPressFixed(a,b):true},_keyPressFixed:function(a,b){if(b.range.start==b.range.end){if(b.rsEp==0&&b.value.length==0||b.rsEp=a.data.maskArray.length&&!a.repeat||a.data.maxLength!=-1&&a.valueArray.length>=a.data.maxLength&&a.repeat)){var b=this.__getNextInput(a._this,a.data.autoTab);if(b){a.$this.trigger("blur");b.focus().select()}}},__changeSignal:function(a,b){if(b.data.signal!==false){var c=a=="paste"?b.value.charAt(0):String.fromCharCode(b.nKey);if(this.signals&&typeof this.signals[c]!="undefined"){b.data.signal=this.signals[c]}}},__getKeyNumber:function(a){return a.charCode||a.keyCode||a.which},__maskArray:function(a,b,c,d,e,f,g,h,i){if(d=="reverse")a.reverse();a=this.__removeInvalidChars(a,b,d=="repeat"||d=="infinite");if(f)a=this.__applyDefaultValue.call(a,f);a=this.__applyMask(a,c,i,g);switch(d){case"reverse":a.reverse();return(h||"")+a.join("").substring(a.length-c.length);case"infinite":case"repeat":var j=a.join("");return e!=-1&&a.length>=e?j.substring(0,e):j;default:return a.join("").substring(0,c.length)}return""},__applyDefaultValue:function(a){var b=a.length,c=this.length,d;for(d=c-1;d>=0;d--){if(this[d]==a.charAt(0))this.pop();else break}for(d=0;d0||c.offsetHeight>0)&&c.nodeName!="FIELDSET"&&(b===true||typeof b=="string"&&a.is(b))},__setRange:function(a,b,c){if(typeof c=="undefined")c=b;if(a.setSelectionRange){a.setSelectionRange(b,c)}else{var d=a.createTextRange();d.collapse();d.moveStart("character",b);d.moveEnd("character",c-b);d.select()}},__getRange:function(b){if(!a.browser.msie)return{start:b.selectionStart,end:b.selectionEnd};var c={start:0,end:0},d=document.selection.createRange();c.start=0-d.duplicate().moveStart("character",-1e5);c.end=c.start+d.text.length;return c},unmaskedVal:function(b){return a(b).val().replace(a.mask.fixedCharsRegG,"")}}});a.fn.extend({setMask:function(b){return a.mask.set(this,b)},unsetMask:function(){return a.mask.unset(this)},unmaskedVal:function(){return a.mask.unmaskedVal(this[0])}})})(jQuery) \ No newline at end of file diff --git a/install_minimal/include/AirtimeInstall.php b/install_minimal/include/AirtimeInstall.php index 41175a913..fc432c166 100644 --- a/install_minimal/include/AirtimeInstall.php +++ b/install_minimal/include/AirtimeInstall.php @@ -462,4 +462,11 @@ class AirtimeInstall fwrite($fp, "$minute $hour * * * root /usr/lib/airtime/utils/phone_home_stat\n"); fclose($fp); } + + public static function removeVirtualEnvDistributeFile(){ + echo "* Removing distribute-0.6.10.tar.gz".PHP_EOL; + if(file_exists('/usr/share/python-virtualenv/distribute-0.6.10.tar.gz')){ + exec("rm -f /usr/share/python-virtualenv/distribute-0.6.10.tar.gz"); + } + } } diff --git a/install_minimal/include/airtime-uninstall.php b/install_minimal/include/airtime-uninstall.php index 3445b230c..cdcc987c4 100644 --- a/install_minimal/include/airtime-uninstall.php +++ b/install_minimal/include/airtime-uninstall.php @@ -80,6 +80,7 @@ if ($results == 0) { AirtimeInstall::RemoveSymlinks(); AirtimeInstall::UninstallBinaries(); AirtimeInstall::RemoveLogDirectories(); +AirtimeInstall::removeVirtualEnvDistributeFile(); AirtimeIni::RemoveMonitFile(); @unlink('/etc/cron.d/airtime-crons'); diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index 311d08687..c98f4433e 100755 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -422,12 +422,12 @@ class AirTimeApiClient(ApiClientInterface): elapsed = (time.time() - start) logger.info("time taken to get response %s", elapsed) - if(is_record): + if("error" not in response and is_record): url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["upload_recorded"]) url = url.replace("%%fileid%%", str(response[u'id'])) url = url.replace("%%showinstanceid%%", str(md['MDATA_KEY_TRACKNUMBER'])) - logger.debug(url) url = url.replace("%%api_key%%", self.config["api_key"]) + logger.debug(url) req = urllib2.Request(url) response = urllib2.urlopen(req).read() diff --git a/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py b/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py index 8214aadf8..18edbc7c5 100644 --- a/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py +++ b/python_apps/media-monitor/airtimefilemonitor/airtimemetadata.py @@ -125,7 +125,7 @@ class AirtimeMetadata: self.logger.debug("Saving %s to file", key) self.logger.debug(value) if isinstance(value, basestring) and (len(value) > 0): - airtime_file[self.airtime2mutagen[key]] = unicode(value, "utf-8") + airtime_file[self.airtime2mutagen[key]] = api_client.encode_to(value, 'utf-8') elif isinstance(value, int): airtime_file[self.airtime2mutagen[key]] = str(value) diff --git a/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py b/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py index 189eed7ec..fd121c725 100644 --- a/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py +++ b/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py @@ -36,6 +36,7 @@ class AirtimeProcessEvent(ProcessEvent): self.md_manager = AirtimeMetadata() self.mmc = mmc self.api_client = api_client + self.create_dict = {} def add_filepath_to_ignore(self, filepath): self.ignore_event.add(filepath) @@ -87,6 +88,14 @@ class AirtimeProcessEvent(ProcessEvent): else: self.logger.info("Removing the watch folder failed: %s", res['msg']['error']) + def process_IN_CREATE(self, event): + self.logger.info("event: %s", event) + if not event.dir: + if self.mmc.is_parent_directory(event.pathname, self.config.recorded_directory): + self.file_events.append({'mode': self.config.MODE_CREATE, 'filepath': event.pathname, 'is_recorded_show': True}) + self.create_dict[event.pathname] = time.time() + + #event.dir: True if the event was raised against a directory. #event.name: filename #event.pathname: pathname (str): Concatenation of 'path' and 'name'. @@ -94,7 +103,10 @@ class AirtimeProcessEvent(ProcessEvent): # copy was done. Hence, IN_CLOSE_WRITE is the correct one to handle. def process_IN_CLOSE_WRITE(self, event): self.logger.info("event: %s", event) - self.handle_created_file(event.dir, event.pathname, event.name) + self.logger.info("create_dict: %s", self.create_dict) + if event.pathname in self.create_dict: + self.create_dict.pop(event.pathname) + self.handle_created_file(event.dir, event.pathname, event.name) def handle_created_file(self, dir, pathname, name): if not dir: @@ -255,6 +267,10 @@ class AirtimeProcessEvent(ProcessEvent): del self.cookies_IN_MOVED_FROM[k] self.handle_removed_file(False, event.pathname) + for k, t in self.create_dict.items(): + now = time.time() + if now - t > 5: + del self.create_dict[k] #check for any events received from Airtime. try: