Compare commits

...

43 Commits
v14.0 ... v14.2

Author SHA1 Message Date
Andrey Prygunkov
5e9afb8781 version 14.2 2015-02-15 20:19:05 +00:00
Andrey Prygunkov
f1b6492d1c fixed: unlike to all other scripts the update-script should not be automatically terminated when the program quits 2015-02-14 21:12:42 +00:00
Andrey Prygunkov
19d297f934 fixed: the program could crash during download when article cache was active (more likely on very high download speeds) 2015-02-11 22:38:59 +00:00
Andrey Prygunkov
a23128f25f addition to r1205: when sorting by priority in auto mode (without specifying + or -) the default order is descending since it is more logical to use for priority 2015-02-07 22:23:17 +00:00
Andrey Prygunkov
567f7c3028 added on-demand queue sorting; one click on column title in web interface sorts the selected or all items; if the items were already sorted in that order they are sorted backwards; in other words the second click sorts in descending order; when sorting selected items they are also grouped together in a case there were holes between selected items; RPC-method "editqueue" has new command "GroupSort", parameter "Text" must be one of: "name", "priority", "category", "size", "left"; add character "+" or "-" to sort to explicitly define ascending or descending order (for example "name-"); if none of these characters are used the auto-mode is active: the items are sorted in ascending order first, if nothing changed - they are sorted again in descending order 2015-02-07 19:17:49 +00:00
Andrey Prygunkov
30af4cfc3d fixed: XML-RPC method "history" returned invalid xml when used with parameter "hidden=true" (JSON-RPC worked correct) 2015-02-06 21:33:42 +00:00
Andrey Prygunkov
019fcf519a addition to r1182 and fix for r1193: unused connections are now closed only if there are no active connections on the same level; this reduces the reconnects during active download (which may be caused by the random connection pick-up implemented in r1182) 2015-02-03 20:05:49 +00:00
Andrey Prygunkov
1645562d78 eliminated compiler warning 2015-02-01 15:02:10 +00:00
Andrey Prygunkov
fab726482c improved windows installer: during an update the installer stops a possibly running NZBGet automatically 2015-01-27 20:32:08 +00:00
Andrey Prygunkov
351cb9835f suppress printing of memory leaks reports when the program terminates because of wrong command line switches (Windows debug mode only) 2015-01-27 20:30:14 +00:00
Andrey Prygunkov
d0d59469bc fixed: remote command "-L HA" (which prints the history including hidden records) could crash 2015-01-27 20:26:41 +00:00
Andrey Prygunkov
577d934ccd improved timeout handling during establishing of connections 2015-01-27 20:23:46 +00:00
Andrey Prygunkov
4438131d56 fixed: web-browser was launched on program reload; now it is launched only if the reload is initiated via tray menu (Windows only) 2015-01-26 21:26:32 +00:00
Andrey Prygunkov
7b13c9a9ba addition to r1182: fixed compilation error on certain systems (added missing include-directive) 2015-01-25 20:15:18 +00:00
Andrey Prygunkov
7d60566f3c reverted r1193 because of many problems reported by users (as a temporary solution) 2015-01-25 20:08:59 +00:00
Andrey Prygunkov
e9a7c2f184 fixed possible crash when using remote command "-B dump" to print debug info 2015-01-24 19:25:43 +00:00
Andrey Prygunkov
3e07873575 addition to r1182: unused connections are now closed only if there are no active connections on the same level; this reduces the reconnects during active download (which may be caused by the random connection pick-up implemented in r1182) 2015-01-24 18:49:59 +00:00
Andrey Prygunkov
2f17584ab4 update info in about dialogs (Windows and Mac OSX) 2015-01-24 12:44:27 +00:00
Andrey Prygunkov
02f87b23fb fixed: command "download again" was not disabled for hidden history records and resulted in a crash 2015-01-23 20:01:08 +00:00
Andrey Prygunkov
31032e29f5 when launching web-browser from the tray icon now using the real IP-address from option "ControlIP" instead of hard coded "127.0.0.1" (windows only) 2015-01-23 19:41:45 +00:00
Andrey Prygunkov
11bfb57809 added support for password list file; new option "UnpackPassFile" to set the location of the file; during unpack the passwords are tried from the file until unpack succeeds or all passwords were tried; implemented different strategies for rar4 and rar5-archives taking into account the features of formats; for rar5-archives a wrong password is reported by unrar unambiguously and the program can immediately try other passwords from the password list; for rar4-archives and for 7z-archives it is not possible to differentiate between damaged archive and wrong password; for those archives if the first unpack attempt (without password) fails the program executes par-check (preferably quick par-check if enabled via option "ParQuick) before trying the passwords from the list; another optimization is that the password list is tried only when the first unpack attempt (without password) reports a password error or decryption errors; this saves unnecessary unpack attempts for damaged unencrypted archives 2015-01-22 20:57:39 +00:00
Andrey Prygunkov
0e83ef32bb addition to r1187: renaming of hidden history items is now also supported 2015-01-17 16:34:49 +00:00
Andrey Prygunkov
86ae9e94cd name and category of history items can now be changed in web-interface; RPC-API method "editqueue" extended with new actions "HistorySetName" and "HistorySetCategory" 2015-01-15 20:46:17 +00:00
Andrey Prygunkov
2388250dfa added optional parameters to remote command "--append/-A" allowing to pass duplicate key, duplicate mode and duplicate score; removed parameters "F" and "U" of command "--append/-A", which were used to set mode (file or URL), which is now detected automatically; the parameters are still supported for compatibility 2015-01-15 18:09:37 +00:00
Andrey Prygunkov
d947ea65a2 added confirmation dialogs to recently implemented mass history edit commands "mark as good" and "mark as bad" 2015-01-13 21:37:04 +00:00
Andrey Prygunkov
4a11c04742 added subcommand "HA" to remote command "--list/-L" to list the whole history including hidden records 2015-01-06 20:00:22 +00:00
Andrey Prygunkov
14b24e6050 added support for negative numeric values in rss filter (useful for fields "dupescore" and "priority") 2014-12-21 19:28:38 +00:00
Andrey Prygunkov
4402d6fbd6 improved news server connections handling: if a download of an article fails due to connection error the news server becomes temporary disabled (blocked) for several seconds (defined by option "RetryInterval"); the download is then retried on another news server (of the same level) if available; if no other news servers (of the same level) exist the program will retry the same news server after its block interval expires; this increases failure tolerance when multiple news servers are used 2014-12-21 18:21:49 +00:00
Andrey Prygunkov
c69b81404c small change in error message text 2014-12-21 18:21:16 +00:00
Andrey Prygunkov
241a3efacf options "UnrarCmd" and "SevenZipCmd" can include extra switches to pass to unrar/7-zip. This allows for easy passing of additional parameters without creating of proxy shell scripts. 2014-12-12 18:22:20 +00:00
Andrey Prygunkov
185d52a9d4 added new option "ServerX.Retention" to define server retention time (days); files older than configured server retention time are not even tried on this server 2014-12-11 20:45:08 +00:00
Andrey Prygunkov
6b933f18dd options "ParIgnoreExt" and "ExtCleanupDisk" can now contain wildcard characters * and ? 2014-12-08 21:36:23 +00:00
Andrey Prygunkov
31dbbb546c created installer for windows; the program is installed into "program files" by default; the working directory with all subdirectories is now placed into "AppData" directory; the batch files nzbget-start.bat and nzbget-recovery-mode.bat are not needed and not installed anymore 2014-11-30 17:08:00 +00:00
Andrey Prygunkov
ac4f8a30e5 improved application for Windows: added tray icon (near clock); left click on icon pauses/resumes download; right lick opens menu with important functions; console window can be shown/hidden via preferences (is hidden by default); new preference to automatically start the program after login; new preference to show browser on start; new preference to hide tray icon; menu commands to show important folders in windows explorer (destination, etc.); on first start the config file is now placed into subdirectory "NZBGet" inside standard AppData-directory; default destination and other directories are now placed in the AppData\NZBGet-directory instead of programs directory; this allows to install the program into "program files"-directory since the program does not write into the programs directory anymore; the program exe has an icon now; if the exe is started from windows explorer the program starts in application mode; if the exe is called from command prompt the program works in console mode 2014-11-30 14:24:23 +00:00
Andrey Prygunkov
a060531ae3 actions for history items can now be performed for multiple (selected) records: post-process again, download again, mark as good, mark as bad; extended RPC-API method "editqueue": for history-records of type "URL" the action "HistoryRedownload" can now be used as synonym to "HistoryReturn" (makes it easier to redownload multiple items of different types (URL and NZB) with one API call) 2014-11-25 19:23:17 +00:00
Andrey Prygunkov
fb77937acd fixed: unrar may sometimes fail with message "no files to extract" 2014-11-25 19:18:07 +00:00
Andrey Prygunkov
9d9a81710f fixed false memory leak warning when compiled in debug mode (Windows only) 2014-11-24 22:31:57 +00:00
Andrey Prygunkov
c3b4438d1f fixed: program could crash during unpack (bug introduced in v14-r1130) 2014-11-22 18:03:08 +00:00
Andrey Prygunkov
eeb3679b82 addition to r1159: fixed: menubar icon was not visible on OSX in dark mode 2014-11-18 18:26:24 +00:00
Andrey Prygunkov
d2d9bfb4bd system sleep on idle state is now prevented during download and post-processing (Mac OSX only) 2014-11-16 16:24:06 +00:00
Andrey Prygunkov
2dcbe4628b fixed: menubar icon was not visible on OSX in dark mode 2014-11-15 19:05:45 +00:00
Andrey Prygunkov
634247676a fixed: quick par-check could hang on certain nzb-files containing multiple par-sets (occured only in 64 bit mode) 2014-11-14 19:38:41 +00:00
Andrey Prygunkov
1a01b323e5 updated version string to 15.0-testing 2014-11-14 19:29:27 +00:00
21 changed files with 120 additions and 71 deletions

View File

@@ -1,3 +1,23 @@
nzbget-14.2:
- fixed: the program could crash during download when article cache was
active (more likely on very high download speeds);
- fixed: unlike to all other scripts the update-script should not be
automatically terminated when the program quits;
- fixed: XML-RPC method "history" returned invalid xml when used with
parameter "hidden=true" (JSON-RPC was fine).
nzbget-14.1:
- fixed: program could crash during unpack (Posix) or unpack failure
was reported (Windows);
- fixed: quick par-check could hang on certain nzb-files containing multiple
par-sets (occured only in 64 bit mode);
- fixed: menubar icon was not visible on OSX in dark mode;
- system sleep on idle state is now prevented during download and
post-processing (Mac OSX only);
- fixed: unrar may sometimes fail with message "no files to extract"
(certain Linux systems);
- fixed false memory leak warning when compiled in debug mode (Windows only);
nzbget-14.0:
- added article cache:
- new option "ArticleCache" defines memory limit to use for cache;

View File

@@ -219,8 +219,6 @@ osx_FILES = \
osx/Resources/Images/mainicon.icns \
osx/Resources/Images/statusicon.png \
osx/Resources/Images/statusicon@2x.png \
osx/Resources/Images/statusicon-inv.png \
osx/Resources/Images/statusicon-inv@2x.png \
osx/Resources/licenses/license-bootstrap.txt \
osx/Resources/licenses/license-jquery-GPL.txt \
osx/Resources/licenses/license-jquery-MIT.txt \

View File

@@ -489,8 +489,6 @@ osx_FILES = \
osx/Resources/Images/mainicon.icns \
osx/Resources/Images/statusicon.png \
osx/Resources/Images/statusicon@2x.png \
osx/Resources/Images/statusicon-inv.png \
osx/Resources/Images/statusicon-inv@2x.png \
osx/Resources/licenses/license-bootstrap.txt \
osx/Resources/licenses/license-jquery-GPL.txt \
osx/Resources/licenses/license-jquery-MIT.txt \

20
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for nzbget 14.0.
# Generated by GNU Autoconf 2.61 for nzbget 14.2.
#
# Report bugs to <hugbug@users.sourceforge.net>.
#
@@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='nzbget'
PACKAGE_TARNAME='nzbget'
PACKAGE_VERSION='14.0'
PACKAGE_STRING='nzbget 14.0'
PACKAGE_VERSION='14.2'
PACKAGE_STRING='nzbget 14.2'
PACKAGE_BUGREPORT='hugbug@users.sourceforge.net'
ac_unique_file="daemon/main/nzbget.cpp"
@@ -1233,7 +1233,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures nzbget 14.0 to adapt to many kinds of systems.
\`configure' configures nzbget 14.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1304,7 +1304,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of nzbget 14.0:";;
short | recursive ) echo "Configuration of nzbget 14.2:";;
esac
cat <<\_ACEOF
@@ -1435,7 +1435,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
nzbget configure 14.0
nzbget configure 14.2
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1449,7 +1449,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by nzbget $as_me 14.0, which was
It was created by nzbget $as_me 14.2, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2245,7 +2245,7 @@ fi
# Define the identity of the package.
PACKAGE=nzbget
VERSION=14.0
VERSION=14.2
cat >>confdefs.h <<_ACEOF
@@ -10756,7 +10756,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by nzbget $as_me 14.0, which was
This file was extended by nzbget $as_me 14.2, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -10809,7 +10809,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
nzbget config.status 14.0
nzbget config.status 14.2
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

View File

@@ -23,9 +23,9 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(nzbget, 14.0, hugbug@users.sourceforge.net)
AC_INIT(nzbget, 14.2, hugbug@users.sourceforge.net)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(nzbget, 14.0)
AM_INIT_AUTOMAKE(nzbget, 14.2)
AC_CONFIG_SRCDIR([daemon/main/nzbget.cpp])
AC_CONFIG_HEADERS([config.h])

View File

@@ -1,7 +1,7 @@
/*
* This file is part of nzbget
*
* Copyright (C) 2013-2014 Andrey Prygunkov <hugbug@users.sourceforge.net>
* Copyright (C) 2013-2015 Andrey Prygunkov <hugbug@users.sourceforge.net>
*
* 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
@@ -229,6 +229,9 @@ bool Maintenance::ReadPackageInfoStr(const char* szKey, char** pValue)
void UpdateScriptController::Run()
{
// the update-script should not be automatically terminated when the program quits
UnregisterRunningScript();
m_iPrefixLen = 0;
PrintMessage(Message::mkInfo, "Executing update-script %s", GetScript());

View File

@@ -130,7 +130,7 @@ int main(int argc, char *argv[], char *argp[])
#ifdef _DEBUG
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF
#ifdef DEBUG_CRTMEMLEAKS
| _CRTDBG_CHECK_CRT_DF | _CRTDBG_CHECK_ALWAYS_DF
#endif
@@ -167,12 +167,6 @@ int main(int argc, char *argv[], char *argp[])
RunMain();
#ifdef WIN32
#ifdef _DEBUG
_CrtDumpMemoryLeaks();
#endif
#endif
return 0;
}

View File

@@ -627,14 +627,7 @@ void ArticleWriter::CompleteFileParts()
void ArticleWriter::FlushCache()
{
char szInfoFilename[1024];
// the locking is needed for accessing the members of NZBInfo
DownloadQueue::Lock();
snprintf(szInfoFilename, 1024, "%s%c%s", m_pFileInfo->GetNZBInfo()->GetName(), (int)PATH_SEPARATOR, m_pFileInfo->GetFilename());
szInfoFilename[1024-1] = '\0';
DownloadQueue::Unlock();
detail("Flushing cache for %s", szInfoFilename);
detail("Flushing cache for %s", m_szInfoName);
bool bDirectWrite = g_pOptions->GetDirectWrite() && m_pFileInfo->GetOutputInitialized();
FILE* outfile = NULL;
@@ -736,7 +729,7 @@ void ArticleWriter::FlushCache()
g_pArticleCache->UnlockFlush();
detail("Saved %i articles (%.2f MB) from cache into disk for %s", iFlushedArticles, (float)(iFlushedSize / 1024.0 / 1024.0), szInfoFilename);
detail("Saved %i articles (%.2f MB) from cache into disk for %s", iFlushedArticles, (float)(iFlushedSize / 1024.0 / 1024.0), m_szInfoName);
}
bool ArticleWriter::MoveCompletedFiles(NZBInfo* pNZBInfo, const char* szOldDestDir)
@@ -969,6 +962,8 @@ bool ArticleCache::CheckFlush(bool bFlushEverything)
{
debug("Checking cache, Allocated: %i, FlushEverything: %i", m_iAllocated, (int)bFlushEverything);
char szInfoName[1024];
DownloadQueue* pDownloadQueue = DownloadQueue::Lock();
for (NZBList::iterator it = pDownloadQueue->GetQueue()->begin(); it != pDownloadQueue->GetQueue()->end() && !m_pFileInfo; it++)
{
@@ -979,6 +974,8 @@ bool ArticleCache::CheckFlush(bool bFlushEverything)
if (pFileInfo->GetCachedArticles() > 0 && (pFileInfo->GetActiveDownloads() == 0 || bFlushEverything))
{
m_pFileInfo = pFileInfo;
snprintf(szInfoName, 1024, "%s%c%s", m_pFileInfo->GetNZBInfo()->GetName(), (int)PATH_SEPARATOR, m_pFileInfo->GetFilename());
szInfoName[1024-1] = '\0';
break;
}
}
@@ -989,6 +986,7 @@ bool ArticleCache::CheckFlush(bool bFlushEverything)
{
ArticleWriter* pArticleWriter = new ArticleWriter();
pArticleWriter->SetFileInfo(m_pFileInfo);
pArticleWriter->SetInfoName(szInfoName);
pArticleWriter->FlushCache();
delete pArticleWriter;
m_pFileInfo = NULL;

View File

@@ -1396,7 +1396,9 @@ bool ParChecker::VerifySuccessDataFile(void* pDiskfile, void* pSourcefile, unsig
// extend lDownloadCrc to block size
lDownloadCrc = CRCUpdateBlock(lDownloadCrc ^ 0xFFFFFFFF,
(size_t)(blocksize * packet->BlockCount() - pSourceFile->GetTargetFile()->FileSize())) ^ 0xFFFFFFFF;
(size_t)(blocksize * packet->BlockCount() > pSourceFile->GetTargetFile()->FileSize() ?
blocksize * packet->BlockCount() - pSourceFile->GetTargetFile()->FileSize() : 0)
) ^ 0xFFFFFFFF;
debug("Download-CRC: %.8x", lDownloadCrc);
// compute file CRC using CRCs of blocks

View File

@@ -100,7 +100,7 @@ void UnpackController::Run()
m_szPassword[0] = '\0';
m_szFinalDir[0] = '\0';
m_bFinalDirCreated = false;
NZBParameter* pParameter = m_pPostInfo->GetNZBInfo()->GetParameters()->Find("*Unpack:", false);
bool bUnpack = !(pParameter && !strcasecmp(pParameter->GetValue(), "no"));
@@ -136,10 +136,6 @@ void UnpackController::Run()
if (bUnpack && bHasFiles)
{
PrintMessage(Message::mkInfo, "Unpacking %s", m_szName);
CreateUnpackDir();
m_bUnpackOK = true;
m_bUnpackStartError = false;
m_bUnpackSpaceError = false;
@@ -147,6 +143,10 @@ void UnpackController::Run()
m_bUnpackPasswordError5 = false;
m_bAutoTerminated = false;
PrintMessage(Message::mkInfo, "Unpacking %s", m_szName);
CreateUnpackDir();
if (m_bHasRarFiles || m_bHasNonStdRarFiles)
{
ExecuteUnrar();
@@ -209,11 +209,17 @@ void UnpackController::ExecuteUnrar()
if (strlen(m_szPassword) > 0)
{
snprintf(szPasswordParam, 1024, "-p%s", m_szPassword);
szPasswordParam[1024-1] = '\0';
szArgs[3] = szPasswordParam;
}
szArgs[4] = "-o+";
szArgs[5] = m_bHasNonStdRarFiles ? "*.*" : "*.rar";
szArgs[6] = m_szUnpackDir;
char szUnpackDirParam[1024];
snprintf(szUnpackDirParam, 1024, "%s%c", m_szUnpackDir, PATH_SEPARATOR);
szUnpackDirParam[1024-1] = '\0';
szArgs[6] = szUnpackDirParam;
szArgs[7] = NULL;
SetArgs(szArgs, false);
@@ -256,11 +262,13 @@ void UnpackController::ExecuteSevenZip(bool bMultiVolumes)
if (strlen(m_szPassword) > 0)
{
snprintf(szPasswordParam, 1024, "-p%s", m_szPassword);
szPasswordParam[1024-1] = '\0';
szArgs[3] = szPasswordParam;
}
char szUnpackDirParam[1024];
snprintf(szUnpackDirParam, 1024, "-o%s", m_szUnpackDir);
szUnpackDirParam[1024-1] = '\0';
szArgs[4] = szUnpackDirParam;
szArgs[5] = bMultiVolumes ? "*.7z.001" : "*.7z";

View File

@@ -782,6 +782,11 @@ void QueueCoordinator::StatFileInfo(FileInfo* pFileInfo, bool bCompleted)
void QueueCoordinator::DeleteFileInfo(DownloadQueue* pDownloadQueue, FileInfo* pFileInfo, bool bCompleted)
{
while (g_pArticleCache->FileBusy(pFileInfo))
{
usleep(5*1000);
}
bool fileDeleted = pFileInfo->GetDeleted();
pFileInfo->SetDeleted(true);
@@ -985,11 +990,6 @@ bool QueueCoordinator::DeleteQueueEntry(DownloadQueue* pDownloadQueue, FileInfo*
}
}
while (g_pArticleCache->FileBusy(pFileInfo))
{
usleep(20*1000);
}
if (!bDownloading)
{
DeleteFileInfo(pDownloadQueue, pFileInfo, false);

View File

@@ -2539,8 +2539,7 @@ void HistoryXmlCommand::Execute()
"<member><name>DupeScore</name><value><i4>%i</i4></value></member>\n"
"<member><name>DupeMode</name><value><string>%s</string></value></member>\n"
"<member><name>DupStatus</name><value><string>%s</string></value></member>\n"
"<member><name>Status</name><value><string>%s</string></value></member>\n"
"</struct></value>\n";
"<member><name>Status</name><value><string>%s</string></value></member>\n";
const char* JSON_HISTORY_DUP_ITEM =
"{\n"

View File

@@ -220,6 +220,11 @@ ScriptController::~ScriptController()
free(m_szArgs);
}
UnregisterRunningScript();
}
void ScriptController::UnregisterRunningScript()
{
m_mutexRunning.Lock();
m_RunningScripts.erase(std::find(m_RunningScripts.begin(), m_RunningScripts.end(), this));
m_mutexRunning.Unlock();
@@ -639,7 +644,7 @@ void ScriptController::Terminate()
// if the child process has its own group (setsid() was successful), kill the whole group
hKillProcess = -hKillProcess;
}
bool bOK = kill(hKillProcess, SIGKILL) == 0;
bool bOK = hKillProcess && kill(hKillProcess, SIGKILL) == 0;
#endif
if (bOK)

View File

@@ -85,6 +85,7 @@ protected:
void ResetEnv();
void PrepareEnvOptions(const char* szStripPrefix);
void PrepareArgs();
void UnregisterRunningScript();
public:
ScriptController();

View File

@@ -71,7 +71,7 @@
/* Define to 1 if spinlocks are supported */
#define HAVE_SPINLOCK
#define VERSION "14.0"
#define VERSION "14.2"
/* Suppress warnings */
#define _CRT_SECURE_NO_DEPRECATE

View File

@@ -1,7 +1,7 @@
/*
* This file is part of nzbget
*
* Copyright (C) 2007-2013 Andrey Prygunkov <hugbug@users.sourceforge.net>
* Copyright (C) 2007-2014 Andrey Prygunkov <hugbug@users.sourceforge.net>
*
* 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
@@ -23,6 +23,7 @@
*/
#import <Cocoa/Cocoa.h>
#import <IOKit/pwr_mgt/IOPMLib.h>
#import "DaemonController.h"
@interface MainApp : NSObject <NSMenuDelegate, DaemonControllerDelegate> {
@@ -49,6 +50,8 @@
int connectionAttempts;
BOOL restarting;
BOOL resetting;
BOOL preventingSleep;
IOPMAssertionID sleepID;
NSTimer* restartTimer;
NSMutableArray* categoryItems;
NSMutableArray* categoryDirs;
@@ -78,4 +81,6 @@
- (IBAction)showInFinderClicked:(id)sender;
- (void)updateSleepState:(BOOL)preventSleep;
@end

View File

@@ -1,7 +1,7 @@
/*
* This file is part of nzbget
*
* Copyright (C) 2007-2013 Andrey Prygunkov <hugbug@users.sourceforge.net>
* Copyright (C) 2007-2014 Andrey Prygunkov <hugbug@users.sourceforge.net>
*
* 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
@@ -149,8 +149,9 @@ void InstallSignalHandlers()
statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength];
[statusItem setHighlightMode:YES];
[statusItem setMenu:statusMenu];
[statusItem setImage:[NSImage imageNamed:@"statusicon.png"]];
[statusItem setAlternateImage:[NSImage imageNamed:@"statusicon-inv.png"]];
NSImage* icon = [NSImage imageNamed:@"statusicon.png"];
[icon setTemplate:YES];
[statusItem setImage:icon];
}
else {
statusItem = nil;
@@ -451,7 +452,8 @@ void InstallSignalHandlers()
NSString* info1 = @"";
NSString* info2 = nil;
BOOL preventSleep = NO;
NSDictionary* status = [daemonController status];
if (restarting || daemonController.restarting) {
info1 = NSLocalizedString(@"Status.Restarting", nil);
@@ -460,6 +462,7 @@ void InstallSignalHandlers()
} else if ([(NSNumber*)[status objectForKey:@"ServerStandBy"] integerValue] == 1) {
if ([(NSNumber*)[status objectForKey:@"PostJobCount"] integerValue] > 0) {
info1 = NSLocalizedString(@"Status.Post-Processing", nil);
preventSleep = YES;
}
else if ([(NSNumber*)[status objectForKey:@"UrlCount"] integerValue] > 0) {
info1 = NSLocalizedString(@"Status.Fetching NZBs", nil);
@@ -476,14 +479,19 @@ void InstallSignalHandlers()
} else {
int speed = [(NSNumber*)[status objectForKey:@"DownloadRate"] integerValue];
info1 = [NSString stringWithFormat:NSLocalizedString(@"Status.Downloading", nil), speed / 1024];
if (speed > 0) {
long long remaining = ([(NSNumber*)[status objectForKey:@"RemainingSizeHi"] integerValue] << 32) + [(NSNumber*)[status objectForKey:@"RemainingSizeLo"] integerValue];
int secondsLeft = remaining / speed;
info2 = [NSString stringWithFormat:NSLocalizedString(@"Status.Left", nil), [self formatTimeLeft:secondsLeft]];
}
preventSleep = YES;
if (speed > 0) {
long long remaining = ([(NSNumber*)[status objectForKey:@"RemainingSizeHi"] integerValue] << 32) + [(NSNumber*)[status objectForKey:@"RemainingSizeLo"] integerValue];
int secondsLeft = remaining / speed;
info2 = [NSString stringWithFormat:NSLocalizedString(@"Status.Left", nil), [self formatTimeLeft:secondsLeft]];
}
}
if (preventSleep != preventingSleep) {
[self updateSleepState:preventSleep];
}
[info1Item setTitle:info1];
[info2Item setHidden:info2 == nil];
@@ -492,6 +500,19 @@ void InstallSignalHandlers()
}
}
- (void)updateSleepState:(BOOL)preventSleep {
if (preventSleep) {
sleepID = 0;
NSString* reason = NSLocalizedString(@"Status.PreventSleep", nil);
IOPMAssertionCreateWithName(kIOPMAssertionTypePreventUserIdleSystemSleep,
kIOPMAssertionLevelOn, (__bridge CFStringRef)reason, &sleepID);
}
else if (sleepID != 0) {
IOPMAssertionRelease(sleepID);
}
preventingSleep = preventSleep;
}
- (NSString*)formatTimeLeft:(int)sec {
int days = floor(sec / 86400);
int hours = floor((sec % 86400) / 3600);

View File

@@ -22,16 +22,15 @@
F29ABB2C17C00E190023A423 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29B97325FDCFA39411CA2CEA /* Foundation.framework */; };
F2A55D3717C4CA9000D6FFE1 /* daemon in Resources */ = {isa = PBXBuildFile; fileRef = F2A55D3617C4CA9000D6FFE1 /* daemon */; };
F2A55D3B17C4CAF800D6FFE1 /* tools in Resources */ = {isa = PBXBuildFile; fileRef = F2A55D3A17C4CAF800D6FFE1 /* tools */; };
F2A6E11017C8E42300D910CB /* statusicon-inv@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F2A6E10E17C8E42300D910CB /* statusicon-inv@2x.png */; };
F2A6E11117C8E42300D910CB /* statusicon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F2A6E10F17C8E42300D910CB /* statusicon@2x.png */; };
F2BBD9C613E083160037473A /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = F2FC0F8B13BF595700D834E3 /* Credits.rtf */; };
F2C040481A18E946003EAB32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F2C040471A18E946003EAB32 /* IOKit.framework */; };
F2CD856817C282080019D2CA /* RPC.m in Sources */ = {isa = PBXBuildFile; fileRef = F2CD856517C254A90019D2CA /* RPC.m */; };
F2CD856B17C282820019D2CA /* WebClient.m in Sources */ = {isa = PBXBuildFile; fileRef = F2CD856A17C282800019D2CA /* WebClient.m */; };
F2D2A2F113CBA680000824B4 /* WelcomeDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = F2D2A2EF13CBA680000824B4 /* WelcomeDialog.m */; };
F2F9804A17C9081D004623D6 /* licenses in Resources */ = {isa = PBXBuildFile; fileRef = F2F9804917C9081D004623D6 /* licenses */; };
F2FCD73B13BB9CE900FC81F5 /* mainicon.icns in Resources */ = {isa = PBXBuildFile; fileRef = F2FCD73A13BB9CE900FC81F5 /* mainicon.icns */; };
F2FCD7D913BBDAED00FC81F5 /* statusicon.png in Resources */ = {isa = PBXBuildFile; fileRef = F2FCD7D813BBDAED00FC81F5 /* statusicon.png */; };
F2FCD84D13BCFD0900FC81F5 /* statusicon-inv.png in Resources */ = {isa = PBXBuildFile; fileRef = F2FCD84C13BCFD0900FC81F5 /* statusicon-inv.png */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -57,8 +56,8 @@
F29ABB2417BFC03D0023A423 /* DaemonController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DaemonController.m; sourceTree = "<group>"; };
F2A55D3617C4CA9000D6FFE1 /* daemon */ = {isa = PBXFileReference; lastKnownFileType = folder; name = daemon; path = Resources/daemon; sourceTree = "<group>"; };
F2A55D3A17C4CAF800D6FFE1 /* tools */ = {isa = PBXFileReference; lastKnownFileType = folder; name = tools; path = Resources/tools; sourceTree = "<group>"; };
F2A6E10E17C8E42300D910CB /* statusicon-inv@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "statusicon-inv@2x.png"; path = "Images/statusicon-inv@2x.png"; sourceTree = "<group>"; };
F2A6E10F17C8E42300D910CB /* statusicon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "statusicon@2x.png"; path = "Images/statusicon@2x.png"; sourceTree = "<group>"; };
F2C040471A18E946003EAB32 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/IOKit.framework; sourceTree = DEVELOPER_DIR; };
F2CD856417C254A90019D2CA /* RPC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RPC.h; sourceTree = "<group>"; };
F2CD856517C254A90019D2CA /* RPC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RPC.m; sourceTree = "<group>"; };
F2CD856917C282800019D2CA /* WebClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebClient.h; sourceTree = "<group>"; };
@@ -69,7 +68,6 @@
F2FC0F8B13BF595700D834E3 /* Credits.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = Credits.rtf; path = Resources/Credits.rtf; sourceTree = "<group>"; };
F2FCD73A13BB9CE900FC81F5 /* mainicon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = mainicon.icns; path = Images/mainicon.icns; sourceTree = "<group>"; };
F2FCD7D813BBDAED00FC81F5 /* statusicon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = statusicon.png; path = Images/statusicon.png; sourceTree = "<group>"; };
F2FCD84C13BCFD0900FC81F5 /* statusicon-inv.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "statusicon-inv.png"; path = "Images/statusicon-inv.png"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -77,6 +75,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
F2C040481A18E946003EAB32 /* IOKit.framework in Frameworks */,
F20FC6E417C6BC8D00C392AC /* Security.framework in Frameworks */,
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
F29ABB2B17C00E150023A423 /* AppKit.framework in Frameworks */,
@@ -108,7 +107,7 @@
29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
name = "NZBGet";
name = NZBGet;
sourceTree = "<group>";
};
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
@@ -137,6 +136,7 @@
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
F2C040471A18E946003EAB32 /* IOKit.framework */,
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
29B97325FDCFA39411CA2CEA /* Foundation.framework */,
@@ -201,9 +201,7 @@
isa = PBXGroup;
children = (
F2FCD73A13BB9CE900FC81F5 /* mainicon.icns */,
F2A6E10E17C8E42300D910CB /* statusicon-inv@2x.png */,
F2A6E10F17C8E42300D910CB /* statusicon@2x.png */,
F2FCD84C13BCFD0900FC81F5 /* statusicon-inv.png */,
F2FCD7D813BBDAED00FC81F5 /* statusicon.png */,
);
name = Images;
@@ -227,7 +225,7 @@
);
name = NZBGet;
productInstallPath = "$(HOME)/Applications";
productName = "NZBGet";
productName = NZBGet;
productReference = 8D1107320486CEB800E47090 /* NZBGet.app */;
productType = "com.apple.product-type.application";
};
@@ -269,7 +267,6 @@
files = (
F2FCD73B13BB9CE900FC81F5 /* mainicon.icns in Resources */,
F2FCD7D913BBDAED00FC81F5 /* statusicon.png in Resources */,
F2FCD84D13BCFD0900FC81F5 /* statusicon-inv.png in Resources */,
F2BBD9C613E083160037473A /* Credits.rtf in Resources */,
F26D959317C0E81800E58E5D /* Welcome.rtf in Resources */,
F26D959517C0E86300E58E5D /* MainApp.xib in Resources */,
@@ -278,7 +275,6 @@
F26D959B17C0E89D00E58E5D /* Localizable.strings in Resources */,
F2A55D3717C4CA9000D6FFE1 /* daemon in Resources */,
F2A55D3B17C4CAF800D6FFE1 /* tools in Resources */,
F2A6E11017C8E42300D910CB /* statusicon-inv@2x.png in Resources */,
F2A6E11117C8E42300D910CB /* statusicon@2x.png in Resources */,
F2F9804A17C9081D004623D6 /* licenses in Resources */,
);

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

View File

@@ -31,6 +31,7 @@
"Status.Left"="%@ left";
"Status.NoConnection"="Downloader Not Responding";
"Status.Restarting"="Restarting";
"Status.PreventSleep"="NZBGet is downloading or post-processing";
"Left.Days"="%i days";
"Left.Days.Hours"="%id %ih";