From ba1e51a8d86b297153121e855b3ef8b98f2f4fbb Mon Sep 17 00:00:00 2001 From: Andrey Prygunkov Date: Mon, 1 May 2017 17:48:20 +0200 Subject: [PATCH] #362: new queue event after direct rename Queue-event NZB_NAMED, sent after the inner files are renamed --- daemon/extension/QueueScript.cpp | 3 ++- daemon/extension/QueueScript.h | 3 ++- daemon/postprocess/PrePostProcessor.cpp | 4 ++++ daemon/queue/DownloadInfo.h | 1 + daemon/queue/QueueCoordinator.cpp | 3 +++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/daemon/extension/QueueScript.cpp b/daemon/extension/QueueScript.cpp index 7d053642..719ffd46 100644 --- a/daemon/extension/QueueScript.cpp +++ b/daemon/extension/QueueScript.cpp @@ -1,7 +1,7 @@ /* * This file is part of nzbget. See . * - * Copyright (C) 2007-2016 Andrey Prygunkov + * Copyright (C) 2007-2017 Andrey Prygunkov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,6 +32,7 @@ static const char* QUEUE_EVENT_NAMES[] = { "URL_COMPLETED", "NZB_MARKED", "NZB_ADDED", + "NZB_NAMED", "NZB_DOWNLOADED", "NZB_DELETED" }; diff --git a/daemon/extension/QueueScript.h b/daemon/extension/QueueScript.h index ab944373..e48e41ac 100644 --- a/daemon/extension/QueueScript.h +++ b/daemon/extension/QueueScript.h @@ -1,7 +1,7 @@ /* * This file is part of nzbget. See . * - * Copyright (C) 2007-2016 Andrey Prygunkov + * Copyright (C) 2007-2017 Andrey Prygunkov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,6 +33,7 @@ public: qeUrlCompleted, qeNzbMarked, qeNzbAdded, + qeNzbNamed, qeNzbDownloaded, qeNzbDeleted // highest priority }; diff --git a/daemon/postprocess/PrePostProcessor.cpp b/daemon/postprocess/PrePostProcessor.cpp index 0b38948c..650313b0 100644 --- a/daemon/postprocess/PrePostProcessor.cpp +++ b/daemon/postprocess/PrePostProcessor.cpp @@ -168,6 +168,10 @@ void PrePostProcessor::DownloadQueueUpdate(void* aspect) { 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() && diff --git a/daemon/queue/DownloadInfo.h b/daemon/queue/DownloadInfo.h index 0722a395..ecf3223d 100644 --- a/daemon/queue/DownloadInfo.h +++ b/daemon/queue/DownloadInfo.h @@ -885,6 +885,7 @@ public: eaNzbFound, eaNzbAdded, eaNzbDeleted, + eaNzbNamed, eaFileCompleted, eaFileDeleted, eaUrlCompleted diff --git a/daemon/queue/QueueCoordinator.cpp b/daemon/queue/QueueCoordinator.cpp index 58f6a476..283d8337 100644 --- a/daemon/queue/QueueCoordinator.cpp +++ b/daemon/queue/QueueCoordinator.cpp @@ -1361,4 +1361,7 @@ void QueueCoordinator::DirectRenameCompleted(DownloadQueue* downloadQueue, NzbIn } downloadQueue->Save(); + + DownloadQueue::Aspect namedAspect = { DownloadQueue::eaNzbNamed, downloadQueue, nzbInfo, nullptr }; + downloadQueue->Notify(&namedAspect); }