void Scheduler::ExecuteTask(Task* task) { #ifdef DEBUG const char* commandName[] = { "Pause", "Unpause", "Pause Post-processing", "Unpause Post-processing", "Set download rate", "Execute process", "Execute script", "Pause Scan", "Unpause Scan", "Enable Server", "Disable Server", "Fetch Feed" }; debug("Executing scheduled command: %s", commandName[task->m_command]); #endif bool executeProcess = m_executeProcess || task->m_hours == Task::STARTUP_TASK; switch (task->m_command) { case scDownloadRate: if (!task->m_param.Empty()) { g_WorkState->SetSpeedLimit(atoi(task->m_param) * 1024); m_downloadRateChanged = true; } break; case scPauseDownload: case scUnpauseDownload: g_WorkState->SetPauseDownload(task->m_command == scPauseDownload); m_pauseDownloadChanged = true; break; case scPausePostProcess: case scUnpausePostProcess: g_WorkState->SetPausePostProcess(task->m_command == scPausePostProcess); m_pausePostProcessChanged = true; break; case scPauseScan: case scUnpauseScan: g_WorkState->SetPauseScan(task->m_command == scPauseScan); m_pauseScanChanged = true; break; case scExtensions: case scProcess: if (executeProcess) { SchedulerScriptController::StartScript(task->m_param, task->m_command == scProcess, task->m_id); } break; case scActivateServer: case scDeactivateServer: EditServer(task->m_command == scActivateServer, task->m_param); break; case scFetchFeed: if (executeProcess) { FetchFeed(task->m_param); break; } } }
void Scheduler::ExecuteTask(Task* task) { const char* commandName[] = { "Pause", "Unpause", "Pause Post-processing", "Unpause Post-processing", "Set download rate", "Execute process", "Execute script", "Pause Scan", "Unpause Scan", "Enable Server", "Disable Server", "Fetch Feed" }; debug("Executing scheduled command: %s", commandName[task->m_command]); switch (task->m_command) { case scDownloadRate: if (!task->m_param.Empty()) { g_Options->SetDownloadRate(atoi(task->m_param) * 1024); m_downloadRateChanged = true; } break; case scPauseDownload: case scUnpauseDownload: g_Options->SetPauseDownload(task->m_command == scPauseDownload); m_pauseDownloadChanged = true; break; case scPausePostProcess: case scUnpausePostProcess: g_Options->SetPausePostProcess(task->m_command == scPausePostProcess); m_pausePostProcessChanged = true; break; case scPauseScan: case scUnpauseScan: g_Options->SetPauseScan(task->m_command == scPauseScan); m_pauseScanChanged = true; break; case scScript: case scProcess: if (m_executeProcess) { SchedulerScriptController::StartScript(task->m_param, task->m_command == scProcess, task->m_id); } break; case scActivateServer: case scDeactivateServer: EditServer(task->m_command == scActivateServer, task->m_param); break; case scFetchFeed: if (m_executeProcess) { FetchFeed(task->m_param); break; } } }