Merge branch 'cc-2652-display-info-about-import' into devel
This commit is contained in:
commit
bfa2fa6535
|
@ -451,6 +451,9 @@ class ApiController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update import timestamp
|
||||||
|
Application_Model_Preference::SetImportTimestamp();
|
||||||
|
|
||||||
if ($mode == "create") {
|
if ($mode == "create") {
|
||||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||||
$filepath = str_replace("\\", "", $filepath);
|
$filepath = str_replace("\\", "", $filepath);
|
||||||
|
@ -508,7 +511,6 @@ class ApiController extends Zend_Controller_Action
|
||||||
$file->delete();
|
$file->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->id = $file->getId();
|
$this->view->id = $file->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
->addActionContext('change-stor-directory', 'json')
|
->addActionContext('change-stor-directory', 'json')
|
||||||
->addActionContext('reload-watch-directory', 'json')
|
->addActionContext('reload-watch-directory', 'json')
|
||||||
->addActionContext('remove-watch-directory', 'json')
|
->addActionContext('remove-watch-directory', 'json')
|
||||||
|
->addActionContext('is-import-in-progress', 'json')
|
||||||
->initContext();
|
->initContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,6 +158,15 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
||||||
$this->view->subform = $watched_dirs_form->render();
|
$this->view->subform = $watched_dirs_form->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isImportInProgressAction(){
|
||||||
|
$now = time();
|
||||||
|
$res = false;
|
||||||
|
if(Application_Model_Preference::GetImportTimestamp()+5 > $now){
|
||||||
|
$res = true;
|
||||||
|
}
|
||||||
|
die(json_encode($res));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -356,5 +356,14 @@ class Application_Model_Preference
|
||||||
public static function GetRemindMeDate(){
|
public static function GetRemindMeDate(){
|
||||||
return Application_Model_Preference::GetValue("remindme");
|
return Application_Model_Preference::GetValue("remindme");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function SetImportTimestamp(){
|
||||||
|
$now = time();
|
||||||
|
Application_Model_Preference::SetValue("import_timestamp", $now);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetImportTimestamp(){
|
||||||
|
return Application_Model_Preference::GetValue("import_timestamp");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,19 @@ function confirmDeletePlaylist(params){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkImportStatus(){
|
||||||
|
$.getJSON('/Preference/is-import-in-progress', function(data){
|
||||||
|
var div = $('#library_display_processing');
|
||||||
|
if(data == true){
|
||||||
|
div.html("Import is being processed");
|
||||||
|
div.css('visibility', 'visible');
|
||||||
|
}else{
|
||||||
|
div.css('visibility', 'hidden');
|
||||||
|
div.html("Processing...");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function deletePlaylist(json) {
|
function deletePlaylist(json) {
|
||||||
if(json.message) {
|
if(json.message) {
|
||||||
alert(json.message);
|
alert(json.message);
|
||||||
|
@ -172,4 +185,7 @@ $(document).ready(function() {
|
||||||
"sSearch": ""
|
"sSearch": ""
|
||||||
}
|
}
|
||||||
}).fnSetFilteringDelay(350);
|
}).fnSetFilteringDelay(350);
|
||||||
|
|
||||||
|
checkImportStatus()
|
||||||
|
setInterval( "checkImportStatus()", 2000 );
|
||||||
});
|
});
|
||||||
|
|
|
@ -293,6 +293,21 @@ class AirtimeInstall
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function SetImportTimestamp()
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$now = time();
|
||||||
|
|
||||||
|
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('import_timestamp', '$now')";
|
||||||
|
$result = $CC_DBC->query($sql);
|
||||||
|
if (PEAR::isError($result)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function GetAirtimeVersion()
|
public static function GetAirtimeVersion()
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,9 @@ if (isset($argv[1]) && $argv[1] == 'y') {
|
||||||
echo "* Setting Airtime version".PHP_EOL;
|
echo "* Setting Airtime version".PHP_EOL;
|
||||||
AirtimeInstall::SetAirtimeVersion(AIRTIME_VERSION);
|
AirtimeInstall::SetAirtimeVersion(AIRTIME_VERSION);
|
||||||
|
|
||||||
|
// set up some keys in DB
|
||||||
AirtimeInstall::SetUniqueId();
|
AirtimeInstall::SetUniqueId();
|
||||||
|
AirtimeInstall::SetImportTimestamp();
|
||||||
|
|
||||||
if (AirtimeInstall::$databaseTablesCreated) {
|
if (AirtimeInstall::$databaseTablesCreated) {
|
||||||
|
|
||||||
|
|
|
@ -352,6 +352,34 @@ class AirtimeInstall{
|
||||||
echo "* Inserting data into country table".PHP_EOL;
|
echo "* Inserting data into country table".PHP_EOL;
|
||||||
Airtime190Upgrade::execSqlQuery($sql);
|
Airtime190Upgrade::execSqlQuery($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function SetUniqueId()
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$uniqueId = md5(uniqid("", true));
|
||||||
|
|
||||||
|
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('uniqueId', '$uniqueId')";
|
||||||
|
$result = $CC_DBC->query($sql);
|
||||||
|
if (PEAR::isError($result)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetImportTimestamp()
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$now = time();
|
||||||
|
|
||||||
|
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('import_timestamp', '$now')";
|
||||||
|
$result = $CC_DBC->query($sql);
|
||||||
|
if (PEAR::isError($result)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AirtimeIni{
|
class AirtimeIni{
|
||||||
|
@ -783,6 +811,10 @@ AirtimeInstall::MigrateTablesToVersion(__DIR__, '20110713161043');
|
||||||
|
|
||||||
AirtimeInstall::InsertCountryDataIntoDatabase();
|
AirtimeInstall::InsertCountryDataIntoDatabase();
|
||||||
|
|
||||||
|
// set up some keys in DB
|
||||||
|
AirtimeInstall::SetUniqueId();
|
||||||
|
AirtimeInstall::SetImportTimestamp();
|
||||||
|
|
||||||
AirtimeIni::CreateMonitFile();
|
AirtimeIni::CreateMonitFile();
|
||||||
|
|
||||||
AirtimeInstall::CreateSymlinksToUtils();
|
AirtimeInstall::CreateSymlinksToUtils();
|
||||||
|
|
|
@ -8,7 +8,7 @@ from airtimemetadata import AirtimeMetadata
|
||||||
|
|
||||||
def encode_to(obj, encoding='utf-8'):
|
def encode_to(obj, encoding='utf-8'):
|
||||||
if isinstance(obj, basestring):
|
if isinstance(obj, basestring):
|
||||||
if not isinstance(obj, string):
|
if not isinstance(obj, str):
|
||||||
obj = obj.encode(encoding)
|
obj = obj.encode(encoding)
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue