diff --git a/DownloadInfo.cpp b/DownloadInfo.cpp index 1963c4f1..122ca9a9 100644 --- a/DownloadInfo.cpp +++ b/DownloadInfo.cpp @@ -881,7 +881,6 @@ PostInfo::PostInfo() m_bWorking = false; m_bDeleted = false; m_bRequestParCheck = false; - m_bRequestParRename = false; m_szProgressLabel = strdup(""); m_iFileProgress = 0; m_iStageProgress = 0; diff --git a/DownloadInfo.h b/DownloadInfo.h index 40f39ac4..0ec6b317 100644 --- a/DownloadInfo.h +++ b/DownloadInfo.h @@ -570,7 +570,6 @@ private: bool m_bWorking; bool m_bDeleted; bool m_bRequestParCheck; - bool m_bRequestParRename; EStage m_eStage; char* m_szProgressLabel; int m_iFileProgress; @@ -611,8 +610,6 @@ public: void SetDeleted(bool bDeleted) { m_bDeleted = bDeleted; } bool GetRequestParCheck() { return m_bRequestParCheck; } void SetRequestParCheck(bool bRequestParCheck) { m_bRequestParCheck = bRequestParCheck; } - bool GetRequestParRename() { return m_bRequestParRename; } - void SetRequestParRename(bool bRequestParRename) { m_bRequestParRename = bRequestParRename; } void AppendMessage(Message::EKind eKind, const char* szText); Thread* GetPostThread() { return m_pPostThread; } void SetPostThread(Thread* pPostThread) { m_pPostThread = pPostThread; } diff --git a/PrePostProcessor.cpp b/PrePostProcessor.cpp index 0918e7a8..9dfeaf0f 100644 --- a/PrePostProcessor.cpp +++ b/PrePostProcessor.cpp @@ -596,14 +596,7 @@ void PrePostProcessor::CheckPostQueue() pPostInfo->SetStage(PostInfo::ptQueued); } } - else if (pPostInfo->GetRequestParRename()) - { - pPostInfo->GetNZBInfo()->SetRenameStatus(NZBInfo::rsNone); - pPostInfo->SetRequestParRename(false); - pPostInfo->SetStage(PostInfo::ptQueued); - DeletePostThread(pPostInfo); - } - + #endif if (pPostInfo->GetDeleted()) { diff --git a/Unpack.cpp b/Unpack.cpp index ca46625e..fa494bcc 100644 --- a/Unpack.cpp +++ b/Unpack.cpp @@ -100,7 +100,6 @@ void UnpackController::Run() m_szName[1024-1] = '\0'; m_bCleanedUpDisk = false; - m_bHasParInArchive = false; m_szPassword[0] = '\0'; m_szFinalDir[0] = '\0'; @@ -168,7 +167,7 @@ void UnpackController::Run() #ifndef DISABLE_PARCHECK if (bUnpack && m_pPostInfo->GetNZBInfo()->GetParStatus() <= NZBInfo::psSkipped && m_bHasParFiles) { - RequestParCheck(m_pPostInfo->GetNZBInfo()->GetRenameStatus() <= NZBInfo::rsSkipped); + RequestParCheck(); } else #endif @@ -281,21 +280,19 @@ void UnpackController::Completed() PrintMessage(Message::mkInfo, "%s %s", m_szInfoNameUp, "successful"); m_pPostInfo->GetNZBInfo()->SetUnpackStatus(NZBInfo::usSuccess); m_pPostInfo->GetNZBInfo()->SetUnpackCleanedUpDisk(m_bCleanedUpDisk); - m_pPostInfo->SetStage(PostInfo::ptQueued); -#ifndef DISABLE_PARCHECK - if (m_bHasParInArchive) + if (g_pOptions->GetParRename()) { - PrintMessage(Message::mkInfo, "%s found par-files in archive", m_szInfoNameUp); - RequestParCheck(true); + //request par-rename check fro extracted files + m_pPostInfo->GetNZBInfo()->SetRenameStatus(NZBInfo::rsNone); } -#endif + m_pPostInfo->SetStage(PostInfo::ptQueued); } else { #ifndef DISABLE_PARCHECK if (!m_bUnpackOK && m_pPostInfo->GetNZBInfo()->GetParStatus() <= NZBInfo::psSkipped && !m_bUnpackStartError && !GetTerminated() && m_bHasParFiles) { - RequestParCheck(false); + RequestParCheck(); } else #endif @@ -308,17 +305,10 @@ void UnpackController::Completed() } #ifndef DISABLE_PARCHECK -void UnpackController::RequestParCheck(bool bRename) +void UnpackController::RequestParCheck() { - PrintMessage(Message::mkInfo, "%s requested %s", m_szInfoNameUp, bRename ? "par-rename": "par-check/repair"); - if (bRename) - { - m_pPostInfo->SetRequestParRename(true); - } - else - { - m_pPostInfo->SetRequestParCheck(true); - } + PrintMessage(Message::mkInfo, "%s requested par-check/repair", m_szInfoNameUp); + m_pPostInfo->SetRequestParCheck(true); m_pPostInfo->SetStage(PostInfo::ptFinished); } #endif @@ -419,8 +409,6 @@ bool UnpackController::Cleanup() if (m_bUnpackOK) { - CheckHasPar(m_szUnpackDir); - // moving files back DirBrowser dir(m_szUnpackDir); while (const char* filename = dir.Next()) @@ -512,38 +500,6 @@ bool UnpackController::Cleanup() return bOK; } -bool UnpackController::CheckHasPar(const char* szDirectory) -{ - DirBrowser dir(szDirectory); - while (const char* filename = dir.Next()) - { - if (strcmp(filename, ".") && strcmp(filename, "..") && - strcmp(filename, ".AppleDouble") && strcmp(filename, ".DS_Store")) - { - char szSrcFile[1024]; - snprintf(szSrcFile, 1024, "%s%c%s", m_szUnpackDir, PATH_SEPARATOR, filename); - szSrcFile[1024-1] = '\0'; - - if (Util::DirectoryExists(szSrcFile)) - { - CheckHasPar(szSrcFile); - } - else - { - int iLen = strlen(filename); - bool bParFile = iLen > 5 && !strcasecmp(filename + iLen - 5, ".par2"); - m_bHasParInArchive |= bParFile; - } - - if (m_bHasParInArchive) - { - return true; - } - } - } - return m_bHasParInArchive; -} - /** * Unrar prints progress information into the same line using backspace control character. * In order to print progress continuously we analyze the output after every char diff --git a/Unpack.h b/Unpack.h index 9e502e0a..bd11951e 100644 --- a/Unpack.h +++ b/Unpack.h @@ -70,7 +70,6 @@ private: bool m_bUnpackOK; bool m_bUnpackStartError; bool m_bCleanedUpDisk; - bool m_bHasParInArchive; EUnpacker m_eUnpacker; FileList m_archiveFiles; @@ -84,9 +83,8 @@ protected: bool Cleanup(); void CheckArchiveFiles(bool bScanNonStdFiles); void SetProgressLabel(const char* szProgressLabel); - bool CheckHasPar(const char* szDirectory); #ifndef DISABLE_PARCHECK - void RequestParCheck(bool bRename); + void RequestParCheck(); #endif public: diff --git a/nzbget.conf b/nzbget.conf index a8d12f33..7ca63eb9 100644 --- a/nzbget.conf +++ b/nzbget.conf @@ -1152,12 +1152,11 @@ ParRepair=yes # issues. Please apply the patches to libpar2 and recompile it. ParScan=auto -# Force par-rename (yes, no). +# Check for renamed files (yes, no). # # Par-rename restores original file names using information stored # in par2-files. When enabled the par-rename is performed as a first -# step of post-processing for every nzb-file having par2-files. When -# disabled the par-rename is performed only if requested by unpacker. +# step of post-processing for every nzb-file having par2-files. # # Par-rename is very fast and is highly recommended, especially if # unpack is disabled.