CC-2651: import idicator

- Threshold is 10 seconds
- record timestamp once every 5 seconds
- "File import inprogress..." displays above search box
- pyinotify read_freq changed to 0.1 from 1
This commit is contained in:
James 2011-08-09 10:40:10 -04:00
parent 05b2a9679b
commit 968c0f96a2
6 changed files with 10 additions and 8 deletions

View file

@ -244,7 +244,7 @@ class MusicDir {
{
if(!is_dir($p_dir)){
return array("code"=>2, "error"=>"'$p_dir' is not a valid directory.");
}else if(Application_Model_Preference::GetImportTimestamp()+10 > $now){
}else if(Application_Model_Preference::GetImportTimestamp()+10 > time()){
return array("code"=>3, "error"=>"Airtime is currently importing files. Please wait until this is complete before changing the storage directory.");
}
$dir = self::getStorDir();

View file

@ -359,7 +359,9 @@ class Application_Model_Preference
public static function SetImportTimestamp(){
$now = time();
Application_Model_Preference::SetValue("import_timestamp", $now);
if(Application_Model_Preference::GetImportTimestamp()+5 < $now){
Application_Model_Preference::SetValue("import_timestamp", $now);
}
}
public static function GetImportTimestamp(){

View file

@ -3,6 +3,7 @@
<!--<li><a href="#advancedSearch">Advanced Search</a></li>-->
</ul>
<div id="simpleSearch">
<div id="import_status" style="visibility:hidden">File import in progress...</div>
<table id="library_display" cellpadding="0" cellspacing="0" class="datatable">
<thead>
<tr>

View file

@ -57,13 +57,11 @@ function confirmDeletePlaylist(params){
function checkImportStatus(){
$.getJSON('/Preference/is-import-in-progress', function(data){
var div = $('#library_display_processing');
var div = $('#import_status');
if(data == true){
div.html("File import in progress...");
div.css('visibility', 'visible');
}else{
div.css('visibility', 'hidden');
div.html("Processing...");
}
})
}

View file

@ -64,7 +64,7 @@ try:
bootstrap = AirtimeMediaMonitorBootstrap(logger, pe, api_client, mmc)
bootstrap.scan()
notifier = AirtimeNotifier(wm, pe, read_freq=1, timeout=0, airtime_config=config, api_client=api_client, bootstrap=bootstrap, mmc=mmc)
notifier = AirtimeNotifier(wm, pe, read_freq=0.1, timeout=0, airtime_config=config, api_client=api_client, bootstrap=bootstrap, mmc=mmc)
notifier.coalesce_events()
#create 5 worker threads

View file

@ -176,9 +176,10 @@ class AirtimeProcessEvent(ProcessEvent):
for event in self.file_events:
self.multi_queue.put(event)
self.mmc.touch_index_file()
self.file_events = []
#yeild to workder thread
time.sleep(0)
#use items() because we are going to be modifying this
#dictionary while iterating over it.
for k, pair in self.cookies_IN_MOVED_FROM.items():