mirror of
https://github.com/nzbget/nzbget.git
synced 2026-01-02 19:17:46 -05:00
Compare commits
43 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e9afb8781 | ||
|
|
f1b6492d1c | ||
|
|
19d297f934 | ||
|
|
a23128f25f | ||
|
|
567f7c3028 | ||
|
|
30af4cfc3d | ||
|
|
019fcf519a | ||
|
|
1645562d78 | ||
|
|
fab726482c | ||
|
|
351cb9835f | ||
|
|
d0d59469bc | ||
|
|
577d934ccd | ||
|
|
4438131d56 | ||
|
|
7b13c9a9ba | ||
|
|
7d60566f3c | ||
|
|
e9a7c2f184 | ||
|
|
3e07873575 | ||
|
|
2f17584ab4 | ||
|
|
02f87b23fb | ||
|
|
31032e29f5 | ||
|
|
11bfb57809 | ||
|
|
0e83ef32bb | ||
|
|
86ae9e94cd | ||
|
|
2388250dfa | ||
|
|
d947ea65a2 | ||
|
|
4a11c04742 | ||
|
|
14b24e6050 | ||
|
|
4402d6fbd6 | ||
|
|
c69b81404c | ||
|
|
241a3efacf | ||
|
|
185d52a9d4 | ||
|
|
6b933f18dd | ||
|
|
31dbbb546c | ||
|
|
ac4f8a30e5 | ||
|
|
a060531ae3 | ||
|
|
fb77937acd | ||
|
|
9d9a81710f | ||
|
|
c3b4438d1f | ||
|
|
eeb3679b82 | ||
|
|
d2d9bfb4bd | ||
|
|
2dcbe4628b | ||
|
|
634247676a | ||
|
|
1a01b323e5 |
20
ChangeLog
20
ChangeLog
@@ -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;
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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
20
configure
vendored
@@ -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'`\\"
|
||||
|
||||
|
||||
@@ -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])
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -85,6 +85,7 @@ protected:
|
||||
void ResetEnv();
|
||||
void PrepareEnvOptions(const char* szStripPrefix);
|
||||
void PrepareArgs();
|
||||
void UnregisterRunningScript();
|
||||
|
||||
public:
|
||||
ScriptController();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 */,
|
||||
);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 480 B |
Binary file not shown.
|
Before Width: | Height: | Size: 820 B |
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user