Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Commit

Permalink
closes #147: par-check doesn't ignore files from option "ExtCleanupDisk"
Browse files Browse the repository at this point in the history
Only files listed in option ParIgnoreExt are ignored.
  • Loading branch information
hugbug committed Jan 9, 2016
1 parent 362ee70 commit 0732cb4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
6 changes: 2 additions & 4 deletions daemon/postprocess/ParChecker.cpp
Expand Up @@ -1126,8 +1126,7 @@ void ParChecker::signal_done(std::string str, int available, int total)
}
}

bool ignore = Util::MatchFileExt(filename, g_Options->GetParIgnoreExt(), ",;") ||
Util::MatchFileExt(filename, g_Options->GetExtCleanupDisk(), ",;");
bool ignore = Util::MatchFileExt(filename, g_Options->GetParIgnoreExt(), ",;");
m_hasDamagedFiles |= !ignore;

if (fileExists)
Expand Down Expand Up @@ -1168,8 +1167,7 @@ void ParChecker::CheckEmptyFiles()
const char* filename = filenameObj.c_str();
if (!Util::EmptyStr(filename) && !IsProcessedFile(filename))
{
bool ignore = Util::MatchFileExt(filename, g_Options->GetParIgnoreExt(), ",;") ||
Util::MatchFileExt(filename, g_Options->GetExtCleanupDisk(), ",;");
bool ignore = Util::MatchFileExt(filename, g_Options->GetParIgnoreExt(), ",;");
m_hasDamagedFiles |= !ignore;

int total = sourcefile->GetVerificationPacket() ? sourcefile->GetVerificationPacket()->BlockCount() : 0;
Expand Down
3 changes: 1 addition & 2 deletions daemon/postprocess/ParRenamer.cpp
Expand Up @@ -222,8 +222,7 @@ void ParRenamer::CheckMissing()
FileHash& fileHash = *it;
if (!fileHash.GetFileExists())
{
if (Util::MatchFileExt(fileHash.GetFilename(), g_Options->GetParIgnoreExt(), ",;") ||
Util::MatchFileExt(fileHash.GetFilename(), g_Options->GetExtCleanupDisk(), ",;"))
if (Util::MatchFileExt(fileHash.GetFilename(), g_Options->GetParIgnoreExt(), ",;"))
{
PrintMessage(Message::mkInfo, "File %s is missing, ignoring", fileHash.GetFilename());
}
Expand Down
2 changes: 1 addition & 1 deletion daemon/queue/NzbFile.cpp
Expand Up @@ -346,7 +346,7 @@ void NzbFile::CalcHashes()

// check file extension
bool skip = !fileInfo->GetParFile() &&
Util::MatchFileExt(fileInfo->GetFilename(), g_Options->GetExtCleanupDisk(), ",;");
Util::MatchFileExt(fileInfo->GetFilename(), g_Options->GetParIgnoreExt(), ",;");

for (FileInfo::Articles::iterator it = fileInfo->GetArticles()->begin(); it != fileInfo->GetArticles()->end(); it++)
{
Expand Down
6 changes: 0 additions & 6 deletions nzbget.conf
Expand Up @@ -1274,8 +1274,6 @@ ParThreads=0
# will ignore files matching this option and will not initiate
# repair. This avoids time costing repair for unimportant files.
#
# NOTE: Files matching the option <ExtCleanupDisk> are ignored as well.
#
# Example: .sfv, .nzb, .nfo
ParIgnoreExt=.sfv, .nzb, .nfo

Expand Down Expand Up @@ -1415,10 +1413,6 @@ SevenZipCmd=7z
# extensions, file names or file masks containing wildcard
# characters * and ?.
#
# Files listed here are also ignored by par-rename and par-check.
#
# NOTE: See also option <ParIgnoreExt>.
#
# Example: .par2, .sfv
ExtCleanupDisk=.par2, .sfv, _brokenlog.txt

Expand Down
6 changes: 5 additions & 1 deletion tests/postprocess/ParCheckerTest.cpp
Expand Up @@ -235,14 +235,18 @@ TEST_CASE("Par-checker: ignoring extensions", "[Par][ParChecker][Slow][TestData]
cmdOpts.push_back("ParRepair=yes");
cmdOpts.push_back("BrokenLog=no");

ParChecker::EStatus expectedStatus;

SECTION("ParIgnoreExt")
{
cmdOpts.push_back("ParIgnoreExt=.dat");
expectedStatus = ParChecker::psRepairNotNeeded;
}

SECTION("ExtCleanupDisk")
{
cmdOpts.push_back("ExtCleanupDisk=.dat");
expectedStatus = ParChecker::psFailed;
}

Options options(&cmdOpts, nullptr);
Expand All @@ -258,5 +262,5 @@ TEST_CASE("Par-checker: ignoring extensions", "[Par][ParChecker][Slow][TestData]

parChecker.Execute();

REQUIRE(parChecker.GetStatus() == ParChecker::psRepairNotNeeded);
REQUIRE(parChecker.GetStatus() == expectedStatus);
}

0 comments on commit 0732cb4

Please sign in to comment.