tasks update

This commit is contained in:
jakani24
2024-02-17 15:20:28 +01:00
parent a500befd06
commit b648ac440e
4 changed files with 14 additions and 0 deletions

View File

@@ -54,6 +54,11 @@ int start_thread(const char* command) {
std::thread t1(action_update_settings); std::thread t1(action_update_settings);
t1.detach(); t1.detach();
} }
else if (strcmp(out1, "update_db") == 0) {
//start a new thread with the scanfolder function
std::thread t1(action_update_settings);
t1.detach();
}
while (can_run_thread()) { while (can_run_thread()) {
//delay a bit, in order to wait until the thread is started //delay a bit, in order to wait until the thread is started

View File

@@ -88,4 +88,8 @@ int action_update_settings() {
} }
return err; return err;
} }
int action_update_db() {
//update the databases
return update_db(DB_DIR);
}
#endif #endif

View File

@@ -425,6 +425,7 @@ function load_settings(){
<option value="scanfile">scanfile</option> <option value="scanfile">scanfile</option>
<option value="scanfolder">scanfolder</option> <option value="scanfolder">scanfolder</option>
<option value="update_settings">update settings</option> <option value="update_settings">update settings</option>
<option value="update_db">update database</option>
</select> </select>
</td> </td>
<td><input type="text" id="task_argument" class="form-control" name="task_argument"></td> <td><input type="text" id="task_argument" class="form-control" name="task_argument"></td>
@@ -465,6 +466,10 @@ function load_settings(){
echo('<option value="update_settings" selected>update settings</option>'); echo('<option value="update_settings" selected>update settings</option>');
else else
echo('<option value="update_settings">update settings</option>'); echo('<option value="update_settings">update settings</option>');
if($action=="update_settings")
echo('<option value="update_db" selected>update database</option>');
else
echo('<option value="update_db">update database</option>');
echo('</select>'); echo('</select>');
echo('</td>'); echo('</td>');