Codebase list nzbget / e172b36
Merge tag 'upstream/17.1+dfsg' Upstream version 17.1+dfsg Andreas Moog 7 years ago
28 changed file(s) with 178 addition(s) and 108 deletion(s). Raw diff Collapse all Expand all
0 nzbget-17.1:
1 - adjustments and fixes for "Retry failed articles" function, better handling
2 of certain corner cases;
3 - partial compatibility with gcc 4.8;
4 - removed unnecessary debug logging to javascript console;
5 - improved error reporting on certain file operations;
6 - corrected option description;
7 - corrected text in history delete confirmation dialog;
8 - fixed performance issue on certain Windows systems;
9 - fixed: root drive paths on Windows could not be used (for example
10 "NzbDir=N:\");
11 - fixed hanging after marking as BAD from queue script;
12 - fixed: old nzbget.exe was deleted even when installing into a new directory
13 (Windows only);
14 - fixed: compilation error if configured with unit tests but without par-module;
15 - fixed crash on malformed articles;
16 - fixed javascript error on Chrome for Linux;
17 - fixed compilation error if configured without TLS.
18
019 nzbget-17.0:
120 - reworked the full source code base to utilize modern C++ features:
221 - with the main motivation to make the code nicer and more fun to work
216216 tests/main/CommandLineParserTest.cpp \
217217 tests/main/OptionsTest.cpp \
218218 tests/feed/FeedFilterTest.cpp \
219 tests/postprocess/ParCheckerTest.cpp \
220 tests/postprocess/ParRenamerTest.cpp \
221219 tests/postprocess/DupeMatcherTest.cpp \
222220 tests/queue/NzbFileTest.cpp \
223221 tests/nntp/ServerPoolTest.cpp \
224222 tests/util/FileSystemTest.cpp \
225223 tests/util/NStringTest.cpp \
226224 tests/util/UtilTest.cpp
225
226 if WITH_PAR2
227 nzbget_SOURCES += \
228 tests/postprocess/ParCheckerTest.cpp \
229 tests/postprocess/ParRenamerTest.cpp
230 endif
227231
228232 AM_CPPFLAGS += \
229233 -I$(srcdir)/lib/catch \
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.61 for nzbget 17.0.
2 # Generated by GNU Autoconf 2.61 for nzbget 17.1.
33 #
44 # Report bugs to <hugbug@users.sourceforge.net>.
55 #
573573 # Identity of this package.
574574 PACKAGE_NAME='nzbget'
575575 PACKAGE_TARNAME='nzbget'
576 PACKAGE_VERSION='17.0'
577 PACKAGE_STRING='nzbget 17.0'
576 PACKAGE_VERSION='17.1'
577 PACKAGE_STRING='nzbget 17.1'
578578 PACKAGE_BUGREPORT='hugbug@users.sourceforge.net'
579579
580580 ac_unique_file="daemon/main/nzbget.cpp"
12501250 # Omit some internal or obsolete options to make the list less imposing.
12511251 # This message is too long to be a string in the A/UX 3.1 sh.
12521252 cat <<_ACEOF
1253 \`configure' configures nzbget 17.0 to adapt to many kinds of systems.
1253 \`configure' configures nzbget 17.1 to adapt to many kinds of systems.
12541254
12551255 Usage: $0 [OPTION]... [VAR=VALUE]...
12561256
13211321
13221322 if test -n "$ac_init_help"; then
13231323 case $ac_init_help in
1324 short | recursive ) echo "Configuration of nzbget 17.0:";;
1324 short | recursive ) echo "Configuration of nzbget 17.1:";;
13251325 esac
13261326 cat <<\_ACEOF
13271327
14651465 test -n "$ac_init_help" && exit $ac_status
14661466 if $ac_init_version; then
14671467 cat <<\_ACEOF
1468 nzbget configure 17.0
1468 nzbget configure 17.1
14691469 generated by GNU Autoconf 2.61
14701470
14711471 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
14791479 This file contains any messages produced by compilers while
14801480 running configure, to aid debugging if configure makes a mistake.
14811481
1482 It was created by nzbget $as_me 17.0, which was
1482 It was created by nzbget $as_me 17.1, which was
14831483 generated by GNU Autoconf 2.61. Invocation command line was
14841484
14851485 $ $0 $@
22752275
22762276 # Define the identity of the package.
22772277 PACKAGE='nzbget'
2278 VERSION='17.0'
2278 VERSION='17.1'
22792279
22802280
22812281 cat >>confdefs.h <<_ACEOF
1182411824 # report actual input values of CONFIG_FILES etc. instead of their
1182511825 # values after options handling.
1182611826 ac_log="
11827 This file was extended by nzbget $as_me 17.0, which was
11827 This file was extended by nzbget $as_me 17.1, which was
1182811828 generated by GNU Autoconf 2.61. Invocation command line was
1182911829
1183011830 CONFIG_FILES = $CONFIG_FILES
1187711877 _ACEOF
1187811878 cat >>$CONFIG_STATUS <<_ACEOF
1187911879 ac_cs_version="\\
11880 nzbget config.status 17.0
11880 nzbget config.status 17.1
1188111881 configured by $0, generated by GNU Autoconf 2.61,
1188211882 with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
1188311883
2020 # Process this file with autoconf to produce a configure script.
2121
2222 AC_PREREQ(2.59)
23 AC_INIT(nzbget, 17.0, hugbug@users.sourceforge.net)
23 AC_INIT(nzbget, 17.1, hugbug@users.sourceforge.net)
2424 AC_CONFIG_AUX_DIR(posix)
2525 AC_CANONICAL_TARGET
2626 AM_INIT_AUTOMAKE([foreign])
109109 NzbInfo* nzbInfo = downloadQueue->GetQueue()->Find(m_id);
110110 if (nzbInfo)
111111 {
112 PrintMessage(Message::mkWarning, "Cancelling download and deleting %s", *m_nzbName);
112 nzbInfo->PrintMessage(Message::mkWarning, "Cancelling download and deleting %s", *m_nzbName);
113113 nzbInfo->SetDeleteStatus(NzbInfo::dsBad);
114114 downloadQueue->EditEntry(m_id, DownloadQueue::eaGroupDelete, 0, nullptr);
115115 }
214214 NzbInfo* nzbInfo = QueueScriptCoordinator::FindNzbInfo(downloadQueue, m_id);
215215 if (nzbInfo)
216216 {
217 SetLogPrefix(nullptr);
218 PrintMessage(Message::mkWarning, "Marking %s as bad", *m_nzbName);
219 SetLogPrefix(m_script->GetDisplayName());
217 nzbInfo->PrintMessage(Message::mkWarning, "Marking %s as bad", *m_nzbName);
220218 nzbInfo->SetMarkStatus(NzbInfo::ksBad);
221219 }
222220 }
956956 #ifdef DISABLE_TLS
957957 if (tls)
958958 {
959 ConfigError("Invalid value for option \"%s\": program was compiled without TLS/SSL-support", optname);
959 ConfigError("Invalid value for option \"%s\": program was compiled without TLS/SSL-support",
960 *BString<100>("Server%i.Encryption", n));
960961 tls = false;
961962 }
962963 #endif
3939 Guard guard(m_taskListMutex);
4040
4141 std::sort(m_taskList.begin(), m_taskList.end(),
42 [](std::unique_ptr<Task>& task1, std::unique_ptr<Task>& task2)
42 [](const std::unique_ptr<Task>& task1, const std::unique_ptr<Task>& task2)
4343 {
4444 return (task1->m_hours < task2->m_hours) ||
4545 ((task1->m_hours == task2->m_hours) && (task1->m_minutes < task2->m_minutes));
339339 #define SCANF_SYNTAX(strindex)
340340 #endif
341341
342 // providing "std::make_unique" for GCC 4.8.x (only 4.8.x)
343 #if __GNUC__ && __cplusplus < 201402L && __cpp_generic_lambdas < 201304
344 namespace std {
345 template<class T> struct _Unique_if { typedef unique_ptr<T> _Single_object; };
346 template<class T> struct _Unique_if<T[]> { typedef unique_ptr<T[]> _Unknown_bound; };
347 template<class T, class... Args> typename _Unique_if<T>::_Single_object make_unique(Args&&... args) {
348 return unique_ptr<T>(new T(std::forward<Args>(args)...));
349 }
350 template<class T> typename _Unique_if<T>::_Unknown_bound make_unique(size_t n) {
351 typedef typename remove_extent<T>::type U;
352 return unique_ptr<T>(new U[n]());
353 }
354 }
355 #endif
356
342357 #endif /* NZBGET_H */
128128 // park remaining files
129129 for (FileInfo* fileInfo : nzbInfo->GetFileList())
130130 {
131 fileInfo->GetNzbInfo()->UpdateCompletedStats(fileInfo);
132 fileInfo->GetNzbInfo()->GetCompletedFiles()->emplace_back(fileInfo->GetId(),
131 nzbInfo->UpdateCompletedStats(fileInfo);
132 nzbInfo->GetCompletedFiles()->emplace_back(fileInfo->GetId(),
133133 fileInfo->GetFilename(), CompletedFile::cfNone, 0);
134134 }
135135
136136 // Cleaning up parked files if par-check was successful or unpack was successful or
137 // health is 100% (if unpack and par-check were not performed)
137 // health is 100% (if unpack and par-check were not performed) or if deleted
138138 bool cleanupParkedFiles =
139139 ((nzbInfo->GetParStatus() == NzbInfo::psSuccess ||
140140 nzbInfo->GetParStatus() == NzbInfo::psRepairPossible) &&
146146 (nzbInfo->GetUnpackStatus() <= NzbInfo::usSkipped &&
147147 nzbInfo->GetParStatus() != NzbInfo::psFailure &&
148148 nzbInfo->GetFailedSize() - nzbInfo->GetParFailedSize() == 0) ||
149 nzbInfo->GetUnpackCleanedUpDisk();
149 (nzbInfo->GetDeleteStatus() != NzbInfo::dsNone);
150
151 // Do not cleanup when parking
152 cleanupParkedFiles &= !nzbInfo->GetParking();
153
154 // Parking not possible if files were already deleted
155 cleanupParkedFiles |= nzbInfo->GetUnpackCleanedUpDisk();
150156
151157 if (cleanupParkedFiles)
152158 {
157163 nzbInfo->SetParkedFileCount(0);
158164 for (CompletedFile& completedFile : nzbInfo->GetCompletedFiles())
159165 {
160 if (completedFile.GetStatus() == CompletedFile::cfNone)
166 if (completedFile.GetStatus() == CompletedFile::cfNone ||
167 // consider last completed file with partial status not completely tried
168 (completedFile.GetStatus() == CompletedFile::cfPartial &&
169 &completedFile == &*nzbInfo->GetCompletedFiles()->rbegin()))
161170 {
162171 nzbInfo->PrintMessage(Message::mkDetail, "Parking file %s", completedFile.GetFileName());
163172 nzbInfo->SetParkedFileCount(nzbInfo->GetParkedFileCount() + 1);
575584 (resetFailed || fileInfo->GetRemainingSize() > 0))))
576585 {
577586 fileInfo->SetFilename(completedFile.GetFileName());
578 fileInfo->SetPaused(fileInfo->GetParFile());
579587 fileInfo->SetNzbInfo(nzbInfo);
580588
581589 BString<1024> outputFilename("%s%c%s", nzbInfo->GetDestDir(), PATH_SEPARATOR, fileInfo->GetFilename());
594602 else if (!reprocess)
595603 {
596604 nzbInfo->PrintMessage(Message::mkWarning, "File %s could not be found on disk, downloading again", fileInfo->GetFilename());
605 fileInfo->SetPartialState(FileInfo::psNone);
597606 }
598607 }
599608
618627 nzbInfo->UpdateCurrentStats();
619628
620629 MoveToQueue(downloadQueue, itHistory, historyInfo, reprocess);
630
631 if (g_Options->GetParCheck() != Options::pcForce)
632 {
633 downloadQueue->EditEntry(nzbInfo->GetId(), DownloadQueue::eaGroupPauseExtraPars, 0, nullptr);
634 }
621635 }
622636
623637 void HistoryCoordinator::ResetArticles(FileInfo* fileInfo, bool allFailed, bool resetFailed)
708708 {
709709 fileInfo->GetNzbInfo()->GetCompletedFiles()->emplace_back(
710710 fileInfo->GetId(),
711 completed ? FileSystem::BaseFileName(fileInfo->GetOutputFilename()) : fileInfo->GetFilename(),
711 completed && fileInfo->GetOutputFilename() ?
712 FileSystem::BaseFileName(fileInfo->GetOutputFilename()) : fileInfo->GetFilename(),
712713 fileStatus,
713714 fileStatus == CompletedFile::cfSuccess ? fileInfo->GetCrc() : 0);
714715 }
3737 GroupSorter(NzbList* nzbList, QueueEditor::ItemList* sortItemList) :
3838 m_nzbList(nzbList), m_sortItemList(sortItemList) {}
3939 bool Execute(const char* sort);
40 bool operator()(std::unique_ptr<NzbInfo>& refNzbInfo1, std::unique_ptr<NzbInfo>& refNzbInfo2) const;
40 bool operator()(const std::unique_ptr<NzbInfo>& refNzbInfo1, const std::unique_ptr<NzbInfo>& refNzbInfo2) const;
4141
4242 private:
4343 enum ESortCriteria
128128 std::sort(m_nzbList->begin(), m_nzbList->end(), *this);
129129
130130 if (origSortOrder == soAuto &&
131 std::equal(tempList.begin(), tempList.end(), m_nzbList->begin(), m_nzbList->end(),
131 std::equal(tempList.begin(), tempList.end(), m_nzbList->begin(),
132132 [](NzbInfo* nzbInfo1, std::unique_ptr<NzbInfo>& nzbInfo2)
133133 {
134134 return nzbInfo1 == nzbInfo2.get();
141141 return true;
142142 }
143143
144 bool GroupSorter::operator()(std::unique_ptr<NzbInfo>& refNzbInfo1, std::unique_ptr<NzbInfo>& refNzbInfo2) const
144 bool GroupSorter::operator()(const std::unique_ptr<NzbInfo>& refNzbInfo1, const std::unique_ptr<NzbInfo>& refNzbInfo2) const
145145 {
146146 NzbInfo* nzbInfo1 = refNzbInfo1.get();
147147 NzbInfo* nzbInfo2 = refNzbInfo2.get();
777777 nzbInfo->SetParking(action == DownloadQueue::eaGroupParkDelete &&
778778 g_Options->GetKeepHistory() > 0 &&
779779 !nzbInfo->GetUnpackCleanedUpDisk() &&
780 (nzbInfo->GetSuccessArticles() > 0 || nzbInfo->GetFailedArticles() > 0));
780 nzbInfo->GetCurrentSuccessArticles() > 0);
781781 nzbInfo->SetAvoidHistory(action == DownloadQueue::eaGroupFinalDelete);
782782 nzbInfo->SetDeletePaused(allPaused);
783783 if (action == DownloadQueue::eaGroupDupeDelete)
24252425 "<member><name>ID</name><value><i4>%i</i4></value></member>\n" // Deprecated, use "NZBID" instead
24262426 "<member><name>Name</name><value><string>%s</string></value></member>\n"
24272427 "<member><name>RemainingFileCount</name><value><i4>%i</i4></value></member>\n"
2428 "<member><name>RetryData</name><value><boolean>%s</boolean></value></member>\n"
24282429 "<member><name>HistoryTime</name><value><i4>%i</i4></value></member>\n"
24292430 "<member><name>Status</name><value><string>%s</string></value></member>\n"
24302431 "<member><name>Log</name><value><array><data></data></array></value></member>\n"; // Deprected, always empty
24342435 "\"ID\" : %i,\n" // Deprecated, use "NZBID" instead
24352436 "\"Name\" : \"%s\",\n"
24362437 "\"RemainingFileCount\" : %i,\n"
2438 "\"RetryData\" : %s,\n"
24372439 "\"HistoryTime\" : %i,\n"
24382440 "\"Status\" : \"%s\",\n"
24392441 "\"Log\" : [],\n"; // Deprected, always empty
25052507
25062508 AppendFmtResponse(IsJson() ? JSON_HISTORY_ITEM_START : XML_HISTORY_ITEM_START,
25072509 historyInfo->GetId(), *EncodeStr(historyInfo->GetName()), nzbInfo->GetParkedFileCount(),
2508 historyInfo->GetTime(), status);
2510 BoolToStr(nzbInfo->GetCompletedFiles()->size()), historyInfo->GetTime(), status);
25092511 }
25102512 else if (historyInfo->GetKind() == HistoryInfo::hkDup)
25112513 {
2929 {
3030 BString<1024> msg;
3131 strerror_r(errno, msg, msg.Capacity());
32
33 #ifdef WIN32
34 if (!errno)
35 {
36 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
37 nullptr, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
38 msg, 1024, nullptr);
39 }
40 #endif
41
3242 return *msg;
3343 }
3444
104114 }
105115 }
106116
117 errmsg.Format("path %s does not exist and could not be created", *normPath);
107118 return false;
108119 }
109120 #else
248259 HANDLE hFile = CreateFileW(UtfPathToWidePath(filename), GENERIC_WRITE, FILE_SHARE_READ, 0, CREATE_NEW, 0, nullptr);
249260 if (hFile == INVALID_HANDLE_VALUE)
250261 {
262 errno = 0; // wanting error message from WinAPI instead of C-lib
251263 errmsg = GetLastErrorMessage();
252264 return false;
253265 }
525537 {
526538 #ifdef WIN32
527539 WIN32_FIND_DATAW findData;
528 // extra "\*" needed for network shares
529540 HANDLE handle = FindFirstFileW(UtfPathToWidePath(
530541 BString<1024>(dirFilename && dirFilename[strlen(dirFilename) - 1] == PATH_SEPARATOR ? "%s*" : "%s\\*", dirFilename)),
531542 &findData);
532543 if (handle != INVALID_HANDLE_VALUE)
533544 {
534545 bool exists = ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) ||
535 (strlen(dirFilename) == 3 && dirFilename[1] == ':');
546 (dirFilename[0] != '\0' && dirFilename[1] == ':' && (dirFilename[2] == '\0' || dirFilename[3] == '\0'));
536547 FindClose(handle);
537548 return exists;
549 }
550 if (GetLastError() == ERROR_FILE_NOT_FOUND)
551 {
552 // path exists but doesn't have any file/directory entries - possible only for root paths (e. g. "C:\")
553 return true;
538554 }
539555 return false;
540556 #else
840856 BOOL ok = ::FlushFileBuffers((HANDLE)_get_osfhandle(fileDescriptor));
841857 if (!ok)
842858 {
843 errmsg.Reserve(1024 - 1);
844 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
845 nullptr, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
846 errmsg, 1024, nullptr);
859 errno = 0; // wanting error message from WinAPI instead of C-lib
860 errmsg = GetLastErrorMessage();
847861 }
848862 return ok;
849863 #else
505505
506506 time_t Util::CurrentTime()
507507 {
508 #ifdef WIN32
509 // C-library function "time()" works on Windows too but is very CPU intensive
510 // since it uses high performance timer which we don't need anyway.
511 // A combination of GetSystemTime() + Timegm() works much faster.
512 SYSTEMTIME systm;
513 GetSystemTime(&systm);
514 struct tm tm;
515 tm.tm_year = systm.wYear - 1900;
516 tm.tm_mon = systm.wMonth - 1;
517 tm.tm_mday = systm.wDay;
518 tm.tm_hour = systm.wHour;
519 tm.tm_min = systm.wMinute;
520 tm.tm_sec = systm.wSecond;
521 return Timegm(&tm);
522 #else
508523 return ::time(nullptr);
524 #endif
509525 }
510526
511527 /* From boost */
1313 #
1414 # If you want to distinguish between partially downloaded files and
1515 # completed downloads, use also option <InterDir>.
16 #
17 # It is allowed to enter multiple directories here by separating them with comma
18 # or semicolon. NZBGet checks how much free disk space is available in each
19 # directory (assuming all directories are located on different drives) and
20 # chooses the directory with the most free space.
2116 DestDir=${MainDir}/dst
2217
2318 # Directory to store intermediate files.
5151 <ClCompile>
5252 <Optimization>Disabled</Optimization>
5353 <AdditionalIncludeDirectories>.\daemon\connect;.\daemon\extension;.\daemon\feed;.\daemon\frontend;.\daemon\main;.\daemon\nntp;.\daemon\postprocess;.\daemon\queue;.\daemon\remote;.\daemon\util;.\daemon\windows;.\lib\par2;.\windows\resources;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
54 <PreprocessorDefinitions>WIN32;PACKAGE="nzbget";VERSION="17.0";_DEBUG;_CONSOLE;DEBUG;_WIN32_WINNT=0x0403;%(PreprocessorDefinitions)</PreprocessorDefinitions>
54 <PreprocessorDefinitions>WIN32;PACKAGE="nzbget";VERSION="17.1";_DEBUG;_CONSOLE;DEBUG;_WIN32_WINNT=0x0403;%(PreprocessorDefinitions)</PreprocessorDefinitions>
5555 <MinimalRebuild>false</MinimalRebuild>
5656 <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
5757 <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
7171 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
7272 <ClCompile>
7373 <AdditionalIncludeDirectories>.\daemon\connect;.\daemon\extension;.\daemon\feed;.\daemon\frontend;.\daemon\main;.\daemon\nntp;.\daemon\postprocess;.\daemon\queue;.\daemon\remote;.\daemon\util;.\daemon\windows;.\lib\par2;.\windows\resources;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
74 <PreprocessorDefinitions>WIN32;PACKAGE="nzbget";VERSION="17.0";NDEBUG;_CONSOLE;_WIN32_WINNT=0x0403;%(PreprocessorDefinitions)</PreprocessorDefinitions>
74 <PreprocessorDefinitions>WIN32;PACKAGE="nzbget";VERSION="17.1";NDEBUG;_CONSOLE;_WIN32_WINNT=0x0403;%(PreprocessorDefinitions)</PreprocessorDefinitions>
7575 <ExceptionHandling>Sync</ExceptionHandling>
7676 <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
7777 <PrecompiledHeader>Use</PrecompiledHeader>
15361536 $('#Notif_Config_TestConnectionProgress').fadeOut(function() {
15371537 if (errtext == '')
15381538 {
1539 Notification.show('#Notif_Config_TestConnectionOK');
1539 PopupNotification.show('#Notif_Config_TestConnectionOK');
15401540 }
15411541 else
15421542 {
16611661
16621662 if (serverSaveRequest.length === 0 && webSaveRequest.length === 0)
16631663 {
1664 Notification.show('#Notif_Config_Unchanged');
1664 PopupNotification.show('#Notif_Config_Unchanged');
16651665 return;
16661666 }
16671667
17051705 }
17061706 else
17071707 {
1708 Notification.show('#Notif_Config_Failed');
1708 PopupNotification.show('#Notif_Config_Failed');
17091709 }
17101710 configSaved = true;
17111711 }
25552555 var checkedCount = $SectionTable.fasttable('checkedCount');
25562556 if (checkedCount === 0)
25572557 {
2558 Notification.show('#Notif_Config_RestoreSections');
2558 PopupNotification.show('#Notif_Config_RestoreSections');
25592559 return;
25602560 }
25612561
28132813 {
28142814 if (!started)
28152815 {
2816 Notification.show('#Notif_StartUpdate_Failed');
2816 PopupNotification.show('#Notif_StartUpdate_Failed');
28172817 return;
28182818 }
28192819
354354 Refresher.update();
355355 if (notification)
356356 {
357 Notification.show(notification);
357 PopupNotification.show(notification);
358358 notification = null;
359359 }
360360 }
374374 {
375375 if (group.postprocess && !allowPostProcess)
376376 {
377 Notification.show('#Notif_Downloads_CheckPostProcess');
377 PopupNotification.show('#Notif_Downloads_CheckPostProcess');
378378 return null;
379379 }
380380 if (group.Kind === 'URL' && !allowUrl)
381381 {
382 Notification.show('#Notif_Downloads_CheckURL');
382 PopupNotification.show('#Notif_Downloads_CheckURL');
383383 return null;
384384 }
385385
389389
390390 if (checkedEditIDs.length === 0 && !allowEmpty)
391391 {
392 Notification.show('#Notif_Downloads_Select');
392 PopupNotification.show('#Notif_Downloads_Select');
393393 return null;
394394 }
395395
426426
427427 if (checkedEditIDs.length < 2)
428428 {
429 Notification.show('#Notif_Downloads_SelectMulti');
429 PopupNotification.show('#Notif_Downloads_SelectMulti');
430430 return;
431431 }
432432
489489
490490 if (downloadIDs.length === 0 && postprocessIDs.length === 0)
491491 {
492 Notification.show('#Notif_Downloads_Select');
492 PopupNotification.show('#Notif_Downloads_Select');
493493 return;
494494 }
495495
298298 Refresher.update();
299299 if (notification)
300300 {
301 Notification.show(notification);
301 PopupNotification.show(notification);
302302 notification = null;
303303 }
304304 }
654654 var checkedCount = $DownloadsFileTable.fasttable('checkedCount');
655655 if (checkedCount === 0)
656656 {
657 Notification.show('#Notif_Edit_Select');
657 PopupNotification.show('#Notif_Edit_Select');
658658 return;
659659 }
660660
747747 {
748748 if (splitError)
749749 {
750 Notification.show('#Notif_Downloads_SplitNotPossible');
750 PopupNotification.show('#Notif_Downloads_SplitNotPossible');
751751 }
752752 else
753753 {
14151415 Refresher.update();
14161416 if (notification)
14171417 {
1418 Notification.show(notification);
1418 PopupNotification.show(notification);
14191419 }
14201420 }
14211421 }(jQuery));
14831483 {
14841484 $DownloadsMergeDialog.modal('hide');
14851485 Refresher.update();
1486 Notification.show('#Notif_Downloads_Merged');
1486 PopupNotification.show('#Notif_Downloads_Merged');
14871487 }
14881488 }(jQuery));
14891489
15401540 $('#DownloadsEditDialog').modal('hide');
15411541 $DownloadsSplitDialog.modal('hide');
15421542 Refresher.update();
1543 Notification.show(result ? '#Notif_Downloads_Splitted' : '#Notif_Downloads_SplitError');
1543 PopupNotification.show(result ? '#Notif_Downloads_Splitted' : '#Notif_Downloads_SplitError');
15441544 }
15451545 }(jQuery));
15461546
17391739 Util.show('#HistoryEdit_Return', hist.RemainingFileCount > 0);
17401740 Util.show('#HistoryEdit_ReturnURL', hist.Kind === 'URL');
17411741 Util.show('#HistoryEdit_Redownload', hist.Kind === 'NZB');
1742 Util.show('#HistoryEdit_RetryFailed', hist.Kind === 'NZB' && hist.FailedArticles > 0 && hist.ParStatus !== 'SUCCESS' &&
1743 (hist.DeleteStatus === 'NONE' || hist.RemainingFileCount > 0));
1742 Util.show('#HistoryEdit_RetryFailed', hist.Kind === 'NZB' && hist.FailedArticles > 0 && hist.RetryData);
17441743 Util.show('#HistoryEdit_PathGroup, #HistoryEdit_StatisticsGroup, #HistoryEdit_Reprocess', hist.Kind === 'NZB');
17451744 Util.show('#HistoryEdit_CategoryGroup', hist.Kind !== 'DUP');
17461745 Util.show('#HistoryEdit_DupGroup', hist.Kind === 'DUP');
19011900 {
19021901 e.preventDefault();
19031902 HistoryUI.deleteConfirm(doItemDelete, curHist.Kind === 'NZB', curHist.Kind === 'DUP',
1904 curHist.ParStatus === 'FAILURE' || curHist.UnpackStatus === 'FAILURE', false);
1903 curHist.ParStatus === 'FAILURE' || curHist.UnpackStatus === 'FAILURE' ||
1904 curHist.DeleteStatus != 'NONE', false);
19051905 }
19061906
19071907 function doItemDelete(command)
19741974 Refresher.update();
19751975 if (notification)
19761976 {
1977 Notification.show(notification);
1977 PopupNotification.show(notification);
19781978 notification = null;
19791979 }
19801980 }
7979 var id = parseInt($(this).attr('data-id'));
8080 RPC.call('fetchfeed', [id], function()
8181 {
82 Notification.show('#Notif_Feeds_Fetch');
82 PopupNotification.show('#Notif_Feeds_Fetch');
8383 });
8484 }
8585
8787 {
8888 RPC.call('fetchfeed', [0], function()
8989 {
90 Notification.show('#Notif_Feeds_Fetch');
90 PopupNotification.show('#Notif_Feeds_Fetch');
9191 });
9292 }
9393 }(jQuery));
332332 var checkedCount = $ItemTable.fasttable('checkedCount');
333333 if (checkedCount === 0)
334334 {
335 Notification.show('#Notif_FeedDialog_Select');
335 PopupNotification.show('#Notif_FeedDialog_Select');
336336 return;
337337 }
338338
371371 else
372372 {
373373 $FeedDialog.modal('hide');
374 Notification.show('#Notif_FeedDialog_Fetched');
374 PopupNotification.show('#Notif_FeedDialog_Fetched');
375375 }
376376 }
377377
259259 var checkedCount = $HistoryTable.fasttable('checkedCount');
260260 if (checkedCount === 0)
261261 {
262 Notification.show('#Notif_History_Select');
262 PopupNotification.show('#Notif_History_Select');
263263 return;
264264 }
265265
275275 hasNzb |= hist.Kind === 'NZB';
276276 hasUrl |= hist.Kind === 'URL';
277277 hasDup |= hist.Kind === 'DUP';
278 hasFailed |= hist.ParStatus === 'FAILURE' || hist.UnpackStatus === 'FAILURE';
278 hasFailed |= hist.ParStatus === 'FAILURE' || hist.UnpackStatus === 'FAILURE' ||
279 hist.DeleteStatus != 'NONE';
279280 }
280281 }
281282
289290 case 'REPROCESS':
290291 if (hasUrl || hasDup)
291292 {
292 Notification.show('#Notif_History_CantReprocess');
293 PopupNotification.show('#Notif_History_CantReprocess');
293294 return;
294295 }
295296 notification = '#Notif_History_Reprocess';
299300 case 'REDOWNLOAD':
300301 if (hasDup)
301302 {
302 Notification.show('#Notif_History_CantRedownload');
303 PopupNotification.show('#Notif_History_CantRedownload');
303304 return;
304305 }
305306 notification = '#Notif_History_Returned';
314315 case 'MARKBAD':
315316 if (hasUrl)
316317 {
317 Notification.show('#Notif_History_CantMark');
318 PopupNotification.show('#Notif_History_CantMark');
318319 return;
319320 }
320321 notification = '#Notif_History_Marked';
358359 Refresher.update();
359360 if (notification)
360361 {
361 Notification.show(notification);
362 PopupNotification.show(notification);
362363 notification = null;
363364 }
364365 }
496497 this.deleteConfirm = function(actionCallback, hasNzb, hasDup, hasFailed, multi, selCount)
497498 {
498499 var dupeCheck = Options.option('DupeCheck') === 'yes';
499 var cleanupDisk = Options.option('DeleteCleanupDisk') === 'yes';
500500 var dialog = null;
501501
502502 function init(_dialog)
506506 $('#HistoryDeleteConfirmDialog_Hide', dialog).prop('checked', true);
507507 Util.show($('#HistoryDeleteConfirmDialog_Options', dialog), hasNzb && dupeCheck);
508508 Util.show($('#HistoryDeleteConfirmDialog_Simple', dialog), !(hasNzb && dupeCheck));
509 Util.show($('#HistoryDeleteConfirmDialog_DeleteWillCleanup', dialog), hasNzb && hasFailed && cleanupDisk);
510 Util.show($('#HistoryDeleteConfirmDialog_DeleteCanCleanup', dialog), hasNzb && hasFailed && !cleanupDisk);
509 Util.show($('#HistoryDeleteConfirmDialog_DeleteWillCleanup', dialog), hasNzb && hasFailed);
511510 Util.show($('#HistoryDeleteConfirmDialog_DeleteNoCleanup', dialog), !(hasNzb && hasFailed));
512511 Util.show($('#HistoryDeleteConfirmDialog_DupAlert', dialog), !hasNzb && dupeCheck && hasDup);
513512 Util.show('#ConfirmDialog_Help', hasNzb && dupeCheck);
20422042 Selected records will be deleted from history. All files remain on disk.
20432043 </p>
20442044
2045 <p id="HistoryDeleteConfirmDialog_DeleteCanCleanup" class="confirm-help-block">
2046 Selected records will be deleted from history. All files remain on disk (for failed downloads this
2047 behavior can be changed via option <strong><em>DeleteCleanupDisk</em></strong>).
2048 </p>
2049
20502045 <p id="HistoryDeleteConfirmDialog_DeleteWillCleanup" class="confirm-help-block">
2051 Selected records will be deleted from history. For failed downloads (par-failure or unpack-failure)
2052 all downloaded files will be deleted (this behavior can be changed via option <strong><em>DeleteCleanupDisk</em></strong>).
2046 Selected records will be deleted from history. For failed downloads
2047 all downloaded files will be deleted.
20532048 </p>
20542049
20552050 <p id="HistoryDeleteConfirmDialog_DupAlert" class="alert alert-warning" style="margin-top: 10px;">
811811 function TODO(text)
812812 {
813813 $('#Notif_NotImplemented_Param').html(text === undefined ? '' : ': ' + text);
814 Notification.show('#Notif_NotImplemented');
814 PopupNotification.show('#Notif_NotImplemented');
815815 }
816816
817817
911911
912912 /*** NOTIFICATIONS *********************************************************/
913913
914 var Notification = (new function($)
914 var PopupNotification = (new function($)
915915 {
916916 'use strict';
917917
303303 Refresher.update();
304304 if (notification)
305305 {
306 Notification.show(notification);
306 PopupNotification.show(notification);
307307 notification = null;
308308 }
309309 }
207207 showBtn.fadeIn(500);
208208 if (!Play && !status.ServerStandBy)
209209 {
210 Notification.show('#Notif_Downloads_Pausing');
210 PopupNotification.show('#Notif_Downloads_Pausing');
211211 }
212212 }
213213 else
257257
258258 this.playClick = function()
259259 {
260 //Notification.show('#Notif_Play');
260 //PopupNotification.show('#Notif_Play');
261261
262262 if (lastPlayState)
263263 {
414414 if (title.indexOf(name) > -1)
415415 {
416416 var value = titleGen[name]();
417 console.log(name + '=' + value);
418417 title = title.replace(name, value);
419418 }
420419 }
12721271 var year = parseInt(period);
12731272 if (year < 2013 || year > 2050)
12741273 {
1275 Notification.show('#Notif_StatRangeError');
1274 PopupNotification.show('#Notif_StatRangeError');
12761275 return;
12771276 }
12781277 period = '' + year;
12831282 var year = parseInt(period.substring(0, 4));
12841283 if (year < 2013 || year > 2050 || month < 1 || month > 12)
12851284 {
1286 Notification.show('#Notif_StatRangeError');
1285 PopupNotification.show('#Notif_StatRangeError');
12871286 return;
12881287 }
12891288 period = year + '-' + (month-1);
13041303 {
13051304 RPC.call('resetservervolume', [curServer === 0 ? -1 : curServer, 'CUSTOM'], function()
13061305 {
1307 Notification.show('#Notif_StatReset');
1306 PopupNotification.show('#Notif_StatReset');
13081307 Refresher.update();
13091308 });
13101309 }
14751474 $LimitDialog.modal('hide');
14761475 if (changed)
14771476 {
1478 Notification.show('#Notif_SetSpeedLimit');
1477 PopupNotification.show('#Notif_SetSpeedLimit');
14791478 }
14801479 Refresher.update();
14811480 }
15981597 {
15991598 if ($Table_filter.val() === '')
16001599 {
1601 Notification.show('#Notif_SaveFilterEmpty');
1600 PopupNotification.show('#Notif_SaveFilterEmpty');
16021601 return;
16031602 }
16041603
12971297 filter: alpha(opacity=0);
12981298 }
12991299
1300 /* BEGIN: Notification alerts */
1300 /* BEGIN: PopupNotification alerts */
13011301 .alert-inverse {
13021302 color: #ffffff;
13031303 text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
13381338 .alert-info.alert-center {
13391339 border-color: #3a87ad;
13401340 }
1341 /* END: Notification alerts */
1341 /* END: PopupNotification alerts */
13421342
13431343 .confirm-help-block {
13441344 color: #555555;
447447 $AddDialog.modal('hide');
448448 if (index > 0)
449449 {
450 Notification.show('#Notif_AddFiles');
450 PopupNotification.show('#Notif_AddFiles');
451451 }
452452 }
453453 }
464464 {
465465 needRefresh = true;
466466 $AddDialog.modal('hide');
467 Notification.show('#Notif_Scan');
467 PopupNotification.show('#Notif_Scan');
468468 });
469469 }
470470 }(jQuery));
102102 SetOutPath "$INSTDIR"
103103
104104 ; Stop NZBGet (if running)
105 ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NZBGet" "InstallLocation"
106 ${If} $R1 != ""
107 ${AndIf} ${FileExists} "$R1\nzbget.exe"
108 Delete "$R1\nzbget.exe"
109 ExecWait '"$R1\nzbget.exe" -Q' $R2
105 ${If} ${FileExists} "$INSTDIR\nzbget.exe"
106 Delete "$INSTDIR\nzbget.exe"
107 ExecWait '"$INSTDIR\nzbget.exe" -Q' $R2
110108 DetailPrint "Stopping NZBGet..."
111109
112110 try_delete:
113111 ; Wait up to 10 seconds until stopped
114112 StrCpy $R2 20
115 ${While} ${FileExists} "$R1\nzbget.exe"
113 ${While} ${FileExists} "$INSTDIR\nzbget.exe"
116114 ${If} $R2 = 0
117115 ${Break}
118116 ${EndIf}
119117 Sleep 500
120118 IntOp $R2 $R2 - 1
121 Delete "$R1\nzbget.exe"
119 Delete "$INSTDIR\nzbget.exe"
122120 ${EndWhile}
123121
124 ${If} ${FileExists} "$R1\nzbget.exe"
122 ${If} ${FileExists} "$INSTDIR\nzbget.exe"
125123 MessageBox MB_RETRYCANCEL "NZBGet seems to be running right now. Please stop NZBGet and try again." \
126124 IDRETRY try_delete IDCANCEL cancel
127125 cancel: