void PrePostProcessor::NzbDeleted(DownloadQueue* downloadQueue, NzbInfo* nzbInfo) { if (nzbInfo->GetUnpackThread()) { ((DirectUnpack*)nzbInfo->GetUnpackThread())->NzbDeleted(downloadQueue, nzbInfo); } if (nzbInfo->GetDeleteStatus() == NzbInfo::dsNone) { nzbInfo->SetDeleteStatus(NzbInfo::dsManual); } nzbInfo->SetDeleting(false); DeleteCleanup(nzbInfo); if (nzbInfo->GetDeleteStatus() == NzbInfo::dsHealth || nzbInfo->GetDeleteStatus() == NzbInfo::dsBad) { NzbDownloaded(downloadQueue, nzbInfo); } else { NzbCompleted(downloadQueue, nzbInfo, true); } }
void PrePostProcessor::DownloadQueueUpdate(void* aspect) { if (IsStopped()) { return; } DownloadQueue::Aspect* queueAspect = (DownloadQueue::Aspect*)aspect; if (queueAspect->action == DownloadQueue::eaNzbFound) { NzbFound(queueAspect->downloadQueue, queueAspect->nzbInfo); } else if (queueAspect->action == DownloadQueue::eaNzbAdded) { NzbAdded(queueAspect->downloadQueue, queueAspect->nzbInfo); } else if (queueAspect->action == DownloadQueue::eaNzbNamed) { g_QueueScriptCoordinator->EnqueueScript(queueAspect->nzbInfo, QueueScriptCoordinator::qeNzbNamed); } else if (queueAspect->action == DownloadQueue::eaNzbDeleted && queueAspect->nzbInfo->GetDeleting() && !queueAspect->nzbInfo->GetPostInfo() && queueAspect->nzbInfo->GetFileList()->empty()) { // the deleting of nzbs is usually handled via eaFileDeleted-event, but when deleting nzb without // any files left the eaFileDeleted-event is not fired and we need to process eaNzbDeleted-event instead queueAspect->nzbInfo->PrintMessage(Message::mkInfo, "Collection %s deleted from queue", queueAspect->nzbInfo->GetName()); NzbDeleted(queueAspect->downloadQueue, queueAspect->nzbInfo); } else if ((queueAspect->action == DownloadQueue::eaFileCompleted || queueAspect->action == DownloadQueue::eaFileDeleted)) { if (queueAspect->action == DownloadQueue::eaFileCompleted) { FileDownloaded(queueAspect->downloadQueue, queueAspect->nzbInfo, queueAspect->fileInfo); } #ifndef DISABLE_PARCHECK for (NzbInfo* postJob : m_activeJobs) { if (postJob && queueAspect->fileInfo->GetNzbInfo() == postJob && postJob->GetPostInfo() && postJob->GetPostInfo()->GetPostThread() && postJob->GetPostInfo()->GetStage() >= PostInfo::ptLoadingPars && postJob->GetPostInfo()->GetStage() <= PostInfo::ptVerifyingRepaired && ((RepairController*)postJob->GetPostInfo()->GetPostThread())->AddPar( queueAspect->fileInfo, queueAspect->action == DownloadQueue::eaFileDeleted)) { return; } } #endif if ((queueAspect->action == DownloadQueue::eaFileCompleted || queueAspect->fileInfo->GetDupeDeleted()) && queueAspect->fileInfo->GetNzbInfo()->GetDeleteStatus() != NzbInfo::dsHealth && !queueAspect->nzbInfo->GetPostInfo() && queueAspect->nzbInfo->IsDownloadCompleted(true)) { queueAspect->nzbInfo->PrintMessage(Message::mkInfo, "Collection %s completely downloaded", queueAspect->nzbInfo->GetName()); g_QueueScriptCoordinator->EnqueueScript(queueAspect->nzbInfo, QueueScriptCoordinator::qeNzbDownloaded); NzbDownloaded(queueAspect->downloadQueue, queueAspect->nzbInfo); } else if ((queueAspect->action == DownloadQueue::eaFileDeleted || (queueAspect->action == DownloadQueue::eaFileCompleted && queueAspect->fileInfo->GetNzbInfo()->GetDeleteStatus() > NzbInfo::dsNone)) && !queueAspect->nzbInfo->GetPostInfo() && queueAspect->nzbInfo->IsDownloadCompleted(false)) { queueAspect->nzbInfo->PrintMessage(Message::mkInfo, "Collection %s deleted from queue", queueAspect->nzbInfo->GetName()); NzbDeleted(queueAspect->downloadQueue, queueAspect->nzbInfo); } } }
void PrePostProcessor::DownloadQueueUpdate(Subject* Caller, void* Aspect) { if (IsStopped()) { return; } DownloadQueue::Aspect* queueAspect = (DownloadQueue::Aspect*)Aspect; if (queueAspect->action == DownloadQueue::eaNzbFound) { NzbFound(queueAspect->downloadQueue, queueAspect->nzbInfo); } else if (queueAspect->action == DownloadQueue::eaNzbAdded) { NzbAdded(queueAspect->downloadQueue, queueAspect->nzbInfo); } else if (queueAspect->action == DownloadQueue::eaNzbDeleted && queueAspect->nzbInfo->GetDeleting() && !queueAspect->nzbInfo->GetPostInfo() && queueAspect->nzbInfo->GetFileList()->empty()) { // the deleting of nzbs is usually handled via eaFileDeleted-event, but when deleting nzb without // any files left the eaFileDeleted-event is not fired and we need to process eaNzbDeleted-event instead queueAspect->nzbInfo->PrintMessage(Message::mkInfo, "Collection %s deleted from queue", queueAspect->nzbInfo->GetName()); NzbDeleted(queueAspect->downloadQueue, queueAspect->nzbInfo); } else if ((queueAspect->action == DownloadQueue::eaFileCompleted || queueAspect->action == DownloadQueue::eaFileDeleted)) { if (queueAspect->action == DownloadQueue::eaFileCompleted && !queueAspect->nzbInfo->GetPostInfo()) { g_QueueScriptCoordinator->EnqueueScript(queueAspect->nzbInfo, QueueScriptCoordinator::qeFileDownloaded); } #ifndef DISABLE_PARCHECK if (m_parCoordinator.AddPar(queueAspect->fileInfo, queueAspect->action == DownloadQueue::eaFileDeleted)) { return; } #endif if ((queueAspect->action == DownloadQueue::eaFileCompleted || queueAspect->fileInfo->GetDupeDeleted()) && queueAspect->fileInfo->GetNzbInfo()->GetDeleteStatus() != NzbInfo::dsHealth && !queueAspect->nzbInfo->GetPostInfo() && IsNzbFileCompleted(queueAspect->nzbInfo, true)) { queueAspect->nzbInfo->PrintMessage(Message::mkInfo, "Collection %s completely downloaded", queueAspect->nzbInfo->GetName()); g_QueueScriptCoordinator->EnqueueScript(queueAspect->nzbInfo, QueueScriptCoordinator::qeNzbDownloaded); NzbDownloaded(queueAspect->downloadQueue, queueAspect->nzbInfo); } else if ((queueAspect->action == DownloadQueue::eaFileDeleted || (queueAspect->action == DownloadQueue::eaFileCompleted && queueAspect->fileInfo->GetNzbInfo()->GetDeleteStatus() > NzbInfo::dsNone)) && !queueAspect->nzbInfo->GetPostInfo() && IsNzbFileCompleted(queueAspect->nzbInfo, false)) { queueAspect->nzbInfo->PrintMessage(Message::mkInfo, "Collection %s deleted from queue", queueAspect->nzbInfo->GetName()); NzbDeleted(queueAspect->downloadQueue, queueAspect->nzbInfo); } } }