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:
parent
05b2a9679b
commit
968c0f96a2
6 changed files with 10 additions and 8 deletions
|
@ -244,7 +244,7 @@ class MusicDir {
|
||||||
{
|
{
|
||||||
if(!is_dir($p_dir)){
|
if(!is_dir($p_dir)){
|
||||||
return array("code"=>2, "error"=>"'$p_dir' is not a valid directory.");
|
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.");
|
return array("code"=>3, "error"=>"Airtime is currently importing files. Please wait until this is complete before changing the storage directory.");
|
||||||
}
|
}
|
||||||
$dir = self::getStorDir();
|
$dir = self::getStorDir();
|
||||||
|
|
|
@ -359,7 +359,9 @@ class Application_Model_Preference
|
||||||
|
|
||||||
public static function SetImportTimestamp(){
|
public static function SetImportTimestamp(){
|
||||||
$now = time();
|
$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(){
|
public static function GetImportTimestamp(){
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<!--<li><a href="#advancedSearch">Advanced Search</a></li>-->
|
<!--<li><a href="#advancedSearch">Advanced Search</a></li>-->
|
||||||
</ul>
|
</ul>
|
||||||
<div id="simpleSearch">
|
<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">
|
<table id="library_display" cellpadding="0" cellspacing="0" class="datatable">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -57,13 +57,11 @@ function confirmDeletePlaylist(params){
|
||||||
|
|
||||||
function checkImportStatus(){
|
function checkImportStatus(){
|
||||||
$.getJSON('/Preference/is-import-in-progress', function(data){
|
$.getJSON('/Preference/is-import-in-progress', function(data){
|
||||||
var div = $('#library_display_processing');
|
var div = $('#import_status');
|
||||||
if(data == true){
|
if(data == true){
|
||||||
div.html("File import in progress...");
|
|
||||||
div.css('visibility', 'visible');
|
div.css('visibility', 'visible');
|
||||||
}else{
|
}else{
|
||||||
div.css('visibility', 'hidden');
|
div.css('visibility', 'hidden');
|
||||||
div.html("Processing...");
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ try:
|
||||||
bootstrap = AirtimeMediaMonitorBootstrap(logger, pe, api_client, mmc)
|
bootstrap = AirtimeMediaMonitorBootstrap(logger, pe, api_client, mmc)
|
||||||
bootstrap.scan()
|
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()
|
notifier.coalesce_events()
|
||||||
|
|
||||||
#create 5 worker threads
|
#create 5 worker threads
|
||||||
|
|
|
@ -176,9 +176,10 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
for event in self.file_events:
|
for event in self.file_events:
|
||||||
self.multi_queue.put(event)
|
self.multi_queue.put(event)
|
||||||
self.mmc.touch_index_file()
|
self.mmc.touch_index_file()
|
||||||
|
|
||||||
self.file_events = []
|
self.file_events = []
|
||||||
|
#yeild to workder thread
|
||||||
|
time.sleep(0)
|
||||||
#use items() because we are going to be modifying this
|
#use items() because we are going to be modifying this
|
||||||
#dictionary while iterating over it.
|
#dictionary while iterating over it.
|
||||||
for k, pair in self.cookies_IN_MOVED_FROM.items():
|
for k, pair in self.cookies_IN_MOVED_FROM.items():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue