mirror of
https://github.com/nzbget/nzbget.git
synced 2025-12-24 14:47:45 -05:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e9afb8781 |
22
ChangeLog
22
ChangeLog
@@ -1,6 +1,22 @@
|
||||
nzbget-15.0:
|
||||
- please see subversion log at
|
||||
http://sourceforge.net/p/nzbget/code/HEAD/log/?path=/trunk
|
||||
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:
|
||||
|
||||
13
Makefile.am
13
Makefile.am
@@ -191,20 +191,9 @@ windows_FILES = \
|
||||
daemon/windows/NTService.cpp \
|
||||
daemon/windows/NTService.h \
|
||||
daemon/windows/win32.h \
|
||||
daemon/windows/WinConsole.cpp \
|
||||
daemon/windows/WinConsole.h \
|
||||
nzbget.sln \
|
||||
nzbget.vcproj \
|
||||
nzbget-shell.bat \
|
||||
windows/resources/mainicon.ico \
|
||||
windows/resources/nzbget.rc \
|
||||
windows/resources/resource.h \
|
||||
windows/resources/trayicon_idle.ico \
|
||||
windows/resources/trayicon_paused.ico \
|
||||
windows/resources/trayicon_working.ico \
|
||||
windows/setup/nzbget-setup.nsi \
|
||||
windows/setup/install.bmp \
|
||||
windows/setup/uninstall.bmp
|
||||
nzbget-shell.bat
|
||||
|
||||
osx_FILES = \
|
||||
osx/App_Prefix.pch \
|
||||
|
||||
15
Makefile.in
15
Makefile.in
@@ -461,20 +461,9 @@ windows_FILES = \
|
||||
daemon/windows/NTService.cpp \
|
||||
daemon/windows/NTService.h \
|
||||
daemon/windows/win32.h \
|
||||
daemon/windows/WinConsole.cpp \
|
||||
daemon/windows/WinConsole.h \
|
||||
nzbget.sln \
|
||||
nzbget.vcproj \
|
||||
nzbget-shell.bat \
|
||||
windows/resources/mainicon.ico \
|
||||
windows/resources/nzbget.rc \
|
||||
windows/resources/resource.h \
|
||||
windows/resources/trayicon_idle.ico \
|
||||
windows/resources/trayicon_paused.ico \
|
||||
windows/resources/trayicon_working.ico \
|
||||
windows/setup/nzbget-setup.nsi \
|
||||
windows/setup/install.bmp \
|
||||
windows/setup/uninstall.bmp
|
||||
nzbget-shell.bat
|
||||
|
||||
osx_FILES = \
|
||||
osx/App_Prefix.pch \
|
||||
@@ -1857,7 +1846,7 @@ distclean-tags:
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
mkdir $(distdir)
|
||||
$(mkdir_p) $(distdir)/daemon/windows $(distdir)/lib/par2 $(distdir)/osx $(distdir)/osx/NZBGet.xcodeproj $(distdir)/osx/Resources $(distdir)/osx/Resources/Images $(distdir)/osx/Resources/licenses $(distdir)/scripts $(distdir)/webui $(distdir)/webui/img $(distdir)/webui/lib $(distdir)/windows/resources $(distdir)/windows/setup
|
||||
$(mkdir_p) $(distdir)/daemon/windows $(distdir)/lib/par2 $(distdir)/osx $(distdir)/osx/NZBGet.xcodeproj $(distdir)/osx/Resources $(distdir)/osx/Resources/Images $(distdir)/osx/Resources/licenses $(distdir)/scripts $(distdir)/webui $(distdir)/webui/img $(distdir)/webui/lib
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
|
||||
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 15.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='15.0'
|
||||
PACKAGE_STRING='nzbget 15.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 15.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 15.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 15.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 15.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=15.0-testing
|
||||
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 15.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 15.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, 15.0, hugbug@users.sourceforge.net)
|
||||
AC_INIT(nzbget, 14.2, hugbug@users.sourceforge.net)
|
||||
AC_CANONICAL_SYSTEM
|
||||
AM_INIT_AUTOMAKE(nzbget, 15.0-testing)
|
||||
AM_INIT_AUTOMAKE(nzbget, 14.2)
|
||||
AC_CONFIG_SRCDIR([daemon/main/nzbget.cpp])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -49,7 +49,6 @@
|
||||
#include <sys/time.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include "nzbget.h"
|
||||
@@ -555,7 +554,8 @@ bool Connection::DoConnect()
|
||||
m_iSocket = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
|
||||
if (m_iSocket != INVALID_SOCKET)
|
||||
{
|
||||
if (ConnectWithTimeout(addr->ai_addr, addr->ai_addrlen))
|
||||
res = connect(m_iSocket , addr->ai_addr, addr->ai_addrlen);
|
||||
if (res != -1)
|
||||
{
|
||||
// Connection established
|
||||
break;
|
||||
@@ -600,7 +600,8 @@ bool Connection::DoConnect()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ConnectWithTimeout(&sSocketAddress, sizeof(sSocketAddress)))
|
||||
int res = connect(m_iSocket , (struct sockaddr *) & sSocketAddress, sizeof(sSocketAddress));
|
||||
if (res == -1)
|
||||
{
|
||||
ReportError("Connection to %s failed", m_szHost, true, 0);
|
||||
closesocket(m_iSocket);
|
||||
@@ -609,153 +610,22 @@ bool Connection::DoConnect()
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!InitSocketOpts())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_TLS
|
||||
if (m_bTLS && !StartTLS(true, NULL, NULL))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Connection::InitSocketOpts()
|
||||
{
|
||||
char* optbuf = NULL;
|
||||
int optsize = 0;
|
||||
#ifdef WIN32
|
||||
int MSecVal = m_iTimeout * 1000;
|
||||
optbuf = (char*)&MSecVal;
|
||||
optsize = sizeof(MSecVal);
|
||||
int err = setsockopt(m_iSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&MSecVal, sizeof(MSecVal));
|
||||
#else
|
||||
struct timeval TimeVal;
|
||||
TimeVal.tv_sec = m_iTimeout;
|
||||
TimeVal.tv_usec = 0;
|
||||
optbuf = (char*)&TimeVal;
|
||||
optsize = sizeof(TimeVal);
|
||||
int err = setsockopt(m_iSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&TimeVal, sizeof(TimeVal));
|
||||
#endif
|
||||
int err = setsockopt(m_iSocket, SOL_SOCKET, SO_RCVTIMEO, optbuf, optsize);
|
||||
if (err != 0)
|
||||
{
|
||||
ReportError("Socket initialization failed for %s", m_szHost, true, 0);
|
||||
return false;
|
||||
}
|
||||
err = setsockopt(m_iSocket, SOL_SOCKET, SO_SNDTIMEO, optbuf, optsize);
|
||||
if (err != 0)
|
||||
{
|
||||
ReportError("Socket initialization failed for %s", m_szHost, true, 0);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Connection::ConnectWithTimeout(void* address, int address_len)
|
||||
{
|
||||
int flags = 0, error = 0, ret = 0;
|
||||
fd_set rset, wset;
|
||||
socklen_t len = sizeof(error);
|
||||
|
||||
struct timeval ts;
|
||||
ts.tv_sec = m_iTimeout;
|
||||
ts.tv_usec = 0;
|
||||
|
||||
//clear out descriptor sets for select
|
||||
//add socket to the descriptor sets
|
||||
FD_ZERO(&rset);
|
||||
FD_SET(m_iSocket, &rset);
|
||||
wset = rset; //structure assignment ok
|
||||
|
||||
//set socket nonblocking flag
|
||||
#ifdef WIN32
|
||||
u_long mode = 1;
|
||||
if (ioctlsocket(m_iSocket, FIONBIO, &mode) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
flags = fcntl(m_iSocket, F_GETFL, 0);
|
||||
if (flags < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fcntl(m_iSocket, F_SETFL, flags | O_NONBLOCK) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
//initiate non-blocking connect
|
||||
ret = connect(m_iSocket, (struct sockaddr*)address, address_len);
|
||||
if (ret < 0)
|
||||
{
|
||||
#ifdef WIN32
|
||||
int err = WSAGetLastError();
|
||||
if (err != WSAEWOULDBLOCK)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if (errno != EINPROGRESS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//connect succeeded right away?
|
||||
if (ret != 0)
|
||||
{
|
||||
ret = select(m_iSocket + 1, &rset, &wset, NULL, m_iTimeout ? &ts : NULL);
|
||||
//we are waiting for connect to complete now
|
||||
if (ret < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (ret == 0)
|
||||
{
|
||||
//we had a timeout
|
||||
#ifdef WIN32
|
||||
WSASetLastError(WSAETIMEDOUT);
|
||||
#else
|
||||
errno = ETIMEDOUT;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(FD_ISSET(m_iSocket, &rset) || FD_ISSET(m_iSocket, &wset)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//we had a positivite return so a descriptor is ready
|
||||
|
||||
if (getsockopt(m_iSocket, SOL_SOCKET, SO_ERROR, (char*)&error, &len) < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//check if we had a socket error
|
||||
if (error)
|
||||
{
|
||||
errno = error;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//put socket back in blocking mode
|
||||
#ifdef WIN32
|
||||
mode = 0;
|
||||
if (ioctlsocket(m_iSocket, FIONBIO, &mode) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if (fcntl(m_iSocket, F_SETFL, flags) < 0)
|
||||
#ifndef DISABLE_TLS
|
||||
if (m_bTLS && !StartTLS(true, NULL, NULL))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -75,8 +75,6 @@ protected:
|
||||
void ReportError(const char* szMsgPrefix, const char* szMsgArg, bool PrintErrCode, int herrno);
|
||||
bool DoConnect();
|
||||
bool DoDisconnect();
|
||||
bool InitSocketOpts();
|
||||
bool ConnectWithTimeout(void* address, int address_len);
|
||||
#ifndef HAVE_GETADDRINFO
|
||||
unsigned int ResolveHostAddr(const char* szHost);
|
||||
#endif
|
||||
|
||||
@@ -521,7 +521,7 @@ bool FeedFilter::Term::ParseNumericParam(const char* szParam)
|
||||
m_bFloat = strchr(szParam, '.');
|
||||
|
||||
const char* p;
|
||||
for (p = szParam; *p && ((*p >= '0' && *p <='9') || *p == '.' || *p == '-') ; p++) ;
|
||||
for (p = szParam; *p && ((*p >= '0' && *p <='9') || *p == '.') ; p++) ;
|
||||
if (*p)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -40,7 +40,6 @@
|
||||
#include <set>
|
||||
#ifdef WIN32
|
||||
#include <direct.h>
|
||||
#include <Shlobj.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
@@ -61,10 +60,6 @@ extern ServerPool* g_pServerPool;
|
||||
extern Scheduler* g_pScheduler;
|
||||
extern FeedCoordinator* g_pFeedCoordinator;
|
||||
|
||||
#ifdef WIN32
|
||||
extern void SetupFirstStart();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
static struct option long_options[] =
|
||||
{
|
||||
@@ -181,7 +176,6 @@ static const char* OPTION_UNPACK = "Unpack";
|
||||
static const char* OPTION_UNPACKCLEANUPDISK = "UnpackCleanupDisk";
|
||||
static const char* OPTION_UNRARCMD = "UnrarCmd";
|
||||
static const char* OPTION_SEVENZIPCMD = "SevenZipCmd";
|
||||
static const char* OPTION_UNPACKPASSFILE = "UnpackPassFile";
|
||||
static const char* OPTION_UNPACKPAUSEQUEUE = "UnpackPauseQueue";
|
||||
static const char* OPTION_SCRIPTORDER = "ScriptOrder";
|
||||
static const char* OPTION_POSTSCRIPT = "PostScript";
|
||||
@@ -501,9 +495,6 @@ Options::Options(int argc, char* argv[])
|
||||
m_bRemoteClientMode = false;
|
||||
m_bPrintOptions = false;
|
||||
m_bAddTop = false;
|
||||
m_szAddDupeKey = NULL;
|
||||
m_iAddDupeScore = 0;
|
||||
m_iAddDupeMode = 0;
|
||||
m_bAppendCategoryDir = false;
|
||||
m_bContinuePartial = false;
|
||||
m_bSaveQueue = false;
|
||||
@@ -571,7 +562,6 @@ Options::Options(int argc, char* argv[])
|
||||
m_bUnpackCleanupDisk = false;
|
||||
m_szUnrarCmd = NULL;
|
||||
m_szSevenZipCmd = NULL;
|
||||
m_szUnpackPassFile = NULL;
|
||||
m_bUnpackPauseQueue = false;
|
||||
m_szExtCleanupDisk = NULL;
|
||||
m_szParIgnoreExt = NULL;
|
||||
@@ -692,10 +682,8 @@ Options::~Options()
|
||||
free(m_szQueueScript);
|
||||
free(m_pEditQueueIDList);
|
||||
free(m_szAddNZBFilename);
|
||||
free(m_szAddDupeKey);
|
||||
free(m_szUnrarCmd);
|
||||
free(m_szSevenZipCmd);
|
||||
free(m_szUnpackPassFile);
|
||||
free(m_szExtCleanupDisk);
|
||||
free(m_szParIgnoreExt);
|
||||
|
||||
@@ -849,7 +837,6 @@ void Options::InitDefault()
|
||||
SetOption(OPTION_UNRARCMD, "unrar");
|
||||
SetOption(OPTION_SEVENZIPCMD, "7z");
|
||||
#endif
|
||||
SetOption(OPTION_UNPACKPASSFILE, "");
|
||||
SetOption(OPTION_UNPACKPAUSEQUEUE, "no");
|
||||
SetOption(OPTION_EXTCLEANUPDISK, "");
|
||||
SetOption(OPTION_PARIGNOREEXT, "");
|
||||
@@ -872,7 +859,7 @@ void Options::InitOptFile()
|
||||
{
|
||||
// search for config file in default locations
|
||||
#ifdef WIN32
|
||||
char szFilename[MAX_PATH + 20];
|
||||
char szFilename[MAX_PATH + 1];
|
||||
GetModuleFileName(NULL, szFilename, MAX_PATH + 1);
|
||||
szFilename[MAX_PATH] = '\0';
|
||||
Util::NormalizePathSeparators(szFilename);
|
||||
@@ -880,19 +867,6 @@ void Options::InitOptFile()
|
||||
if (end) end[1] = '\0';
|
||||
strcat(szFilename, "nzbget.conf");
|
||||
|
||||
if (!Util::FileExists(szFilename))
|
||||
{
|
||||
char szAppDataPath[MAX_PATH];
|
||||
SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, szAppDataPath);
|
||||
snprintf(szFilename, sizeof(szFilename), "%s\\NZBGet\\nzbget.conf", szAppDataPath);
|
||||
szFilename[sizeof(szFilename)-1] = '\0';
|
||||
|
||||
if (!Util::FileExists(szFilename))
|
||||
{
|
||||
SetupFirstStart();
|
||||
}
|
||||
}
|
||||
|
||||
if (Util::FileExists(szFilename))
|
||||
{
|
||||
m_szConfigFilename = strdup(szFilename);
|
||||
@@ -1034,7 +1008,6 @@ void Options::InitOptions()
|
||||
m_szLogFile = strdup(GetOption(OPTION_LOGFILE));
|
||||
m_szUnrarCmd = strdup(GetOption(OPTION_UNRARCMD));
|
||||
m_szSevenZipCmd = strdup(GetOption(OPTION_SEVENZIPCMD));
|
||||
m_szUnpackPassFile = strdup(GetOption(OPTION_UNPACKPASSFILE));
|
||||
m_szExtCleanupDisk = strdup(GetOption(OPTION_EXTCLEANUPDISK));
|
||||
m_szParIgnoreExt = strdup(GetOption(OPTION_PARIGNOREEXT));
|
||||
|
||||
@@ -1277,15 +1250,19 @@ void Options::InitCommandLine(int argc, char* argv[])
|
||||
m_bDaemonMode = true;
|
||||
break;
|
||||
case 'A':
|
||||
m_eClientOperation = opClientRequestDownload;
|
||||
m_eClientOperation = opClientRequestDownload; // default
|
||||
|
||||
while (true)
|
||||
{
|
||||
optind++;
|
||||
optarg = optind > argc ? NULL : argv[optind-1];
|
||||
if (optarg && (!strcasecmp(optarg, "F") || !strcasecmp(optarg, "U")))
|
||||
if (optarg && !strcasecmp(optarg, "F"))
|
||||
{
|
||||
// option ignored (but kept for compatibility)
|
||||
m_eClientOperation = opClientRequestDownload;
|
||||
}
|
||||
else if (optarg && !strcasecmp(optarg, "U"))
|
||||
{
|
||||
m_eClientOperation = opClientRequestDownloadUrl;
|
||||
}
|
||||
else if (optarg && !strcasecmp(optarg, "T"))
|
||||
{
|
||||
@@ -1324,51 +1301,6 @@ void Options::InitCommandLine(int argc, char* argv[])
|
||||
free(m_szAddNZBFilename);
|
||||
m_szAddNZBFilename = strdup(argv[optind-1]);
|
||||
}
|
||||
else if (optarg && !strcasecmp(optarg, "DK"))
|
||||
{
|
||||
optind++;
|
||||
if (optind > argc)
|
||||
{
|
||||
abort("FATAL ERROR: Could not parse value of option 'A'\n");
|
||||
}
|
||||
free(m_szAddDupeKey);
|
||||
m_szAddDupeKey = strdup(argv[optind-1]);
|
||||
}
|
||||
else if (optarg && !strcasecmp(optarg, "DS"))
|
||||
{
|
||||
optind++;
|
||||
if (optind > argc)
|
||||
{
|
||||
abort("FATAL ERROR: Could not parse value of option 'A'\n");
|
||||
}
|
||||
m_iAddDupeScore = atoi(argv[optind-1]);
|
||||
}
|
||||
else if (optarg && !strcasecmp(optarg, "DM"))
|
||||
{
|
||||
optind++;
|
||||
if (optind > argc)
|
||||
{
|
||||
abort("FATAL ERROR: Could not parse value of option 'A'\n");
|
||||
}
|
||||
|
||||
const char* szDupeMode = argv[optind-1];
|
||||
if (!strcasecmp(szDupeMode, "score"))
|
||||
{
|
||||
m_iAddDupeMode = dmScore;
|
||||
}
|
||||
else if (!strcasecmp(szDupeMode, "all"))
|
||||
{
|
||||
m_iAddDupeMode = dmAll;
|
||||
}
|
||||
else if (!strcasecmp(szDupeMode, "force"))
|
||||
{
|
||||
m_iAddDupeMode = dmForce;
|
||||
}
|
||||
else
|
||||
{
|
||||
abort("FATAL ERROR: Could not parse value of option 'A'\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
optind--;
|
||||
@@ -1404,10 +1336,6 @@ void Options::InitCommandLine(int argc, char* argv[])
|
||||
{
|
||||
m_eClientOperation = opClientRequestHistory;
|
||||
}
|
||||
else if (!strcasecmp(optarg, "HA"))
|
||||
{
|
||||
m_eClientOperation = opClientRequestHistoryAll;
|
||||
}
|
||||
else
|
||||
{
|
||||
abort("FATAL ERROR: Could not parse value of option 'L'\n");
|
||||
@@ -1792,17 +1720,16 @@ void Options::PrintUsage(char* com)
|
||||
" -V, --serverversion Print server's version and exit\n"
|
||||
" -Q, --quit Shutdown server\n"
|
||||
" -O, --reload Reload config and restart all services\n"
|
||||
" -A, --append [<options>] <nzb-file/url> Send file/url to server's\n"
|
||||
" -A, --append [F|U] [<options>] <nzb-file/url> Send file/url to server's\n"
|
||||
" download queue\n"
|
||||
" F Send file (default)\n"
|
||||
" U Send url\n"
|
||||
" <options> are (multiple options must be separated with space):\n"
|
||||
" T Add file to the top (beginning) of queue\n"
|
||||
" P Pause added files\n"
|
||||
" C <name> Assign category to nzb-file\n"
|
||||
" N <name> Use this name as nzb-filename\n"
|
||||
" N <name> Use this name as nzb-filename (only for URLs)\n"
|
||||
" I <priority> Set priority (signed integer)\n"
|
||||
" DK <dupekey> Set duplicate key (string)\n"
|
||||
" DS <dupescore> Set duplicate score (signed integer)\n"
|
||||
" DM (score|all|force) Set duplicate mode\n"
|
||||
" -C, --connect Attach client to server\n"
|
||||
" -L, --list [F|FR|G|GR|O|H|S] [RegEx] Request list of items from server\n"
|
||||
" F List individual files and server status (default)\n"
|
||||
@@ -1811,7 +1738,6 @@ void Options::PrintUsage(char* com)
|
||||
" GR Like \"G\" but apply regular expression filter\n"
|
||||
" O List post-processor-queue\n"
|
||||
" H List history\n"
|
||||
" HA List history, all records (incl. hidden)\n"
|
||||
" S Print only server status\n"
|
||||
" <RegEx> Regular expression (only with options \"FR\", \"GR\")\n"
|
||||
" using POSIX Extended Regular Expression Syntax\n"
|
||||
@@ -1895,7 +1821,7 @@ void Options::InitFileArg(int argc, char* argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
abort("FATAL ERROR: Nzb-file or Url not specified\n");
|
||||
abort("FATAL ERROR: Nzb-file not specified\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1921,7 +1847,7 @@ void Options::InitFileArg(int argc, char* argv[])
|
||||
#ifdef WIN32
|
||||
m_szArgFilename = strdup(szFileName);
|
||||
#else
|
||||
if (szFileName[0] == '/' || !strncasecmp(szFileName, "http://", 6) || !strncasecmp(szFileName, "https://", 7))
|
||||
if (szFileName[0] == '/')
|
||||
{
|
||||
m_szArgFilename = strdup(szFileName);
|
||||
}
|
||||
@@ -1939,6 +1865,7 @@ void Options::InitFileArg(int argc, char* argv[])
|
||||
if (m_bServerMode || m_bRemoteClientMode ||
|
||||
!(m_eClientOperation == opClientNoOperation ||
|
||||
m_eClientOperation == opClientRequestDownload ||
|
||||
m_eClientOperation == opClientRequestDownloadUrl ||
|
||||
m_eClientOperation == opClientRequestWriteLog))
|
||||
{
|
||||
abort("FATAL ERROR: Too many arguments\n");
|
||||
@@ -2118,11 +2045,8 @@ void Options::InitServers()
|
||||
sprintf(optname, "Server%i.Connections", n);
|
||||
const char* nconnections = GetOption(optname);
|
||||
|
||||
sprintf(optname, "Server%i.Retention", n);
|
||||
const char* nretention = GetOption(optname);
|
||||
|
||||
bool definition = nactive || nname || nlevel || ngroup || nhost || nport ||
|
||||
nusername || npassword || nconnections || njoingroup || ntls || ncipher || nretention;
|
||||
nusername || npassword || nconnections || njoingroup || ntls || ncipher;
|
||||
bool completed = nhost && nport && nconnections;
|
||||
|
||||
if (!definition)
|
||||
@@ -2133,14 +2057,10 @@ void Options::InitServers()
|
||||
if (completed)
|
||||
{
|
||||
NewsServer* pNewsServer = new NewsServer(n, bActive, nname,
|
||||
nhost,
|
||||
nport ? atoi(nport) : 119,
|
||||
nusername, npassword,
|
||||
bJoinGroup, bTLS, ncipher,
|
||||
nconnections ? atoi(nconnections) : 1,
|
||||
nretention ? atoi(nretention) : 0,
|
||||
nlevel ? atoi(nlevel) : 0,
|
||||
ngroup ? atoi(ngroup) : 0);
|
||||
nhost, atoi(nport), nusername, npassword,
|
||||
bJoinGroup, bTLS, ncipher, atoi((char*)nconnections),
|
||||
nlevel ? atoi((char*)nlevel) : 0,
|
||||
ngroup ? atoi((char*)ngroup) : 0);
|
||||
g_pServerPool->AddServer(pNewsServer);
|
||||
}
|
||||
else
|
||||
@@ -2152,7 +2072,6 @@ void Options::InitServers()
|
||||
}
|
||||
|
||||
g_pServerPool->SetTimeout(GetArticleTimeout());
|
||||
g_pServerPool->SetRetryInterval(GetRetryInterval());
|
||||
}
|
||||
|
||||
void Options::InitCategories()
|
||||
@@ -2658,8 +2577,7 @@ bool Options::ValidateOptionName(const char* optname, const char* optvalue)
|
||||
!strcasecmp(p, ".port") || !strcasecmp(p, ".username") ||
|
||||
!strcasecmp(p, ".password") || !strcasecmp(p, ".joingroup") ||
|
||||
!strcasecmp(p, ".encryption") || !strcasecmp(p, ".connections") ||
|
||||
!strcasecmp(p, ".cipher") || !strcasecmp(p, ".group") ||
|
||||
!strcasecmp(p, ".retention")))
|
||||
!strcasecmp(p, ".cipher") || !strcasecmp(p, ".group")))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -2889,11 +2807,6 @@ void Options::CheckOptions()
|
||||
m_iArticleCache = 1900;
|
||||
m_iParBuffer = 400;
|
||||
}
|
||||
|
||||
if (!Util::EmptyStr(m_szUnpackPassFile) && !Util::FileExists(m_szUnpackPassFile))
|
||||
{
|
||||
ConfigError("Invalid value for option \"UnpackPassFile\": %s. File not found", m_szUnpackPassFile);
|
||||
}
|
||||
}
|
||||
|
||||
void Options::ParseFileIDList(int argc, char* argv[], int optind)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
opClientRequestScanPause,
|
||||
opClientRequestScanUnpause,
|
||||
opClientRequestHistory,
|
||||
opClientRequestHistoryAll
|
||||
opClientRequestDownloadUrl
|
||||
};
|
||||
enum EWriteLog
|
||||
{
|
||||
@@ -329,7 +329,6 @@ private:
|
||||
bool m_bUnpackCleanupDisk;
|
||||
char* m_szUnrarCmd;
|
||||
char* m_szSevenZipCmd;
|
||||
char* m_szUnpackPassFile;
|
||||
bool m_bUnpackPauseQueue;
|
||||
char* m_szExtCleanupDisk;
|
||||
char* m_szParIgnoreExt;
|
||||
@@ -359,9 +358,6 @@ private:
|
||||
char* m_szLastArg;
|
||||
bool m_bPrintOptions;
|
||||
bool m_bAddTop;
|
||||
char* m_szAddDupeKey;
|
||||
int m_iAddDupeScore;
|
||||
int m_iAddDupeMode;
|
||||
int m_iSetRate;
|
||||
int m_iLogLines;
|
||||
int m_iWriteLogKind;
|
||||
@@ -509,7 +505,6 @@ public:
|
||||
bool GetUnpackCleanupDisk() { return m_bUnpackCleanupDisk; }
|
||||
const char* GetUnrarCmd() { return m_szUnrarCmd; }
|
||||
const char* GetSevenZipCmd() { return m_szSevenZipCmd; }
|
||||
const char* GetUnpackPassFile() { return m_szUnpackPassFile; }
|
||||
bool GetUnpackPauseQueue() { return m_bUnpackPauseQueue; }
|
||||
const char* GetExtCleanupDisk() { return m_szExtCleanupDisk; }
|
||||
const char* GetParIgnoreExt() { return m_szParIgnoreExt; }
|
||||
@@ -520,7 +515,6 @@ public:
|
||||
int GetArticleCache() { return m_iArticleCache; }
|
||||
int GetEventInterval() { return m_iEventInterval; }
|
||||
|
||||
Categories* GetCategories() { return &m_Categories; }
|
||||
Category* FindCategory(const char* szName, bool bSearchAliases) { return m_Categories.FindCategory(szName, bSearchAliases); }
|
||||
|
||||
// Parsed command-line parameters
|
||||
@@ -542,9 +536,6 @@ public:
|
||||
int GetAddPriority() { return m_iAddPriority; }
|
||||
char* GetAddNZBFilename() { return m_szAddNZBFilename; }
|
||||
bool GetAddTop() { return m_bAddTop; }
|
||||
const char* GetAddDupeKey() { return m_szAddDupeKey; }
|
||||
int GetAddDupeScore() { return m_iAddDupeScore; }
|
||||
int GetAddDupeMode() { return m_iAddDupeMode; }
|
||||
int GetSetRate() { return m_iSetRate; }
|
||||
int GetLogLines() { return m_iLogLines; }
|
||||
int GetWriteLogKind() { return m_iWriteLogKind; }
|
||||
|
||||
0
daemon/main/StackTrace.cpp
Normal file → Executable file
0
daemon/main/StackTrace.cpp
Normal file → Executable file
0
daemon/main/StackTrace.h
Normal file → Executable file
0
daemon/main/StackTrace.h
Normal file → Executable file
@@ -2,7 +2,7 @@
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -82,7 +82,6 @@
|
||||
#include "StackTrace.h"
|
||||
#ifdef WIN32
|
||||
#include "NTService.h"
|
||||
#include "WinConsole.h"
|
||||
#endif
|
||||
|
||||
// Prototypes
|
||||
@@ -121,9 +120,6 @@ int g_iArgumentCount;
|
||||
char* (*g_szEnvironmentVariables)[] = NULL;
|
||||
char* (*g_szArguments)[] = NULL;
|
||||
bool g_bReloading = true;
|
||||
#ifdef WIN32
|
||||
WinConsole* g_pWinConsole = NULL;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Main loop
|
||||
@@ -204,11 +200,6 @@ void Run(bool bReload)
|
||||
Thread::Init();
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
g_pWinConsole = new WinConsole();
|
||||
g_pWinConsole->InitAppMode();
|
||||
#endif
|
||||
|
||||
g_pServerPool = new ServerPool();
|
||||
g_pScheduler = new Scheduler();
|
||||
g_pQueueCoordinator = new QueueCoordinator();
|
||||
@@ -348,9 +339,6 @@ void Run(bool bReload)
|
||||
g_pDiskState = new DiskState();
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
g_pWinConsole->Start();
|
||||
#endif
|
||||
g_pQueueCoordinator->Start();
|
||||
g_pUrlCoordinator->Start();
|
||||
g_pPrePostProcessor->Start();
|
||||
@@ -365,9 +353,6 @@ void Run(bool bReload)
|
||||
g_pUrlCoordinator->IsRunning() ||
|
||||
g_pPrePostProcessor->IsRunning() ||
|
||||
g_pFeedCoordinator->IsRunning() ||
|
||||
#ifdef WIN32
|
||||
g_pWinConsole->IsRunning() ||
|
||||
#endif
|
||||
g_pArticleCache->IsRunning())
|
||||
{
|
||||
if (!g_pOptions->GetServerMode() &&
|
||||
@@ -519,9 +504,7 @@ void ProcessClientRequest()
|
||||
break;
|
||||
|
||||
case Options::opClientRequestDownload:
|
||||
Client->RequestServerDownload(g_pOptions->GetAddNZBFilename(), g_pOptions->GetArgFilename(),
|
||||
g_pOptions->GetAddCategory(), g_pOptions->GetAddTop(), g_pOptions->GetAddPaused(), g_pOptions->GetAddPriority(),
|
||||
g_pOptions->GetAddDupeKey(), g_pOptions->GetAddDupeMode(), g_pOptions->GetAddDupeScore());
|
||||
Client->RequestServerDownload(g_pOptions->GetArgFilename(), g_pOptions->GetAddCategory(), g_pOptions->GetAddTop(), g_pOptions->GetAddPaused(), g_pOptions->GetAddPriority());
|
||||
break;
|
||||
|
||||
case Options::opClientRequestVersion:
|
||||
@@ -560,9 +543,12 @@ void ProcessClientRequest()
|
||||
Client->RequestServerPauseUnpause(false, eRemotePauseUnpauseActionScan);
|
||||
break;
|
||||
|
||||
case Options::opClientRequestHistory:
|
||||
case Options::opClientRequestHistoryAll:
|
||||
Client->RequestHistory(g_pOptions->GetClientOperation() == Options::opClientRequestHistoryAll);
|
||||
case Options::opClientRequestHistory:
|
||||
Client->RequestHistory();
|
||||
break;
|
||||
|
||||
case Options::opClientRequestDownloadUrl:
|
||||
Client->RequestServerDownloadUrl(g_pOptions->GetLastArg(), g_pOptions->GetAddNZBFilename(), g_pOptions->GetAddCategory(), g_pOptions->GetAddTop(), g_pOptions->GetAddPaused(), g_pOptions->GetAddPriority());
|
||||
break;
|
||||
|
||||
case Options::opClientNoOperation:
|
||||
@@ -596,9 +582,6 @@ void ExitProc()
|
||||
g_pPrePostProcessor->Stop();
|
||||
g_pFeedCoordinator->Stop();
|
||||
g_pArticleCache->Stop();
|
||||
#ifdef WIN32
|
||||
g_pWinConsole->Stop();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -715,11 +698,6 @@ void Cleanup()
|
||||
Thread::Final();
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
delete g_pWinConsole;
|
||||
g_pWinConsole = NULL;
|
||||
#endif
|
||||
|
||||
debug("Global objects cleaned up");
|
||||
|
||||
delete g_pLog;
|
||||
|
||||
@@ -70,11 +70,6 @@
|
||||
#define FOPEN_AB "abN"
|
||||
#define FOPEN_ABP "ab+N"
|
||||
|
||||
#ifdef DEBUG
|
||||
// redefine "exit" to avoid printing memory leaks report when terminated because of wrong command line switches
|
||||
#define exit(code) ExitProcess(code)
|
||||
#endif
|
||||
|
||||
#pragma warning(disable:4800) // 'type' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
#pragma warning(disable:4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data
|
||||
|
||||
|
||||
@@ -158,31 +158,13 @@ void ArticleDownloader::Run()
|
||||
m_pConnection->GetNewsServer()->GetName(), m_pConnection->GetHost());
|
||||
m_szConnectionName[sizeof(m_szConnectionName) - 1] = '\0';
|
||||
|
||||
// check server retention
|
||||
bool bRetentionFailure = m_pConnection->GetNewsServer()->GetRetention() > 0 &&
|
||||
(time(NULL) - m_pFileInfo->GetTime()) / 86400 > m_pConnection->GetNewsServer()->GetRetention();
|
||||
if (bRetentionFailure)
|
||||
{
|
||||
detail("Article %s @ %s failed: out of server retention (file age: %i, configured retention: %i)",
|
||||
m_szInfoName, m_szConnectionName,
|
||||
(time(NULL) - m_pFileInfo->GetTime()) / 86400,
|
||||
m_pConnection->GetNewsServer()->GetRetention());
|
||||
Status = adFailed;
|
||||
FreeConnection(true);
|
||||
}
|
||||
|
||||
if (m_pConnection && !IsStopped())
|
||||
{
|
||||
detail("Downloading %s @ %s", m_szInfoName, m_szConnectionName);
|
||||
}
|
||||
|
||||
// test connection
|
||||
bool bConnected = m_pConnection && m_pConnection->Connect();
|
||||
if (bConnected && !IsStopped())
|
||||
{
|
||||
NewsServer* pNewsServer = m_pConnection->GetNewsServer();
|
||||
detail("Downloading %s @ %s", m_szInfoName, m_szConnectionName);
|
||||
|
||||
// Download article
|
||||
Status = Download();
|
||||
|
||||
if (Status == adFinished || Status == adFailed || Status == adNotFound || Status == adCrcError)
|
||||
@@ -191,45 +173,66 @@ void ArticleDownloader::Run()
|
||||
}
|
||||
}
|
||||
|
||||
if (bConnected)
|
||||
{
|
||||
if (Status == adConnectError)
|
||||
{
|
||||
m_pConnection->Disconnect();
|
||||
bConnected = false;
|
||||
Status = adFailed;
|
||||
}
|
||||
else
|
||||
{
|
||||
// freeing connection allows other threads to start.
|
||||
// we doing this only if the problem was with article or group.
|
||||
// if the problem occurs by connecting or authorization we do not
|
||||
// free the connection, to prevent starting of thousands of threads
|
||||
// (cause each of them will also free it's connection after the
|
||||
// same connect-error).
|
||||
FreeConnection(Status == adFinished || Status == adNotFound);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_pConnection)
|
||||
{
|
||||
AddServerData();
|
||||
}
|
||||
|
||||
if (!bConnected && m_pConnection)
|
||||
if (Status == adFinished || Status == adFatalError)
|
||||
{
|
||||
detail("Article %s @ %s failed: could not establish connection", m_szInfoName, m_szConnectionName);
|
||||
break;
|
||||
}
|
||||
|
||||
if (Status == adConnectError)
|
||||
{
|
||||
bConnected = false;
|
||||
Status = adFailed;
|
||||
}
|
||||
pWantServer = NULL;
|
||||
|
||||
if (bConnected && Status == adFailed)
|
||||
{
|
||||
iRemainedRetries--;
|
||||
}
|
||||
|
||||
if (!bConnected && m_pConnection)
|
||||
{
|
||||
g_pServerPool->BlockServer(pLastServer);
|
||||
}
|
||||
|
||||
pWantServer = NULL;
|
||||
if (bConnected && Status == adFailed && iRemainedRetries > 0 && !bRetentionFailure)
|
||||
if (!bConnected || (Status == adFailed && iRemainedRetries > 0))
|
||||
{
|
||||
pWantServer = pLastServer;
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeConnection(Status == adFinished || Status == adNotFound);
|
||||
}
|
||||
|
||||
if (Status == adFinished || Status == adFatalError)
|
||||
if (pWantServer &&
|
||||
!(IsStopped() || (g_pOptions->GetPauseDownload() && !bForce) ||
|
||||
(g_pOptions->GetTempPauseDownload() && !m_pFileInfo->GetExtraPriority()) ||
|
||||
iServerConfigGeneration != g_pServerPool->GetGeneration()))
|
||||
{
|
||||
break;
|
||||
detail("Waiting %i sec to retry", g_pOptions->GetRetryInterval());
|
||||
SetStatus(adWaiting);
|
||||
int msec = 0;
|
||||
while (!(IsStopped() || (g_pOptions->GetPauseDownload() && !bForce) ||
|
||||
(g_pOptions->GetTempPauseDownload() && !m_pFileInfo->GetExtraPriority()) ||
|
||||
iServerConfigGeneration != g_pServerPool->GetGeneration()) &&
|
||||
msec < g_pOptions->GetRetryInterval() * 1000)
|
||||
{
|
||||
usleep(100 * 1000);
|
||||
msec += 100;
|
||||
}
|
||||
SetLastUpdateTimeNow();
|
||||
SetStatus(adRunning);
|
||||
}
|
||||
|
||||
if (IsStopped() || (g_pOptions->GetPauseDownload() && !bForce) ||
|
||||
@@ -240,7 +243,7 @@ void ArticleDownloader::Run()
|
||||
break;
|
||||
}
|
||||
|
||||
if (!pWantServer && (bConnected || bRetentionFailure))
|
||||
if (!pWantServer)
|
||||
{
|
||||
failedServers.push_back(pLastServer);
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ bool NNTPConnection::AuthInfoUser(int iRecur)
|
||||
char* answer = ReadLine(m_szLineBuf, CONNECTION_LINEBUFFER_SIZE, NULL);
|
||||
if (!answer)
|
||||
{
|
||||
ReportErrorAnswer("Authorization for %s (%s) failed: Connection closed by remote host", NULL);
|
||||
ReportErrorAnswer("Authorization for server%i (%s) failed: Connection closed by remote host", NULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ bool NNTPConnection::AuthInfoUser(int iRecur)
|
||||
|
||||
if (GetStatus() != csCancelled)
|
||||
{
|
||||
ReportErrorAnswer("Authorization for %s (%s) failed: %s", answer);
|
||||
ReportErrorAnswer("Authorization for server%i (%s) failed (Answer: %s)", answer);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ bool NNTPConnection::AuthInfoPass(int iRecur)
|
||||
char* answer = ReadLine(m_szLineBuf, CONNECTION_LINEBUFFER_SIZE, NULL);
|
||||
if (!answer)
|
||||
{
|
||||
ReportErrorAnswer("Authorization failed for %s (%s): Connection closed by remote host", NULL);
|
||||
ReportErrorAnswer("Authorization for server%i (%s) failed: Connection closed by remote host", NULL);
|
||||
return false;
|
||||
}
|
||||
else if (!strncmp(answer, "2", 1))
|
||||
@@ -185,7 +185,7 @@ bool NNTPConnection::AuthInfoPass(int iRecur)
|
||||
|
||||
if (GetStatus() != csCancelled)
|
||||
{
|
||||
ReportErrorAnswer("Authorization for %s (%s) failed: %s", answer);
|
||||
ReportErrorAnswer("Authorization for server%i (%s) failed (Answer: %s)", answer);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -237,14 +237,14 @@ bool NNTPConnection::Connect()
|
||||
|
||||
if (!answer)
|
||||
{
|
||||
ReportErrorAnswer("Connection to %s (%s) failed: Connection closed by remote host", NULL);
|
||||
ReportErrorAnswer("Connection to server%i (%s) failed: Connection closed by remote host", NULL);
|
||||
Disconnect();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strncmp(answer, "2", 1))
|
||||
{
|
||||
ReportErrorAnswer("Connection to %s (%s) failed: %s", answer);
|
||||
ReportErrorAnswer("Connection to server%i (%s) failed (Answer: %s)", answer);
|
||||
Disconnect();
|
||||
return false;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ bool NNTPConnection::Disconnect()
|
||||
void NNTPConnection::ReportErrorAnswer(const char* szMsgPrefix, const char* szAnswer)
|
||||
{
|
||||
char szErrStr[1024];
|
||||
snprintf(szErrStr, 1024, szMsgPrefix, m_pNewsServer->GetName(), m_pNewsServer->GetHost(), szAnswer);
|
||||
snprintf(szErrStr, 1024, szMsgPrefix, m_pNewsServer->GetID(), m_pNewsServer->GetHost(), szAnswer);
|
||||
szErrStr[1024-1] = '\0';
|
||||
|
||||
ReportError(szErrStr, NULL, false, 0);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file if part of nzbget
|
||||
*
|
||||
* Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2014 Andrey Prygunkov <hugbug@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2013 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
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
NewsServer::NewsServer(int iID, bool bActive, const char* szName, const char* szHost, int iPort,
|
||||
const char* szUser, const char* szPass, bool bJoinGroup, bool bTLS,
|
||||
const char* szCipher, int iMaxConnections, int iRetention, int iLevel, int iGroup)
|
||||
const char* szCipher, int iMaxConnections, int iLevel, int iGroup)
|
||||
{
|
||||
m_iID = iID;
|
||||
m_iStateID = 0;
|
||||
@@ -57,8 +57,6 @@ NewsServer::NewsServer(int iID, bool bActive, const char* szName, const char* sz
|
||||
m_szUser = strdup(szUser ? szUser : "");
|
||||
m_szPassword = strdup(szPass ? szPass : "");
|
||||
m_szCipher = strdup(szCipher ? szCipher : "");
|
||||
m_iRetention = iRetention;
|
||||
m_tBlockTime = 0;
|
||||
|
||||
if (szName && strlen(szName) > 0)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file if part of nzbget
|
||||
*
|
||||
* Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2015 Andrey Prygunkov <hugbug@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2013 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
|
||||
@@ -28,7 +28,6 @@
|
||||
#define NEWSSERVER_H
|
||||
|
||||
#include <vector>
|
||||
#include <time.h>
|
||||
|
||||
class NewsServer
|
||||
{
|
||||
@@ -48,14 +47,11 @@ private:
|
||||
bool m_bJoinGroup;
|
||||
bool m_bTLS;
|
||||
char* m_szCipher;
|
||||
int m_iRetention;
|
||||
time_t m_tBlockTime;
|
||||
|
||||
public:
|
||||
NewsServer(int iID, bool bActive, const char* szName, const char* szHost, int iPort,
|
||||
const char* szUser, const char* szPass, bool bJoinGroup,
|
||||
bool bTLS, const char* szCipher, int iMaxConnections, int iRetention,
|
||||
int iLevel, int iGroup);
|
||||
bool bTLS, const char* szCipher, int iMaxConnections, int iLevel, int iGroup);
|
||||
~NewsServer();
|
||||
int GetID() { return m_iID; }
|
||||
int GetStateID() { return m_iStateID; }
|
||||
@@ -75,9 +71,6 @@ public:
|
||||
int GetJoinGroup() { return m_bJoinGroup; }
|
||||
bool GetTLS() { return m_bTLS; }
|
||||
const char* GetCipher() { return m_szCipher; }
|
||||
int GetRetention() { return m_iRetention; }
|
||||
time_t GetBlockTime() { return m_tBlockTime; }
|
||||
void SetBlockTime(time_t tBlockTime) { m_tBlockTime = tBlockTime; }
|
||||
};
|
||||
|
||||
typedef std::vector<NewsServer*> Servers;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -58,7 +58,6 @@ ServerPool::ServerPool()
|
||||
m_iMaxNormLevel = 0;
|
||||
m_iTimeout = 60;
|
||||
m_iGeneration = 0;
|
||||
m_iRetryInterval = 0;
|
||||
|
||||
g_pLog->RegisterDebuggable(this);
|
||||
}
|
||||
@@ -158,7 +157,6 @@ void ServerPool::InitConnections()
|
||||
for (Servers::iterator it = m_SortedServers.begin(); it != m_SortedServers.end(); it++)
|
||||
{
|
||||
NewsServer* pNewsServer = *it;
|
||||
pNewsServer->SetBlockTime(0);
|
||||
int iNormLevel = pNewsServer->GetNormLevel();
|
||||
if (pNewsServer->GetNormLevel() > -1)
|
||||
{
|
||||
@@ -201,15 +199,11 @@ void ServerPool::InitConnections()
|
||||
NNTPConnection* ServerPool::GetConnection(int iLevel, NewsServer* pWantServer, Servers* pIgnoreServers)
|
||||
{
|
||||
PooledConnection* pConnection = NULL;
|
||||
m_mutexConnections.Lock();
|
||||
|
||||
time_t tCurTime = time(NULL);
|
||||
m_mutexConnections.Lock();
|
||||
|
||||
if (iLevel < (int)m_Levels.size() && m_Levels[iLevel] > 0)
|
||||
{
|
||||
Connections candidates;
|
||||
candidates.reserve(m_Connections.size());
|
||||
|
||||
for (Connections::iterator it = m_Connections.begin(); it != m_Connections.end(); it++)
|
||||
{
|
||||
PooledConnection* pCandidateConnection = *it;
|
||||
@@ -217,11 +211,7 @@ NNTPConnection* ServerPool::GetConnection(int iLevel, NewsServer* pWantServer, S
|
||||
if (!pCandidateConnection->GetInUse() && pCandidateServer->GetActive() &&
|
||||
pCandidateServer->GetNormLevel() == iLevel &&
|
||||
(!pWantServer || pCandidateServer == pWantServer ||
|
||||
(pWantServer->GetGroup() > 0 && pWantServer->GetGroup() == pCandidateServer->GetGroup())) &&
|
||||
(pCandidateConnection->GetStatus() == Connection::csConnected ||
|
||||
!pCandidateServer->GetBlockTime() ||
|
||||
pCandidateServer->GetBlockTime() + m_iRetryInterval <= tCurTime ||
|
||||
pCandidateServer->GetBlockTime() > tCurTime))
|
||||
(pWantServer->GetGroup() > 0 && pWantServer->GetGroup() == pCandidateServer->GetGroup())))
|
||||
{
|
||||
// free connection found, check if it's not from the server which should be ignored
|
||||
bool bUseConnection = true;
|
||||
@@ -240,25 +230,15 @@ NNTPConnection* ServerPool::GetConnection(int iLevel, NewsServer* pWantServer, S
|
||||
}
|
||||
}
|
||||
|
||||
pCandidateServer->SetBlockTime(0);
|
||||
|
||||
if (bUseConnection)
|
||||
{
|
||||
candidates.push_back(pCandidateConnection);
|
||||
pConnection = pCandidateConnection;
|
||||
pConnection->SetInUse(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!candidates.empty())
|
||||
{
|
||||
// Peeking a random free connection. This is better than taking the first
|
||||
// available connection because provides better distribution across news servers,
|
||||
// especially when one of servers becomes unavailable or doesn't have requested articles.
|
||||
int iRandomIndex = rand() % candidates.size();
|
||||
pConnection = candidates[iRandomIndex];
|
||||
pConnection->SetInUse(true);
|
||||
}
|
||||
|
||||
if (pConnection)
|
||||
{
|
||||
m_Levels[iLevel]--;
|
||||
@@ -293,27 +273,12 @@ void ServerPool::FreeConnection(NNTPConnection* pConnection, bool bUsed)
|
||||
m_mutexConnections.Unlock();
|
||||
}
|
||||
|
||||
void ServerPool::BlockServer(NewsServer* pNewsServer)
|
||||
{
|
||||
m_mutexConnections.Lock();
|
||||
time_t tCurTime = time(NULL);
|
||||
bool bNewBlock = pNewsServer->GetBlockTime() != tCurTime;
|
||||
pNewsServer->SetBlockTime(tCurTime);
|
||||
m_mutexConnections.Unlock();
|
||||
|
||||
if (bNewBlock && m_iRetryInterval > 0)
|
||||
{
|
||||
warn("Blocking %s (%s) for %i sec", pNewsServer->GetName(), pNewsServer->GetHost(), m_iRetryInterval);
|
||||
}
|
||||
}
|
||||
|
||||
void ServerPool::CloseUnusedConnections()
|
||||
{
|
||||
m_mutexConnections.Lock();
|
||||
|
||||
time_t curtime = ::time(NULL);
|
||||
|
||||
// close and free all connections of servers which were disabled since the last check
|
||||
int i = 0;
|
||||
for (Connections::iterator it = m_Connections.begin(); it != m_Connections.end(); )
|
||||
{
|
||||
@@ -335,6 +300,16 @@ void ServerPool::CloseUnusedConnections()
|
||||
bDeleted = true;
|
||||
}
|
||||
|
||||
if (!bDeleted && !pConnection->GetInUse() && pConnection->GetStatus() == Connection::csConnected)
|
||||
{
|
||||
int tdiff = (int)(curtime - pConnection->GetFreeTime());
|
||||
if (tdiff > CONNECTION_HOLD_SECODNS)
|
||||
{
|
||||
debug("Closing (and keeping) unused connection to server%i", pConnection->GetNewsServer()->GetID());
|
||||
pConnection->Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
if (!bDeleted)
|
||||
{
|
||||
it++;
|
||||
@@ -342,50 +317,6 @@ void ServerPool::CloseUnusedConnections()
|
||||
}
|
||||
}
|
||||
|
||||
// close all opened connections on levels not having any in-use connections
|
||||
for (int iLevel = 0; iLevel <= m_iMaxNormLevel; iLevel++)
|
||||
{
|
||||
// check if we have in-use connections on the level
|
||||
bool bHasInUseConnections = false;
|
||||
int iInactiveTime = 0;
|
||||
for (Connections::iterator it = m_Connections.begin(); it != m_Connections.end(); it++)
|
||||
{
|
||||
PooledConnection* pConnection = *it;
|
||||
if (pConnection->GetNewsServer()->GetNormLevel() == iLevel)
|
||||
{
|
||||
if (pConnection->GetInUse())
|
||||
{
|
||||
bHasInUseConnections = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
int tdiff = (int)(curtime - pConnection->GetFreeTime());
|
||||
if (tdiff > iInactiveTime)
|
||||
{
|
||||
iInactiveTime = tdiff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if there are no in-use connections on the level and the hold time out has
|
||||
// expired - close all connections of the level.
|
||||
if (!bHasInUseConnections && iInactiveTime > CONNECTION_HOLD_SECODNS)
|
||||
{
|
||||
for (Connections::iterator it = m_Connections.begin(); it != m_Connections.end(); it++)
|
||||
{
|
||||
PooledConnection* pConnection = *it;
|
||||
if (pConnection->GetNewsServer()->GetNormLevel() == iLevel &&
|
||||
pConnection->GetStatus() == Connection::csConnected)
|
||||
{
|
||||
debug("Closing (and keeping) unused connection to server%i", pConnection->GetNewsServer()->GetID());
|
||||
pConnection->Disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_mutexConnections.Unlock();
|
||||
}
|
||||
|
||||
@@ -405,16 +336,12 @@ void ServerPool::LogDebugInfo()
|
||||
|
||||
m_mutexConnections.Lock();
|
||||
|
||||
time_t tCurTime = time(NULL);
|
||||
|
||||
info(" Servers: %i", m_Servers.size());
|
||||
for (Servers::iterator it = m_Servers.begin(); it != m_Servers.end(); it++)
|
||||
{
|
||||
NewsServer* pNewsServer = *it;
|
||||
info(" %i) %s (%s): Level=%i, NormLevel=%i, BlockSec=%i", pNewsServer->GetID(), pNewsServer->GetName(),
|
||||
pNewsServer->GetHost(), pNewsServer->GetLevel(), pNewsServer->GetNormLevel(),
|
||||
pNewsServer->GetBlockTime() && pNewsServer->GetBlockTime() + m_iRetryInterval > tCurTime ?
|
||||
pNewsServer->GetBlockTime() + m_iRetryInterval - tCurTime : 0);
|
||||
info(" %i) %s (%s): Level=%i, NormLevel=%i", pNewsServer->GetID(), pNewsServer->GetName(),
|
||||
pNewsServer->GetHost(), pNewsServer->GetLevel(), pNewsServer->GetNormLevel());
|
||||
}
|
||||
|
||||
info(" Levels: %i", m_Levels.size());
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2014 Andrey Prygunkov <hugbug@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2013 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
|
||||
@@ -61,20 +61,18 @@ private:
|
||||
int m_iMaxNormLevel;
|
||||
Mutex m_mutexConnections;
|
||||
int m_iTimeout;
|
||||
int m_iRetryInterval;
|
||||
int m_iGeneration;
|
||||
|
||||
void NormalizeLevels();
|
||||
static bool CompareServers(NewsServer* pServer1, NewsServer* pServer2);
|
||||
|
||||
protected:
|
||||
virtual void LogDebugInfo();
|
||||
virtual void LogDebugInfo();
|
||||
|
||||
public:
|
||||
ServerPool();
|
||||
~ServerPool();
|
||||
void SetTimeout(int iTimeout) { m_iTimeout = iTimeout; }
|
||||
void SetRetryInterval(int iRetryInterval) { m_iRetryInterval = iRetryInterval; }
|
||||
void AddServer(NewsServer* pNewsServer);
|
||||
void InitConnections();
|
||||
int GetMaxNormLevel() { return m_iMaxNormLevel; }
|
||||
@@ -84,7 +82,6 @@ public:
|
||||
void CloseUnusedConnections();
|
||||
void Changed();
|
||||
int GetGeneration() { return m_iGeneration; }
|
||||
void BlockServer(NewsServer* pNewsServer);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#include "Options.h"
|
||||
#include "ServerPool.h"
|
||||
#include "DiskState.h"
|
||||
#include "Util.h"
|
||||
|
||||
extern ServerPool* g_pServerPool;
|
||||
extern Options* g_pOptions;
|
||||
@@ -172,42 +171,43 @@ void ServerVolume::LogDebugInfo()
|
||||
{
|
||||
info(" ---------- ServerVolume");
|
||||
|
||||
StringBuilder msg;
|
||||
char szSec[4000];
|
||||
|
||||
szSec[0] = '\0';
|
||||
for (int i = 0; i < 60; i++)
|
||||
{
|
||||
char szNum[30];
|
||||
snprintf(szNum, 30, "[%i]=%lli ", i, m_BytesPerSeconds[i]);
|
||||
msg.Append(szNum);
|
||||
char szNum[20];
|
||||
snprintf(szNum, 20, "[%i]=%lli ", i, m_BytesPerSeconds[i]);
|
||||
strncat(szSec, szNum, 4000);
|
||||
}
|
||||
info("Secs: %s", msg.GetBuffer());
|
||||
info("Secs: %s", szSec);
|
||||
|
||||
msg.Clear();
|
||||
szSec[0] = '\0';
|
||||
for (int i = 0; i < 60; i++)
|
||||
{
|
||||
char szNum[30];
|
||||
snprintf(szNum, 30, "[%i]=%lli ", i, m_BytesPerMinutes[i]);
|
||||
msg.Append(szNum);
|
||||
char szNum[20];
|
||||
snprintf(szNum, 20, "[%i]=%lli ", i, m_BytesPerMinutes[i]);
|
||||
strncat(szSec, szNum, 4000);
|
||||
}
|
||||
info("Mins: %s", msg.GetBuffer());
|
||||
info("Mins: %s", szSec);
|
||||
|
||||
msg.Clear();
|
||||
szSec[0] = '\0';
|
||||
for (int i = 0; i < 24; i++)
|
||||
{
|
||||
char szNum[30];
|
||||
snprintf(szNum, 30, "[%i]=%lli ", i, m_BytesPerHours[i]);
|
||||
msg.Append(szNum);
|
||||
char szNum[20];
|
||||
snprintf(szNum, 20, "[%i]=%lli ", i, m_BytesPerHours[i]);
|
||||
strncat(szSec, szNum, 4000);
|
||||
}
|
||||
info("Hours: %s", msg.GetBuffer());
|
||||
info("Hours: %s", szSec);
|
||||
|
||||
msg.Clear();
|
||||
szSec[0] = '\0';
|
||||
for (int i = 0; i < (int)m_BytesPerDays.size(); i++)
|
||||
{
|
||||
char szNum[30];
|
||||
snprintf(szNum, 30, "[%i]=%lli ", m_iFirstDay + i, m_BytesPerDays[i]);
|
||||
msg.Append(szNum);
|
||||
char szNum[20];
|
||||
snprintf(szNum, 20, "[%i]=%lli ", m_iFirstDay + i, m_BytesPerDays[i]);
|
||||
strncat(szSec, szNum, 4000);
|
||||
}
|
||||
info("Days: %s", msg.GetBuffer());
|
||||
info("Days: %s", szSec);
|
||||
}
|
||||
|
||||
StatMeter::StatMeter()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -192,9 +192,7 @@ bool Repairer::ScanDataFile(DiskFile *diskfile, Par2RepairerSourceFile* &sourcef
|
||||
{
|
||||
sig_done(name, iAvailableBlocks, sourcefile->BlockCount());
|
||||
sig_progress(1000.0);
|
||||
matchtype = eFileStatus == ParChecker::fsSuccess ? eFullMatch :
|
||||
eFileStatus == ParChecker::fsPartial ? ePartialMatch : eNoMatch;
|
||||
m_pOwner->SetParFull(false);
|
||||
matchtype = eFileStatus == ParChecker::fsSuccess ? eFullMatch : ParChecker::fsPartial ? ePartialMatch : eNoMatch;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -416,7 +414,6 @@ ParChecker::ParChecker()
|
||||
m_eStage = ptLoadingPars;
|
||||
m_bParQuick = false;
|
||||
m_bForceRepair = false;
|
||||
m_bParFull = false;
|
||||
}
|
||||
|
||||
ParChecker::~ParChecker()
|
||||
@@ -497,7 +494,6 @@ ParChecker::EStatus ParChecker::RunParCheckAll()
|
||||
|
||||
EStatus eAllStatus = psRepairNotNeeded;
|
||||
m_bCancelled = false;
|
||||
m_bParFull = true;
|
||||
|
||||
for (ParCoordinator::ParFileList::iterator it = fileList.begin(); it != fileList.end(); it++)
|
||||
{
|
||||
@@ -1298,7 +1294,7 @@ void ParChecker::DeleteLeftovers()
|
||||
* download with CRC stored in PAR2-file;
|
||||
* - for partially downloaded files the CRCs of articles are compared with block-CRCs stored
|
||||
* in PAR2-file;
|
||||
* - for completely failed files (not a single successful article) no verification is needed at all.
|
||||
* - for completely failed files (not a single successful artice) no verification is needed at all.
|
||||
*
|
||||
* Limitation of the function:
|
||||
* This function requires every block in the file to have an unique CRC (across all blocks
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -119,7 +119,6 @@ private:
|
||||
bool m_bHasDamagedFiles;
|
||||
bool m_bParQuick;
|
||||
bool m_bForceRepair;
|
||||
bool m_bParFull;
|
||||
|
||||
void Cleanup();
|
||||
EStatus RunParCheckAll();
|
||||
@@ -177,8 +176,6 @@ public:
|
||||
bool GetParQuick() { return m_bParQuick; }
|
||||
void SetForceRepair(bool bForceRepair) { m_bForceRepair = bForceRepair; }
|
||||
bool GetForceRepair() { return m_bForceRepair; }
|
||||
void SetParFull(bool bParFull) { m_bParFull = bParFull; }
|
||||
bool GetParFull() { return m_bParFull; }
|
||||
EStatus GetStatus() { return m_eStatus; }
|
||||
void AddParFile(const char* szParFilename);
|
||||
void QueueChanged();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -441,7 +441,6 @@ void ParCoordinator::ParCheckCompleted()
|
||||
pPostInfo->GetNZBInfo()->GetParStatus() <= NZBInfo::psSkipped)
|
||||
{
|
||||
pPostInfo->GetNZBInfo()->SetParStatus(NZBInfo::psSuccess);
|
||||
pPostInfo->SetParRepaired(m_ParChecker.GetStatus() == ParChecker::psRepaired);
|
||||
}
|
||||
else if (m_ParChecker.GetStatus() == ParChecker::psRepairPossible &&
|
||||
pPostInfo->GetNZBInfo()->GetParStatus() != NZBInfo::psFailure)
|
||||
@@ -458,7 +457,7 @@ void ParCoordinator::ParCheckCompleted()
|
||||
int iParSec = (int)(time(NULL) - m_ParChecker.GetParTime()) - iWaitTime;
|
||||
pPostInfo->GetNZBInfo()->SetParSec(pPostInfo->GetNZBInfo()->GetParSec() + iParSec);
|
||||
|
||||
pPostInfo->GetNZBInfo()->SetParFull(m_ParChecker.GetParFull());
|
||||
pPostInfo->GetNZBInfo()->SetParFull(!m_ParChecker.GetParQuick());
|
||||
|
||||
pPostInfo->SetWorking(false);
|
||||
pPostInfo->SetStage(PostInfo::ptQueued);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2013-2015 Andrey Prygunkov <hugbug@users.sourceforge.net>
|
||||
* Copyright (C) 2013-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
|
||||
@@ -72,28 +72,6 @@ bool UnpackController::FileList::Exists(const char* szFilename)
|
||||
return false;
|
||||
}
|
||||
|
||||
UnpackController::ParamList::~ParamList()
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
free(*it);
|
||||
}
|
||||
}
|
||||
|
||||
bool UnpackController::ParamList::Exists(const char* szParam)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
char* szParam1 = *it;
|
||||
if (!strcmp(szParam1, szParam))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void UnpackController::StartJob(PostInfo* pPostInfo)
|
||||
{
|
||||
UnpackController* pUnpackController = new UnpackController();
|
||||
@@ -122,13 +100,6 @@ void UnpackController::Run()
|
||||
m_szPassword[0] = '\0';
|
||||
m_szFinalDir[0] = '\0';
|
||||
m_bFinalDirCreated = false;
|
||||
m_bUnpackOK = true;
|
||||
m_bUnpackStartError = false;
|
||||
m_bUnpackSpaceError = false;
|
||||
m_bUnpackDecryptError = false;
|
||||
m_bUnpackPasswordError = false;
|
||||
m_bAutoTerminated = false;
|
||||
m_bPassListTried = false;
|
||||
|
||||
NZBParameter* pParameter = m_pPostInfo->GetNZBInfo()->GetParameters()->Find("*Unpack:", false);
|
||||
bool bUnpack = !(pParameter && !strcasecmp(pParameter->GetValue(), "no"));
|
||||
@@ -163,32 +134,32 @@ void UnpackController::Run()
|
||||
|
||||
bool bHasFiles = m_bHasRarFiles || m_bHasNonStdRarFiles || m_bHasSevenZipFiles || m_bHasSevenZipMultiFiles || m_bHasSplittedFiles;
|
||||
|
||||
if (m_pPostInfo->GetUnpackTried() && !m_pPostInfo->GetParRepaired() &&
|
||||
(!Util::EmptyStr(m_szPassword) || Util::EmptyStr(g_pOptions->GetUnpackPassFile()) || m_pPostInfo->GetPassListTried()))
|
||||
{
|
||||
PrintMessage(Message::mkError, "%s failed: second unpack attempt skipped due to par-check not repaired anything", m_szInfoNameUp);
|
||||
m_pPostInfo->GetNZBInfo()->SetUnpackStatus((NZBInfo::EUnpackStatus)m_pPostInfo->GetLastUnpackStatus());
|
||||
m_pPostInfo->SetStage(PostInfo::ptQueued);
|
||||
}
|
||||
else if (bUnpack && bHasFiles)
|
||||
if (bUnpack && bHasFiles)
|
||||
{
|
||||
m_bUnpackOK = true;
|
||||
m_bUnpackStartError = false;
|
||||
m_bUnpackSpaceError = false;
|
||||
m_bUnpackPasswordError4 = false;
|
||||
m_bUnpackPasswordError5 = false;
|
||||
m_bAutoTerminated = false;
|
||||
|
||||
PrintMessage(Message::mkInfo, "Unpacking %s", m_szName);
|
||||
|
||||
CreateUnpackDir();
|
||||
|
||||
if (m_bHasRarFiles || m_bHasNonStdRarFiles)
|
||||
{
|
||||
UnpackArchives(upUnrar, false);
|
||||
ExecuteUnrar();
|
||||
}
|
||||
|
||||
if (m_bHasSevenZipFiles && m_bUnpackOK)
|
||||
{
|
||||
UnpackArchives(upSevenZip, false);
|
||||
ExecuteSevenZip(false);
|
||||
}
|
||||
|
||||
if (m_bHasSevenZipMultiFiles && m_bUnpackOK)
|
||||
{
|
||||
UnpackArchives(upSevenZip, true);
|
||||
ExecuteSevenZip(true);
|
||||
}
|
||||
|
||||
if (m_bHasSplittedFiles && m_bUnpackOK)
|
||||
@@ -224,126 +195,36 @@ void UnpackController::Run()
|
||||
m_pPostInfo->SetWorking(false);
|
||||
}
|
||||
|
||||
void UnpackController::UnpackArchives(EUnpacker eUnpacker, bool bMultiVolumes)
|
||||
{
|
||||
if (!m_pPostInfo->GetUnpackTried() || m_pPostInfo->GetParRepaired())
|
||||
{
|
||||
ExecuteUnpack(eUnpacker, m_szPassword, bMultiVolumes);
|
||||
if (!m_bUnpackOK && m_bHasParFiles && !m_bUnpackPasswordError &&
|
||||
m_pPostInfo->GetNZBInfo()->GetParStatus() <= NZBInfo::psSkipped)
|
||||
{
|
||||
// for rar4- or 7z-archives try par-check first, before trying password file
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bUnpackOK = false;
|
||||
m_bUnpackDecryptError = m_pPostInfo->GetLastUnpackStatus() == (int)NZBInfo::usPassword;
|
||||
}
|
||||
|
||||
if (!m_bUnpackOK && !m_bUnpackStartError && !m_bUnpackSpaceError &&
|
||||
(m_bUnpackDecryptError || m_bUnpackPasswordError) &&
|
||||
(!GetTerminated() || m_bAutoTerminated) &&
|
||||
Util::EmptyStr(m_szPassword) && !Util::EmptyStr(g_pOptions->GetUnpackPassFile()))
|
||||
{
|
||||
FILE* infile = fopen(g_pOptions->GetUnpackPassFile(), FOPEN_RB);
|
||||
if (!infile)
|
||||
{
|
||||
PrintMessage(Message::mkError, "Could not open file %s", g_pOptions->GetUnpackPassFile());
|
||||
return;
|
||||
}
|
||||
|
||||
char szPassword[512];
|
||||
while (!m_bUnpackOK && !m_bUnpackStartError && !m_bUnpackSpaceError &&
|
||||
(m_bUnpackDecryptError || m_bUnpackPasswordError) &&
|
||||
fgets(szPassword, sizeof(szPassword) - 1, infile))
|
||||
{
|
||||
// trim trailing <CR> and <LF>
|
||||
char* szEnd = szPassword + strlen(szPassword) - 1;
|
||||
while (szEnd >= szPassword && (*szEnd == '\n' || *szEnd == '\r')) *szEnd-- = '\0';
|
||||
|
||||
if (!Util::EmptyStr(szPassword))
|
||||
{
|
||||
if (IsStopped() && m_bAutoTerminated)
|
||||
{
|
||||
ScriptController::Resume();
|
||||
Thread::Resume();
|
||||
}
|
||||
m_bUnpackDecryptError = false;
|
||||
m_bUnpackPasswordError = false;
|
||||
m_bAutoTerminated = false;
|
||||
PrintMessage(Message::mkInfo, "Trying password %s for %s", szPassword, m_szName);
|
||||
ExecuteUnpack(eUnpacker, szPassword, bMultiVolumes);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(infile);
|
||||
m_bPassListTried = !IsStopped() || m_bAutoTerminated;
|
||||
}
|
||||
}
|
||||
|
||||
void UnpackController::ExecuteUnpack(EUnpacker eUnpacker, const char* szPassword, bool bMultiVolumes)
|
||||
{
|
||||
switch (eUnpacker)
|
||||
{
|
||||
case upUnrar:
|
||||
ExecuteUnrar(szPassword);
|
||||
break;
|
||||
|
||||
case upSevenZip:
|
||||
ExecuteSevenZip(szPassword, bMultiVolumes);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UnpackController::ExecuteUnrar(const char* szPassword)
|
||||
void UnpackController::ExecuteUnrar()
|
||||
{
|
||||
// Format:
|
||||
// unrar x -y -p- -o+ *.rar ./_unpack/
|
||||
// unrar x -y -p- -o+ *.rar ./_unpack
|
||||
|
||||
ParamList params;
|
||||
if (!PrepareCmdParams(g_pOptions->GetUnrarCmd(), ¶ms, "unrar"))
|
||||
char szPasswordParam[1024];
|
||||
const char* szArgs[8];
|
||||
szArgs[0] = g_pOptions->GetUnrarCmd();
|
||||
szArgs[1] = "x";
|
||||
szArgs[2] = "-y";
|
||||
szArgs[3] = "-p-";
|
||||
if (strlen(m_szPassword) > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!params.Exists("x") && !params.Exists("e"))
|
||||
{
|
||||
params.push_back(strdup("x"));
|
||||
}
|
||||
|
||||
params.push_back(strdup("-y"));
|
||||
|
||||
if (!Util::EmptyStr(szPassword))
|
||||
{
|
||||
char szPasswordParam[1024];
|
||||
snprintf(szPasswordParam, 1024, "-p%s", szPassword);
|
||||
snprintf(szPasswordParam, 1024, "-p%s", m_szPassword);
|
||||
szPasswordParam[1024-1] = '\0';
|
||||
params.push_back(strdup(szPasswordParam));
|
||||
szArgs[3] = szPasswordParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
params.push_back(strdup("-p-"));
|
||||
}
|
||||
|
||||
if (!params.Exists("-o+") && !params.Exists("-o-"))
|
||||
{
|
||||
params.push_back(strdup("-o+"));
|
||||
}
|
||||
|
||||
params.push_back(strdup(m_bHasNonStdRarFiles ? "*.*" : "*.rar"));
|
||||
szArgs[4] = "-o+";
|
||||
szArgs[5] = m_bHasNonStdRarFiles ? "*.*" : "*.rar";
|
||||
|
||||
char szUnpackDirParam[1024];
|
||||
snprintf(szUnpackDirParam, 1024, "%s%c", m_szUnpackDir, PATH_SEPARATOR);
|
||||
szUnpackDirParam[1024-1] = '\0';
|
||||
params.push_back(strdup(szUnpackDirParam));
|
||||
szArgs[6] = szUnpackDirParam;
|
||||
|
||||
params.push_back(NULL);
|
||||
SetArgs((const char**)¶ms.front(), false);
|
||||
SetScript(params.at(0));
|
||||
szArgs[7] = NULL;
|
||||
SetArgs(szArgs, false);
|
||||
|
||||
SetScript(g_pOptions->GetUnrarCmd());
|
||||
SetLogPrefix("Unrar");
|
||||
ResetEnv();
|
||||
|
||||
m_bAllOKMessageReceived = false;
|
||||
m_eUnpacker = upUnrar;
|
||||
@@ -356,7 +237,7 @@ void UnpackController::ExecuteUnrar(const char* szPassword)
|
||||
m_bUnpackOK = iExitCode == 0 && m_bAllOKMessageReceived && !GetTerminated();
|
||||
m_bUnpackStartError = iExitCode == -1;
|
||||
m_bUnpackSpaceError = iExitCode == 5;
|
||||
m_bUnpackPasswordError |= iExitCode == 11; // only for rar5-archives
|
||||
m_bUnpackPasswordError5 |= iExitCode == 11; // only for rar5-archives
|
||||
|
||||
if (!m_bUnpackOK && iExitCode > 0)
|
||||
{
|
||||
@@ -364,49 +245,37 @@ void UnpackController::ExecuteUnrar(const char* szPassword)
|
||||
}
|
||||
}
|
||||
|
||||
void UnpackController::ExecuteSevenZip(const char* szPassword, bool bMultiVolumes)
|
||||
void UnpackController::ExecuteSevenZip(bool bMultiVolumes)
|
||||
{
|
||||
// Format:
|
||||
// 7z x -y -p- -o./_unpack *.7z
|
||||
// OR
|
||||
// 7z x -y -p- -o./_unpack *.7z.001
|
||||
|
||||
ParamList params;
|
||||
if (!PrepareCmdParams(g_pOptions->GetSevenZipCmd(), ¶ms, "7-Zip"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
char szPasswordParam[1024];
|
||||
const char* szArgs[7];
|
||||
szArgs[0] = g_pOptions->GetSevenZipCmd();
|
||||
szArgs[1] = "x";
|
||||
szArgs[2] = "-y";
|
||||
|
||||
if (!params.Exists("x") && !params.Exists("e"))
|
||||
szArgs[3] = "-p-";
|
||||
if (strlen(m_szPassword) > 0)
|
||||
{
|
||||
params.push_back(strdup("x"));
|
||||
}
|
||||
|
||||
params.push_back(strdup("-y"));
|
||||
|
||||
if (!Util::EmptyStr(szPassword))
|
||||
{
|
||||
char szPasswordParam[1024];
|
||||
snprintf(szPasswordParam, 1024, "-p%s", szPassword);
|
||||
snprintf(szPasswordParam, 1024, "-p%s", m_szPassword);
|
||||
szPasswordParam[1024-1] = '\0';
|
||||
params.push_back(strdup(szPasswordParam));
|
||||
}
|
||||
else
|
||||
{
|
||||
params.push_back(strdup("-p-"));
|
||||
szArgs[3] = szPasswordParam;
|
||||
}
|
||||
|
||||
char szUnpackDirParam[1024];
|
||||
snprintf(szUnpackDirParam, 1024, "-o%s", m_szUnpackDir);
|
||||
szUnpackDirParam[1024-1] = '\0';
|
||||
params.push_back(strdup(szUnpackDirParam));
|
||||
szArgs[4] = szUnpackDirParam;
|
||||
|
||||
params.push_back(strdup(bMultiVolumes ? "*.7z.001" : "*.7z"));
|
||||
szArgs[5] = bMultiVolumes ? "*.7z.001" : "*.7z";
|
||||
szArgs[6] = NULL;
|
||||
SetArgs(szArgs, false);
|
||||
|
||||
params.push_back(NULL);
|
||||
SetArgs((const char**)¶ms.front(), false);
|
||||
SetScript(params.at(0));
|
||||
ResetEnv();
|
||||
SetScript(g_pOptions->GetSevenZipCmd());
|
||||
|
||||
m_bAllOKMessageReceived = false;
|
||||
m_eUnpacker = upSevenZip;
|
||||
@@ -427,32 +296,6 @@ void UnpackController::ExecuteSevenZip(const char* szPassword, bool bMultiVolume
|
||||
}
|
||||
}
|
||||
|
||||
bool UnpackController::PrepareCmdParams(const char* szCommand, ParamList* pParams, const char* szInfoName)
|
||||
{
|
||||
if (Util::FileExists(szCommand))
|
||||
{
|
||||
pParams->push_back(strdup(szCommand));
|
||||
return true;
|
||||
}
|
||||
|
||||
char** pCmdArgs = NULL;
|
||||
if (!Util::SplitCommandLine(szCommand, &pCmdArgs))
|
||||
{
|
||||
PrintMessage(Message::mkError, "Could not start %s, failed to parse command line: %s", szInfoName, szCommand);
|
||||
m_bUnpackOK = false;
|
||||
m_bUnpackStartError = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (char** szArgPtr = pCmdArgs; *szArgPtr; szArgPtr++)
|
||||
{
|
||||
pParams->push_back(*szArgPtr);
|
||||
}
|
||||
free(pCmdArgs);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void UnpackController::JoinSplittedFiles()
|
||||
{
|
||||
SetLogPrefix("Join");
|
||||
@@ -648,13 +491,11 @@ void UnpackController::Completed()
|
||||
if (!m_bUnpackOK &&
|
||||
(m_pPostInfo->GetNZBInfo()->GetParStatus() <= NZBInfo::psSkipped ||
|
||||
!m_pPostInfo->GetNZBInfo()->GetParFull()) &&
|
||||
!m_bUnpackStartError && !m_bUnpackSpaceError && !m_bUnpackPasswordError &&
|
||||
!m_bUnpackStartError && !m_bUnpackSpaceError &&
|
||||
(!m_bUnpackPasswordError5 || m_bUnpackPasswordError4) &&
|
||||
(!GetTerminated() || m_bAutoTerminated) && m_bHasParFiles)
|
||||
{
|
||||
RequestParCheck(!Util::EmptyStr(m_szPassword) ||
|
||||
Util::EmptyStr(g_pOptions->GetUnpackPassFile()) || m_bPassListTried ||
|
||||
!(m_bUnpackDecryptError || m_bUnpackPasswordError) ||
|
||||
m_pPostInfo->GetNZBInfo()->GetParStatus() > NZBInfo::psSkipped);
|
||||
RequestParCheck(true);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -662,7 +503,8 @@ void UnpackController::Completed()
|
||||
PrintMessage(Message::mkError, "%s failed", m_szInfoNameUp);
|
||||
m_pPostInfo->GetNZBInfo()->SetUnpackStatus(
|
||||
m_bUnpackSpaceError ? NZBInfo::usSpace :
|
||||
m_bUnpackPasswordError || m_bUnpackDecryptError ? NZBInfo::usPassword :
|
||||
m_bUnpackPasswordError5 || (m_bUnpackPasswordError4 &&
|
||||
m_pPostInfo->GetNZBInfo()->GetParStatus() == NZBInfo::psSuccess) ? NZBInfo::usPassword :
|
||||
NZBInfo::usFailure);
|
||||
m_pPostInfo->SetStage(PostInfo::ptQueued);
|
||||
}
|
||||
@@ -672,15 +514,10 @@ void UnpackController::Completed()
|
||||
#ifndef DISABLE_PARCHECK
|
||||
void UnpackController::RequestParCheck(bool bForceRepair)
|
||||
{
|
||||
PrintMessage(Message::mkInfo, "%s requested %s", m_szInfoNameUp, bForceRepair ? "par-check with forced repair" : "par-check/repair");
|
||||
PrintMessage(Message::mkInfo, "%s requested par-check/repair", m_szInfoNameUp);
|
||||
m_pPostInfo->SetRequestParCheck(true);
|
||||
m_pPostInfo->SetForceRepair(bForceRepair);
|
||||
m_pPostInfo->SetStage(PostInfo::ptFinished);
|
||||
m_pPostInfo->SetUnpackTried(true);
|
||||
m_pPostInfo->SetPassListTried(m_bPassListTried);
|
||||
m_pPostInfo->SetLastUnpackStatus((int)(m_bUnpackSpaceError ? NZBInfo::usSpace :
|
||||
m_bUnpackPasswordError || m_bUnpackDecryptError ? NZBInfo::usPassword :
|
||||
NZBInfo::usFailure));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -950,7 +787,6 @@ void UnpackController::AddMessage(Message::EKind eKind, const char* szText)
|
||||
char szMsgText[1024];
|
||||
strncpy(szMsgText, szText, 1024);
|
||||
szMsgText[1024-1] = '\0';
|
||||
int iLen = strlen(szText);
|
||||
|
||||
// Modify unrar messages for better readability:
|
||||
// remove the destination path part from message "Extracting file.xxx"
|
||||
@@ -988,21 +824,16 @@ void UnpackController::AddMessage(Message::EKind eKind, const char* szText)
|
||||
(!strncmp(szText, "Unrar: Checksum error in the encrypted file", 42) ||
|
||||
!strncmp(szText, "Unrar: CRC failed in the encrypted file", 39)))
|
||||
{
|
||||
m_bUnpackDecryptError = true;
|
||||
m_bUnpackPasswordError4 = true;
|
||||
}
|
||||
|
||||
if (m_eUnpacker == upUnrar && !strncmp(szText, "Unrar: The specified password is incorrect.'", 43))
|
||||
{
|
||||
m_bUnpackPasswordError = true;
|
||||
m_bUnpackPasswordError5 = true;
|
||||
}
|
||||
|
||||
if (m_eUnpacker == upSevenZip &&
|
||||
(iLen > 18 && !strncmp(szText + iLen - 45, "Data Error in encrypted file. Wrong password?", 45)))
|
||||
{
|
||||
m_bUnpackDecryptError = true;
|
||||
}
|
||||
|
||||
if (!IsStopped() && (m_bUnpackDecryptError || m_bUnpackPasswordError ||
|
||||
int iLen = strlen(szText);
|
||||
if (m_eUnpacker == upUnrar && !IsStopped() && (m_bUnpackPasswordError4 || m_bUnpackPasswordError5 ||
|
||||
strstr(szText, " : packed data CRC failed in volume") ||
|
||||
strstr(szText, " : packed data checksum error in volume") ||
|
||||
(iLen > 13 && !strncmp(szText + iLen - 13, " - CRC failed", 13)) ||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2013-2015 Andrey Prygunkov <hugbug@users.sourceforge.net>
|
||||
* Copyright (C) 2013-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
|
||||
@@ -27,7 +27,6 @@
|
||||
#define UNPACK_H
|
||||
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
|
||||
#include "Log.h"
|
||||
#include "Thread.h"
|
||||
@@ -51,14 +50,6 @@ private:
|
||||
bool Exists(const char* szFilename);
|
||||
};
|
||||
|
||||
typedef std::vector<char*> ParamListBase;
|
||||
class ParamList : public ParamListBase
|
||||
{
|
||||
public:
|
||||
~ParamList();
|
||||
bool Exists(const char* szParam);
|
||||
};
|
||||
|
||||
private:
|
||||
PostInfo* m_pPostInfo;
|
||||
char m_szName[1024];
|
||||
@@ -80,22 +71,19 @@ private:
|
||||
bool m_bUnpackOK;
|
||||
bool m_bUnpackStartError;
|
||||
bool m_bUnpackSpaceError;
|
||||
bool m_bUnpackDecryptError;
|
||||
bool m_bUnpackPasswordError;
|
||||
bool m_bUnpackPasswordError4;
|
||||
bool m_bUnpackPasswordError5;
|
||||
bool m_bCleanedUpDisk;
|
||||
bool m_bAutoTerminated;
|
||||
EUnpacker m_eUnpacker;
|
||||
bool m_bFinalDirCreated;
|
||||
FileList m_JoinedFiles;
|
||||
bool m_bPassListTried;
|
||||
|
||||
protected:
|
||||
virtual bool ReadLine(char* szBuf, int iBufSize, FILE* pStream);
|
||||
virtual void AddMessage(Message::EKind eKind, const char* szText);
|
||||
void ExecuteUnpack(EUnpacker eUnpacker, const char* szPassword, bool bMultiVolumes);
|
||||
void ExecuteUnrar(const char* szPassword);
|
||||
void ExecuteSevenZip(const char* szPassword, bool bMultiVolumes);
|
||||
void UnpackArchives(EUnpacker eUnpacker, bool bMultiVolumes);
|
||||
void ExecuteUnrar();
|
||||
void ExecuteSevenZip(bool bMultiVolumes);
|
||||
void JoinSplittedFiles();
|
||||
bool JoinFile(const char* szFragBaseName);
|
||||
void Completed();
|
||||
@@ -107,7 +95,6 @@ protected:
|
||||
void RequestParCheck(bool bForceRepair);
|
||||
#endif
|
||||
bool FileHasRarSignature(const char* szFilename);
|
||||
bool PrepareCmdParams(const char* szCommand, ParamList* pParams, const char* szInfoName);
|
||||
|
||||
public:
|
||||
virtual void Run();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -1196,10 +1196,6 @@ PostInfo::PostInfo()
|
||||
m_bRequestParCheck = false;
|
||||
m_bForceParFull = false;
|
||||
m_bForceRepair = false;
|
||||
m_bParRepaired = false;
|
||||
m_bUnpackTried = false;
|
||||
m_bPassListTried = false;
|
||||
m_eLastUnpackStatus = 0;
|
||||
m_szProgressLabel = strdup("");
|
||||
m_iFileProgress = 0;
|
||||
m_iStageProgress = 0;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -713,10 +713,6 @@ private:
|
||||
bool m_bRequestParCheck;
|
||||
bool m_bForceParFull;
|
||||
bool m_bForceRepair;
|
||||
bool m_bParRepaired;
|
||||
bool m_bUnpackTried;
|
||||
bool m_bPassListTried;
|
||||
int m_eLastUnpackStatus;
|
||||
EStage m_eStage;
|
||||
char* m_szProgressLabel;
|
||||
int m_iFileProgress;
|
||||
@@ -757,14 +753,6 @@ public:
|
||||
void SetForceParFull(bool bForceParFull) { m_bForceParFull = bForceParFull; }
|
||||
bool GetForceRepair() { return m_bForceRepair; }
|
||||
void SetForceRepair(bool bForceRepair) { m_bForceRepair = bForceRepair; }
|
||||
bool GetParRepaired() { return m_bParRepaired; }
|
||||
void SetParRepaired(bool bParRepaired) { m_bParRepaired = bParRepaired; }
|
||||
bool GetUnpackTried() { return m_bUnpackTried; }
|
||||
void SetUnpackTried(bool bUnpackTried) { m_bUnpackTried = bUnpackTried; }
|
||||
bool GetPassListTried() { return m_bPassListTried; }
|
||||
void SetPassListTried(bool bPassListTried) { m_bPassListTried = bPassListTried; }
|
||||
int GetLastUnpackStatus() { return m_eLastUnpackStatus; }
|
||||
void SetLastUnpackStatus(int eUnpackStatus) { m_eLastUnpackStatus = eUnpackStatus; }
|
||||
Thread* GetPostThread() { return m_pPostThread; }
|
||||
void SetPostThread(Thread* pPostThread) { m_pPostThread = pPostThread; }
|
||||
void AppendMessage(Message::EKind eKind, const char* szText);
|
||||
@@ -909,7 +897,6 @@ public:
|
||||
eaGroupSetDupeKey, // set duplicate key
|
||||
eaGroupSetDupeScore, // set duplicate score
|
||||
eaGroupSetDupeMode, // set duplicate mode
|
||||
eaGroupSort, // sort groups
|
||||
eaPostDelete, // cancel post-processing
|
||||
eaHistoryDelete, // hide history-item
|
||||
eaHistoryFinalDelete, // delete history-item
|
||||
@@ -922,9 +909,7 @@ public:
|
||||
eaHistorySetDupeMode, // set duplicate mode
|
||||
eaHistorySetDupeBackup, // set duplicate backup flag
|
||||
eaHistoryMarkBad, // mark history-item as bad (and download other duplicate)
|
||||
eaHistoryMarkGood, // mark history-item as good (and push it into dup-history)
|
||||
eaHistorySetCategory, // set or change category for history-item
|
||||
eaHistorySetName // set history-item name (rename)
|
||||
eaHistoryMarkGood // mark history-item as good (and push it into dup-history)
|
||||
};
|
||||
|
||||
enum EMatchMode
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -277,8 +277,6 @@ bool HistoryCoordinator::EditList(DownloadQueue* pDownloadQueue, IDList* pIDList
|
||||
HistoryInfo* pHistoryInfo = *itHistory;
|
||||
if (pHistoryInfo->GetID() == iID)
|
||||
{
|
||||
bOK = true;
|
||||
|
||||
switch (eAction)
|
||||
{
|
||||
case DownloadQueue::eaHistoryDelete:
|
||||
@@ -296,15 +294,7 @@ bool HistoryCoordinator::EditList(DownloadQueue* pDownloadQueue, IDList* pIDList
|
||||
break;
|
||||
|
||||
case DownloadQueue::eaHistorySetParameter:
|
||||
bOK = HistorySetParameter(pHistoryInfo, szText);
|
||||
break;
|
||||
|
||||
case DownloadQueue::eaHistorySetCategory:
|
||||
bOK = HistorySetCategory(pHistoryInfo, szText);
|
||||
break;
|
||||
|
||||
case DownloadQueue::eaHistorySetName:
|
||||
bOK = HistorySetName(pHistoryInfo, szText);
|
||||
HistorySetParameter(pHistoryInfo, szText);
|
||||
break;
|
||||
|
||||
case DownloadQueue::eaHistorySetDupeKey:
|
||||
@@ -324,6 +314,7 @@ bool HistoryCoordinator::EditList(DownloadQueue* pDownloadQueue, IDList* pIDList
|
||||
break;
|
||||
}
|
||||
|
||||
bOK = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -473,26 +464,12 @@ void HistoryCoordinator::HistoryReturn(DownloadQueue* pDownloadQueue, HistoryLis
|
||||
void HistoryCoordinator::HistoryRedownload(DownloadQueue* pDownloadQueue, HistoryList::iterator itHistory,
|
||||
HistoryInfo* pHistoryInfo, bool bRestorePauseState)
|
||||
{
|
||||
if (pHistoryInfo->GetKind() == HistoryInfo::hkUrl)
|
||||
{
|
||||
HistoryReturn(pDownloadQueue, itHistory, pHistoryInfo, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pHistoryInfo->GetKind() != HistoryInfo::hkNzb)
|
||||
{
|
||||
char szNiceName[1024];
|
||||
pHistoryInfo->GetName(szNiceName, 1024);
|
||||
error("Could not return %s from history back to queue: history item has wrong type", szNiceName);
|
||||
return;
|
||||
}
|
||||
|
||||
NZBInfo* pNZBInfo = pHistoryInfo->GetNZBInfo();
|
||||
bool bPaused = bRestorePauseState && pNZBInfo->GetDeletePaused();
|
||||
|
||||
if (!Util::FileExists(pNZBInfo->GetQueuedFilename()))
|
||||
{
|
||||
error("Could not return %s from history back to queue: could not find source nzb-file %s",
|
||||
error("Could not return collection %s from history back to queue: could not find source nzb-file %s",
|
||||
pNZBInfo->GetName(), pNZBInfo->GetQueuedFilename());
|
||||
return;
|
||||
}
|
||||
@@ -500,12 +477,12 @@ void HistoryCoordinator::HistoryRedownload(DownloadQueue* pDownloadQueue, Histor
|
||||
NZBFile* pNZBFile = NZBFile::Create(pNZBInfo->GetQueuedFilename(), "");
|
||||
if (pNZBFile == NULL)
|
||||
{
|
||||
error("Could not return %s from history back to queue: could not parse nzb-file",
|
||||
error("Could not return collection %s from history back to queue: could not parse nzb-file",
|
||||
pNZBInfo->GetName());
|
||||
return;
|
||||
}
|
||||
|
||||
info("Returning %s from history back to queue", pNZBInfo->GetName());
|
||||
info("Returning collection %s from history back to queue", pNZBInfo->GetName());
|
||||
|
||||
for (FileList::iterator it = pNZBFile->GetNZBInfo()->GetFileList()->begin(); it != pNZBFile->GetNZBInfo()->GetFileList()->end(); it++)
|
||||
{
|
||||
@@ -561,7 +538,7 @@ void HistoryCoordinator::HistoryRedownload(DownloadQueue* pDownloadQueue, Histor
|
||||
g_pPrePostProcessor->NZBAdded(pDownloadQueue, pNZBInfo);
|
||||
}
|
||||
|
||||
bool HistoryCoordinator::HistorySetParameter(HistoryInfo* pHistoryInfo, const char* szText)
|
||||
void HistoryCoordinator::HistorySetParameter(HistoryInfo* pHistoryInfo, const char* szText)
|
||||
{
|
||||
char szNiceName[1024];
|
||||
pHistoryInfo->GetName(szNiceName, 1024);
|
||||
@@ -570,7 +547,7 @@ bool HistoryCoordinator::HistorySetParameter(HistoryInfo* pHistoryInfo, const ch
|
||||
if (!(pHistoryInfo->GetKind() == HistoryInfo::hkNzb || pHistoryInfo->GetKind() == HistoryInfo::hkUrl))
|
||||
{
|
||||
error("Could not set post-process-parameter for %s: history item has wrong type", szNiceName);
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
char* szStr = strdup(szText);
|
||||
@@ -588,49 +565,6 @@ bool HistoryCoordinator::HistorySetParameter(HistoryInfo* pHistoryInfo, const ch
|
||||
}
|
||||
|
||||
free(szStr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HistoryCoordinator::HistorySetCategory(HistoryInfo* pHistoryInfo, const char* szText)
|
||||
{
|
||||
char szNiceName[1024];
|
||||
pHistoryInfo->GetName(szNiceName, 1024);
|
||||
debug("Setting category '%s' for '%s'", szText, szNiceName);
|
||||
|
||||
if (!(pHistoryInfo->GetKind() == HistoryInfo::hkNzb || pHistoryInfo->GetKind() == HistoryInfo::hkUrl))
|
||||
{
|
||||
error("Could not set category for %s: history item has wrong type", szNiceName);
|
||||
return false;
|
||||
}
|
||||
|
||||
pHistoryInfo->GetNZBInfo()->SetCategory(szText);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HistoryCoordinator::HistorySetName(HistoryInfo* pHistoryInfo, const char* szText)
|
||||
{
|
||||
char szNiceName[1024];
|
||||
pHistoryInfo->GetName(szNiceName, 1024);
|
||||
debug("Setting name '%s' for '%s'", szText, szNiceName);
|
||||
|
||||
if (Util::EmptyStr(szText))
|
||||
{
|
||||
error("Could not rename %s. The new name cannot be empty", szNiceName);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pHistoryInfo->GetKind() == HistoryInfo::hkNzb || pHistoryInfo->GetKind() == HistoryInfo::hkUrl)
|
||||
{
|
||||
pHistoryInfo->GetNZBInfo()->SetName(szText);
|
||||
}
|
||||
else if (pHistoryInfo->GetKind() == HistoryInfo::hkDup)
|
||||
{
|
||||
pHistoryInfo->GetDupInfo()->SetName(szText);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void HistoryCoordinator::HistorySetDupeParam(HistoryInfo* pHistoryInfo, DownloadQueue::EEditAction eAction, const char* szText)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -34,10 +34,8 @@ private:
|
||||
void HistoryDelete(DownloadQueue* pDownloadQueue, HistoryList::iterator itHistory, HistoryInfo* pHistoryInfo, bool bFinal);
|
||||
void HistoryReturn(DownloadQueue* pDownloadQueue, HistoryList::iterator itHistory, HistoryInfo* pHistoryInfo, bool bReprocess);
|
||||
void HistoryRedownload(DownloadQueue* pDownloadQueue, HistoryList::iterator itHistory, HistoryInfo* pHistoryInfo, bool bRestorePauseState);
|
||||
bool HistorySetParameter(HistoryInfo* pHistoryInfo, const char* szText);
|
||||
void HistorySetParameter(HistoryInfo* pHistoryInfo, const char* szText);
|
||||
void HistorySetDupeParam(HistoryInfo* pHistoryInfo, DownloadQueue::EEditAction eAction, const char* szText);
|
||||
bool HistorySetCategory(HistoryInfo* pHistoryInfo, const char* szText);
|
||||
bool HistorySetName(HistoryInfo* pHistoryInfo, const char* szText);
|
||||
void HistoryTransformToDup(DownloadQueue* pDownloadQueue, HistoryInfo* pHistoryInfo, int rindex);
|
||||
void SaveQueue(DownloadQueue* pDownloadQueue);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -62,206 +62,6 @@ extern Options* g_pOptions;
|
||||
|
||||
const int MAX_ID = 1000000000;
|
||||
|
||||
|
||||
class GroupSorter
|
||||
{
|
||||
public:
|
||||
enum ESortCriteria
|
||||
{
|
||||
scName,
|
||||
scSize,
|
||||
scRemainingSize,
|
||||
scAge,
|
||||
scCategory,
|
||||
scPriority
|
||||
};
|
||||
|
||||
enum ESortOrder
|
||||
{
|
||||
soAscending,
|
||||
soDescending,
|
||||
soAuto
|
||||
};
|
||||
|
||||
private:
|
||||
NZBList* m_pNZBList;
|
||||
QueueEditor::ItemList* m_pSortItemList;
|
||||
ESortCriteria m_eSortCriteria;
|
||||
ESortOrder m_eSortOrder;
|
||||
|
||||
void AlignSelectedGroups();
|
||||
|
||||
public:
|
||||
GroupSorter(NZBList* pNZBList, QueueEditor::ItemList* pSortItemList) :
|
||||
m_pNZBList(pNZBList), m_pSortItemList(pSortItemList) {}
|
||||
bool Execute(const char* szSort);
|
||||
bool operator()(NZBInfo* pNZBInfo1, NZBInfo* pNZBInfo2) const;
|
||||
};
|
||||
|
||||
bool GroupSorter::Execute(const char* szSort)
|
||||
{
|
||||
if (!strcasecmp(szSort, "name") || !strcasecmp(szSort, "name+") || !strcasecmp(szSort, "name-"))
|
||||
{
|
||||
m_eSortCriteria = scName;
|
||||
}
|
||||
else if (!strcasecmp(szSort, "size") || !strcasecmp(szSort, "size+") || !strcasecmp(szSort, "size-"))
|
||||
{
|
||||
m_eSortCriteria = scSize;
|
||||
}
|
||||
else if (!strcasecmp(szSort, "left") || !strcasecmp(szSort, "left+") || !strcasecmp(szSort, "left-"))
|
||||
{
|
||||
m_eSortCriteria = scRemainingSize;
|
||||
}
|
||||
else if (!strcasecmp(szSort, "age") || !strcasecmp(szSort, "age+") || !strcasecmp(szSort, "age-"))
|
||||
{
|
||||
m_eSortCriteria = scAge;
|
||||
}
|
||||
else if (!strcasecmp(szSort, "category") || !strcasecmp(szSort, "category+") || !strcasecmp(szSort, "category-"))
|
||||
{
|
||||
m_eSortCriteria = scCategory;
|
||||
}
|
||||
else if (!strcasecmp(szSort, "priority") || !strcasecmp(szSort, "priority+") || !strcasecmp(szSort, "priority-"))
|
||||
{
|
||||
m_eSortCriteria = scPriority;
|
||||
}
|
||||
else
|
||||
{
|
||||
error("Could not sort groups: incorrect sort order (%s)", szSort);
|
||||
return false;
|
||||
}
|
||||
|
||||
char lastCh = szSort[strlen(szSort) - 1];
|
||||
if (lastCh == '+')
|
||||
{
|
||||
m_eSortOrder = soAscending;
|
||||
}
|
||||
else if (lastCh == '-')
|
||||
{
|
||||
m_eSortOrder = soDescending;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_eSortOrder = soAuto;
|
||||
}
|
||||
|
||||
AlignSelectedGroups();
|
||||
|
||||
NZBList tempList = *m_pNZBList;
|
||||
|
||||
ESortOrder eOrigSortOrder = m_eSortOrder;
|
||||
if (m_eSortOrder == soAuto && m_eSortCriteria == scPriority)
|
||||
{
|
||||
m_eSortOrder = soDescending;
|
||||
}
|
||||
|
||||
std::sort(m_pNZBList->begin(), m_pNZBList->end(), *this);
|
||||
|
||||
if (eOrigSortOrder == soAuto && tempList == *m_pNZBList)
|
||||
{
|
||||
m_eSortOrder = m_eSortOrder == soDescending ? soAscending : soDescending;
|
||||
std::sort(m_pNZBList->begin(), m_pNZBList->end(), *this);
|
||||
}
|
||||
|
||||
tempList.clear(); // prevent destroying of elements
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GroupSorter::operator()(NZBInfo* pNZBInfo1, NZBInfo* pNZBInfo2) const
|
||||
{
|
||||
// if list of ID is empty - sort all items
|
||||
bool bSortItem1 = m_pSortItemList->empty();
|
||||
bool bSortItem2 = m_pSortItemList->empty();
|
||||
|
||||
for (QueueEditor::ItemList::iterator it = m_pSortItemList->begin(); it != m_pSortItemList->end(); it++)
|
||||
{
|
||||
QueueEditor::EditItem* pItem = *it;
|
||||
bSortItem1 |= pItem->m_pNZBInfo == pNZBInfo1;
|
||||
bSortItem2 |= pItem->m_pNZBInfo == pNZBInfo2;
|
||||
}
|
||||
|
||||
if (!bSortItem1 || !bSortItem2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ret = false;
|
||||
|
||||
if (m_eSortOrder == soDescending)
|
||||
{
|
||||
std::swap(pNZBInfo1, pNZBInfo2);
|
||||
}
|
||||
|
||||
switch (m_eSortCriteria)
|
||||
{
|
||||
case scName:
|
||||
ret = strcmp(pNZBInfo1->GetName(), pNZBInfo2->GetName()) < 0;
|
||||
break;
|
||||
|
||||
case scSize:
|
||||
ret = pNZBInfo1->GetSize() < pNZBInfo2->GetSize();
|
||||
break;
|
||||
|
||||
case scRemainingSize:
|
||||
ret = pNZBInfo1->GetRemainingSize() - pNZBInfo1->GetPausedSize() <
|
||||
pNZBInfo2->GetRemainingSize() - pNZBInfo2->GetPausedSize();
|
||||
break;
|
||||
|
||||
case scAge:
|
||||
ret = pNZBInfo1->GetMinTime() > pNZBInfo2->GetMinTime();
|
||||
break;
|
||||
|
||||
case scCategory:
|
||||
ret = strcmp(pNZBInfo1->GetCategory(), pNZBInfo2->GetCategory()) < 0;
|
||||
break;
|
||||
|
||||
case scPriority:
|
||||
ret = pNZBInfo1->GetPriority() < pNZBInfo2->GetPriority();
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void GroupSorter::AlignSelectedGroups()
|
||||
{
|
||||
NZBInfo* pLastNZBInfo = NULL;
|
||||
unsigned int iLastNum = 0;
|
||||
unsigned int iNum = 0;
|
||||
while (iNum < m_pNZBList->size())
|
||||
{
|
||||
NZBInfo* pNZBInfo = m_pNZBList->at(iNum);
|
||||
|
||||
bool bSelected = false;
|
||||
for (QueueEditor::ItemList::iterator it = m_pSortItemList->begin(); it != m_pSortItemList->end(); it++)
|
||||
{
|
||||
QueueEditor::EditItem* pItem = *it;
|
||||
if (pItem->m_pNZBInfo == pNZBInfo)
|
||||
{
|
||||
bSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bSelected)
|
||||
{
|
||||
if (pLastNZBInfo && iNum - iLastNum > 1)
|
||||
{
|
||||
m_pNZBList->erase(m_pNZBList->begin() + iNum);
|
||||
m_pNZBList->insert(m_pNZBList->begin() + iLastNum + 1, pNZBInfo);
|
||||
iLastNum++;
|
||||
}
|
||||
else
|
||||
{
|
||||
iLastNum = iNum;
|
||||
}
|
||||
pLastNZBInfo = pNZBInfo;
|
||||
}
|
||||
iNum++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QueueEditor::EditItem::EditItem(FileInfo* pFileInfo, NZBInfo* pNZBInfo, int iOffset)
|
||||
{
|
||||
m_pFileInfo = pFileInfo;
|
||||
@@ -405,7 +205,7 @@ bool QueueEditor::EditList(DownloadQueue* pDownloadQueue, IDList* pIDList, NameL
|
||||
{
|
||||
return g_pPrePostProcessor->EditList(pDownloadQueue, pIDList, eAction, iOffset, szText);
|
||||
}
|
||||
else if (DownloadQueue::eaHistoryDelete <= eAction && eAction <= DownloadQueue::eaHistorySetName)
|
||||
else if (DownloadQueue::eaHistoryDelete <= eAction && eAction <= DownloadQueue::eaHistoryMarkGood)
|
||||
{
|
||||
return g_pHistoryCoordinator->EditList(pDownloadQueue, pIDList, eAction, iOffset, szText);
|
||||
}
|
||||
@@ -451,9 +251,6 @@ bool QueueEditor::InternEditList(ItemList* pItemList,
|
||||
case DownloadQueue::eaGroupMerge:
|
||||
return MergeGroups(pItemList);
|
||||
|
||||
case DownloadQueue::eaGroupSort:
|
||||
return SortGroups(pItemList, szText);
|
||||
|
||||
case DownloadQueue::eaFileSplit:
|
||||
return SplitGroup(pItemList, szText);
|
||||
|
||||
@@ -1187,12 +984,6 @@ bool QueueEditor::SplitGroup(ItemList* pItemList, const char* szName)
|
||||
return bOK;
|
||||
}
|
||||
|
||||
bool QueueEditor::SortGroups(ItemList* pItemList, const char* szSort)
|
||||
{
|
||||
GroupSorter sorter(m_pDownloadQueue->GetQueue(), pItemList);
|
||||
return sorter.Execute(szSort);
|
||||
}
|
||||
|
||||
void QueueEditor::ReorderFiles(ItemList* pItemList)
|
||||
{
|
||||
if (pItemList->size() == 0)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
class QueueEditor
|
||||
{
|
||||
public:
|
||||
private:
|
||||
class EditItem
|
||||
{
|
||||
public:
|
||||
@@ -45,7 +45,6 @@ public:
|
||||
|
||||
typedef std::vector<EditItem*> ItemList;
|
||||
|
||||
private:
|
||||
DownloadQueue* m_pDownloadQueue;
|
||||
|
||||
private:
|
||||
@@ -61,7 +60,6 @@ private:
|
||||
void SetNZBName(NZBInfo* pNZBInfo, const char* szName);
|
||||
bool CanCleanupDisk(NZBInfo* pNZBInfo);
|
||||
bool MergeGroups(ItemList* pItemList);
|
||||
bool SortGroups(ItemList* pItemList, const char* szSort);
|
||||
bool SplitGroup(ItemList* pItemList, const char* szName);
|
||||
bool DeleteUrl(NZBInfo* pNZBInfo, DownloadQueue::EEditAction eAction);
|
||||
void ReorderFiles(ItemList* pItemList);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2005 Bo Cordes Petersen <placebodk@sourceforge.net>
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -61,7 +61,7 @@ extern void Reload();
|
||||
const char* g_szMessageRequestNames[] =
|
||||
{ "N/A", "Download", "Pause/Unpause", "List", "Set download rate", "Dump debug",
|
||||
"Edit queue", "Log", "Quit", "Reload", "Version", "Post-queue", "Write log", "Scan",
|
||||
"Pause/Unpause postprocessor", "History" };
|
||||
"Pause/Unpause postprocessor", "History", "Download URL" };
|
||||
|
||||
const unsigned int g_iMessageRequestSizes[] =
|
||||
{ 0,
|
||||
@@ -78,118 +78,10 @@ const unsigned int g_iMessageRequestSizes[] =
|
||||
sizeof(SNZBPostQueueRequest),
|
||||
sizeof(SNZBWriteLogRequest),
|
||||
sizeof(SNZBScanRequest),
|
||||
sizeof(SNZBHistoryRequest)
|
||||
sizeof(SNZBHistoryRequest),
|
||||
sizeof(SNZBDownloadUrlRequest)
|
||||
};
|
||||
|
||||
|
||||
|
||||
class BinCommand
|
||||
{
|
||||
protected:
|
||||
Connection* m_pConnection;
|
||||
SNZBRequestBase* m_pMessageBase;
|
||||
|
||||
bool ReceiveRequest(void* pBuffer, int iSize);
|
||||
void SendBoolResponse(bool bSuccess, const char* szText);
|
||||
|
||||
public:
|
||||
virtual ~BinCommand() {}
|
||||
virtual void Execute() = 0;
|
||||
void SetConnection(Connection* pConnection) { m_pConnection = pConnection; }
|
||||
void SetMessageBase(SNZBRequestBase* pMessageBase) { m_pMessageBase = pMessageBase; }
|
||||
};
|
||||
|
||||
class DownloadBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class ListBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class LogBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class PauseUnpauseBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class EditQueueBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class SetDownloadRateBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class DumpDebugBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class ShutdownBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class ReloadBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class VersionBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class PostQueueBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class WriteLogBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class ScanBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class HistoryBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class UrlQueueBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
|
||||
//*****************************************************************
|
||||
// BinProcessor
|
||||
|
||||
@@ -290,6 +182,10 @@ void BinRpcProcessor::Dispatch()
|
||||
command = new HistoryBinCommand();
|
||||
break;
|
||||
|
||||
case eRemoteRequestDownloadUrl:
|
||||
command = new DownloadUrlBinCommand();
|
||||
break;
|
||||
|
||||
default:
|
||||
error("Received unsupported request %i", ntohl(m_MessageBase.m_iType));
|
||||
break;
|
||||
@@ -434,59 +330,30 @@ void DownloadBinCommand::Execute()
|
||||
}
|
||||
|
||||
int iBufLen = ntohl(DownloadRequest.m_iTrailingDataLength);
|
||||
char* szNZBContent = (char*)malloc(iBufLen);
|
||||
char* pRecvBuffer = (char*)malloc(iBufLen);
|
||||
|
||||
if (!m_pConnection->Recv(szNZBContent, iBufLen))
|
||||
if (!m_pConnection->Recv(pRecvBuffer, iBufLen))
|
||||
{
|
||||
error("invalid request");
|
||||
free(szNZBContent);
|
||||
free(pRecvBuffer);
|
||||
return;
|
||||
}
|
||||
|
||||
int iPriority = ntohl(DownloadRequest.m_iPriority);
|
||||
bool bAddPaused = ntohl(DownloadRequest.m_bAddPaused);
|
||||
bool bAddTop = ntohl(DownloadRequest.m_bAddFirst);
|
||||
int iDupeMode = ntohl(DownloadRequest.m_iDupeMode);
|
||||
int iDupeScore = ntohl(DownloadRequest.m_iDupeScore);
|
||||
|
||||
bool bOK = false;
|
||||
|
||||
if (!strncasecmp(szNZBContent, "http://", 6) || !strncasecmp(szNZBContent, "https://", 7))
|
||||
{
|
||||
// add url
|
||||
NZBInfo* pNZBInfo = new NZBInfo();
|
||||
pNZBInfo->SetKind(NZBInfo::nkUrl);
|
||||
pNZBInfo->SetURL(szNZBContent);
|
||||
pNZBInfo->SetFilename(DownloadRequest.m_szNZBFilename);
|
||||
pNZBInfo->SetCategory(DownloadRequest.m_szCategory);
|
||||
pNZBInfo->SetPriority(iPriority);
|
||||
pNZBInfo->SetAddUrlPaused(bAddPaused);
|
||||
pNZBInfo->SetDupeKey(DownloadRequest.m_szDupeKey);
|
||||
pNZBInfo->SetDupeScore(iDupeScore);
|
||||
pNZBInfo->SetDupeMode((EDupeMode)iDupeMode);
|
||||
|
||||
DownloadQueue* pDownloadQueue = DownloadQueue::Lock();
|
||||
pDownloadQueue->GetQueue()->Add(pNZBInfo, bAddTop);
|
||||
pDownloadQueue->Save();
|
||||
DownloadQueue::Unlock();
|
||||
|
||||
bOK = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
bOK = g_pScanner->AddExternalFile(DownloadRequest.m_szNZBFilename, DownloadRequest.m_szCategory, iPriority,
|
||||
DownloadRequest.m_szDupeKey, iDupeScore, (EDupeMode)iDupeMode, NULL, bAddTop, bAddPaused,
|
||||
NULL, NULL, szNZBContent, iBufLen, NULL) != Scanner::asFailed;
|
||||
}
|
||||
bool bOK = g_pScanner->AddExternalFile(DownloadRequest.m_szFilename, DownloadRequest.m_szCategory,
|
||||
iPriority, NULL, 0, dmScore, NULL, bAddTop, bAddPaused, NULL, NULL, pRecvBuffer, iBufLen, NULL) != Scanner::asFailed;
|
||||
|
||||
char tmp[1024];
|
||||
snprintf(tmp, 1024, bOK ? "Collection %s added to queue" : "Download Request failed for %s",
|
||||
Util::BaseFileName(DownloadRequest.m_szNZBFilename));
|
||||
Util::BaseFileName(DownloadRequest.m_szFilename));
|
||||
tmp[1024-1] = '\0';
|
||||
|
||||
SendBoolResponse(bOK, tmp);
|
||||
|
||||
free(szNZBContent);
|
||||
free(pRecvBuffer);
|
||||
}
|
||||
|
||||
void ListBinCommand::Execute()
|
||||
@@ -1105,8 +972,6 @@ void HistoryBinCommand::Execute()
|
||||
return;
|
||||
}
|
||||
|
||||
bool bShowHidden = ntohl(HistoryRequest.m_bHidden);
|
||||
|
||||
SNZBHistoryResponse HistoryResponse;
|
||||
memset(&HistoryResponse, 0, sizeof(HistoryResponse));
|
||||
HistoryResponse.m_MessageBase.m_iSignature = htonl(NZBMESSAGE_SIGNATURE);
|
||||
@@ -1120,27 +985,16 @@ void HistoryBinCommand::Execute()
|
||||
DownloadQueue* pDownloadQueue = DownloadQueue::Lock();
|
||||
|
||||
// calculate required buffer size for nzbs
|
||||
int iNrEntries = 0;
|
||||
for (HistoryList::iterator it = pDownloadQueue->GetHistory()->begin(); it != pDownloadQueue->GetHistory()->end(); it++)
|
||||
{
|
||||
HistoryInfo* pHistoryInfo = *it;
|
||||
if (pHistoryInfo->GetKind() != HistoryInfo::hkDup || bShowHidden)
|
||||
{
|
||||
iNrEntries++;
|
||||
}
|
||||
}
|
||||
int iNrEntries = pDownloadQueue->GetHistory()->size();
|
||||
bufsize += iNrEntries * sizeof(SNZBHistoryResponseEntry);
|
||||
for (HistoryList::iterator it = pDownloadQueue->GetHistory()->begin(); it != pDownloadQueue->GetHistory()->end(); it++)
|
||||
{
|
||||
HistoryInfo* pHistoryInfo = *it;
|
||||
if (pHistoryInfo->GetKind() != HistoryInfo::hkDup || bShowHidden)
|
||||
{
|
||||
char szNicename[1024];
|
||||
pHistoryInfo->GetName(szNicename, sizeof(szNicename));
|
||||
bufsize += strlen(szNicename) + 1;
|
||||
// align struct to 4-bytes, needed by ARM-processor (and may be others)
|
||||
bufsize += bufsize % 4 > 0 ? 4 - bufsize % 4 : 0;
|
||||
}
|
||||
char szNicename[1024];
|
||||
pHistoryInfo->GetName(szNicename, sizeof(szNicename));
|
||||
bufsize += strlen(szNicename) + 1;
|
||||
// align struct to 4-bytes, needed by ARM-processor (and may be others)
|
||||
bufsize += bufsize % 4 > 0 ? 4 - bufsize % 4 : 0;
|
||||
}
|
||||
|
||||
buf = (char*) malloc(bufsize);
|
||||
@@ -1150,52 +1004,41 @@ void HistoryBinCommand::Execute()
|
||||
for (HistoryList::iterator it = pDownloadQueue->GetHistory()->begin(); it != pDownloadQueue->GetHistory()->end(); it++)
|
||||
{
|
||||
HistoryInfo* pHistoryInfo = *it;
|
||||
if (pHistoryInfo->GetKind() != HistoryInfo::hkDup || bShowHidden)
|
||||
SNZBHistoryResponseEntry* pListAnswer = (SNZBHistoryResponseEntry*) bufptr;
|
||||
pListAnswer->m_iID = htonl(pHistoryInfo->GetID());
|
||||
pListAnswer->m_iKind = htonl((int)pHistoryInfo->GetKind());
|
||||
pListAnswer->m_tTime = htonl((int)pHistoryInfo->GetTime());
|
||||
|
||||
char szNicename[1024];
|
||||
pHistoryInfo->GetName(szNicename, sizeof(szNicename));
|
||||
pListAnswer->m_iNicenameLen = htonl(strlen(szNicename) + 1);
|
||||
|
||||
if (pHistoryInfo->GetKind() == HistoryInfo::hkNzb)
|
||||
{
|
||||
SNZBHistoryResponseEntry* pListAnswer = (SNZBHistoryResponseEntry*) bufptr;
|
||||
pListAnswer->m_iID = htonl(pHistoryInfo->GetID());
|
||||
pListAnswer->m_iKind = htonl((int)pHistoryInfo->GetKind());
|
||||
pListAnswer->m_tTime = htonl((int)pHistoryInfo->GetTime());
|
||||
NZBInfo* pNZBInfo = pHistoryInfo->GetNZBInfo();
|
||||
unsigned long iSizeHi, iSizeLo;
|
||||
Util::SplitInt64(pNZBInfo->GetSize(), &iSizeHi, &iSizeLo);
|
||||
pListAnswer->m_iSizeLo = htonl(iSizeLo);
|
||||
pListAnswer->m_iSizeHi = htonl(iSizeHi);
|
||||
pListAnswer->m_iFileCount = htonl(pNZBInfo->GetFileCount());
|
||||
pListAnswer->m_iParStatus = htonl(pNZBInfo->GetParStatus());
|
||||
pListAnswer->m_iScriptStatus = htonl(pNZBInfo->GetScriptStatuses()->CalcTotalStatus());
|
||||
}
|
||||
else if (pHistoryInfo->GetKind() == HistoryInfo::hkUrl)
|
||||
{
|
||||
NZBInfo* pNZBInfo = pHistoryInfo->GetNZBInfo();
|
||||
pListAnswer->m_iUrlStatus = htonl(pNZBInfo->GetUrlStatus());
|
||||
}
|
||||
|
||||
char szNicename[1024];
|
||||
pHistoryInfo->GetName(szNicename, sizeof(szNicename));
|
||||
pListAnswer->m_iNicenameLen = htonl(strlen(szNicename) + 1);
|
||||
|
||||
if (pHistoryInfo->GetKind() == HistoryInfo::hkNzb)
|
||||
{
|
||||
NZBInfo* pNZBInfo = pHistoryInfo->GetNZBInfo();
|
||||
unsigned long iSizeHi, iSizeLo;
|
||||
Util::SplitInt64(pNZBInfo->GetSize(), &iSizeHi, &iSizeLo);
|
||||
pListAnswer->m_iSizeLo = htonl(iSizeLo);
|
||||
pListAnswer->m_iSizeHi = htonl(iSizeHi);
|
||||
pListAnswer->m_iFileCount = htonl(pNZBInfo->GetFileCount());
|
||||
pListAnswer->m_iParStatus = htonl(pNZBInfo->GetParStatus());
|
||||
pListAnswer->m_iScriptStatus = htonl(pNZBInfo->GetScriptStatuses()->CalcTotalStatus());
|
||||
}
|
||||
else if (pHistoryInfo->GetKind() == HistoryInfo::hkDup && bShowHidden)
|
||||
{
|
||||
DupInfo* pDupInfo = pHistoryInfo->GetDupInfo();
|
||||
unsigned long iSizeHi, iSizeLo;
|
||||
Util::SplitInt64(pDupInfo->GetSize(), &iSizeHi, &iSizeLo);
|
||||
pListAnswer->m_iSizeLo = htonl(iSizeLo);
|
||||
pListAnswer->m_iSizeHi = htonl(iSizeHi);
|
||||
}
|
||||
else if (pHistoryInfo->GetKind() == HistoryInfo::hkUrl)
|
||||
{
|
||||
NZBInfo* pNZBInfo = pHistoryInfo->GetNZBInfo();
|
||||
pListAnswer->m_iUrlStatus = htonl(pNZBInfo->GetUrlStatus());
|
||||
}
|
||||
|
||||
bufptr += sizeof(SNZBHistoryResponseEntry);
|
||||
strcpy(bufptr, szNicename);
|
||||
bufptr += ntohl(pListAnswer->m_iNicenameLen);
|
||||
// align struct to 4-bytes, needed by ARM-processor (and may be others)
|
||||
if ((size_t)bufptr % 4 > 0)
|
||||
{
|
||||
pListAnswer->m_iNicenameLen = htonl(ntohl(pListAnswer->m_iNicenameLen) + 4 - (size_t)bufptr % 4);
|
||||
memset(bufptr, 0, 4 - (size_t)bufptr % 4); //suppress valgrind warning "uninitialized data"
|
||||
bufptr += 4 - (size_t)bufptr % 4;
|
||||
}
|
||||
bufptr += sizeof(SNZBHistoryResponseEntry);
|
||||
strcpy(bufptr, szNicename);
|
||||
bufptr += ntohl(pListAnswer->m_iNicenameLen);
|
||||
// align struct to 4-bytes, needed by ARM-processor (and may be others)
|
||||
if ((size_t)bufptr % 4 > 0)
|
||||
{
|
||||
pListAnswer->m_iNicenameLen = htonl(ntohl(pListAnswer->m_iNicenameLen) + 4 - (size_t)bufptr % 4);
|
||||
memset(bufptr, 0, 4 - (size_t)bufptr % 4); //suppress valgrind warning "uninitialized data"
|
||||
bufptr += 4 - (size_t)bufptr % 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1215,3 +1058,42 @@ void HistoryBinCommand::Execute()
|
||||
|
||||
free(buf);
|
||||
}
|
||||
|
||||
void DownloadUrlBinCommand::Execute()
|
||||
{
|
||||
SNZBDownloadUrlRequest DownloadUrlRequest;
|
||||
if (!ReceiveRequest(&DownloadUrlRequest, sizeof(DownloadUrlRequest)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
URL url(DownloadUrlRequest.m_szURL);
|
||||
if (!url.IsValid())
|
||||
{
|
||||
char tmp[1024];
|
||||
snprintf(tmp, 1024, "Url %s is not valid", DownloadUrlRequest.m_szURL);
|
||||
tmp[1024-1] = '\0';
|
||||
SendBoolResponse(true, tmp);
|
||||
return;
|
||||
}
|
||||
|
||||
NZBInfo* pNZBInfo = new NZBInfo();
|
||||
pNZBInfo->SetKind(NZBInfo::nkUrl);
|
||||
pNZBInfo->SetURL(DownloadUrlRequest.m_szURL);
|
||||
pNZBInfo->SetFilename(DownloadUrlRequest.m_szNZBFilename);
|
||||
pNZBInfo->SetCategory(DownloadUrlRequest.m_szCategory);
|
||||
pNZBInfo->SetPriority(ntohl(DownloadUrlRequest.m_iPriority));
|
||||
pNZBInfo->SetAddUrlPaused(ntohl(DownloadUrlRequest.m_bAddPaused));
|
||||
|
||||
DownloadQueue* pDownloadQueue = DownloadQueue::Lock();
|
||||
pDownloadQueue->GetQueue()->Add(pNZBInfo, ntohl(DownloadUrlRequest.m_bAddFirst));
|
||||
pDownloadQueue->Save();
|
||||
DownloadQueue::Unlock();
|
||||
|
||||
info("Request: Queue url %s", DownloadUrlRequest.m_szURL);
|
||||
|
||||
char tmp[1024];
|
||||
snprintf(tmp, 1024, "Url %s added to queue", DownloadUrlRequest.m_szURL);
|
||||
tmp[1024-1] = '\0';
|
||||
SendBoolResponse(true, tmp);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2005 Bo Cordes Petersen <placebodk@sourceforge.net>
|
||||
* Copyright (C) 2007-2015 Andrey Prygunkov <hugbug@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2009 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
|
||||
@@ -44,4 +44,116 @@ public:
|
||||
void SetConnection(Connection* pConnection) { m_pConnection = pConnection; }
|
||||
};
|
||||
|
||||
class BinCommand
|
||||
{
|
||||
protected:
|
||||
Connection* m_pConnection;
|
||||
SNZBRequestBase* m_pMessageBase;
|
||||
|
||||
bool ReceiveRequest(void* pBuffer, int iSize);
|
||||
void SendBoolResponse(bool bSuccess, const char* szText);
|
||||
|
||||
public:
|
||||
virtual ~BinCommand() {}
|
||||
virtual void Execute() = 0;
|
||||
void SetConnection(Connection* pConnection) { m_pConnection = pConnection; }
|
||||
void SetMessageBase(SNZBRequestBase* pMessageBase) { m_pMessageBase = pMessageBase; }
|
||||
};
|
||||
|
||||
class DownloadBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class ListBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class LogBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class PauseUnpauseBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class EditQueueBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class SetDownloadRateBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class DumpDebugBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class ShutdownBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class ReloadBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class VersionBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class PostQueueBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class WriteLogBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class ScanBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class HistoryBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class DownloadUrlBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
class UrlQueueBinCommand: public BinCommand
|
||||
{
|
||||
public:
|
||||
virtual void Execute();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2005 Bo Cordes Petersen <placebodk@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -27,7 +27,7 @@
|
||||
#ifndef MESSAGEBASE_H
|
||||
#define MESSAGEBASE_H
|
||||
|
||||
static const int32_t NZBMESSAGE_SIGNATURE = 0x6E7A6227; // = "nzb-XX" (protocol version)
|
||||
static const int32_t NZBMESSAGE_SIGNATURE = 0x6E7A6225; // = "nzb-XX" (protocol version)
|
||||
static const int NZBREQUESTFILENAMESIZE = 512;
|
||||
static const int NZBREQUESTPASSWORDSIZE = 32;
|
||||
|
||||
@@ -61,7 +61,8 @@ enum eRemoteRequest
|
||||
eRemoteRequestPostQueue,
|
||||
eRemoteRequestWriteLog,
|
||||
eRemoteRequestScan,
|
||||
eRemoteRequestHistory
|
||||
eRemoteRequestHistory,
|
||||
eRemoteRequestDownloadUrl
|
||||
};
|
||||
|
||||
// Possible values for field "m_iAction" of struct "SNZBPauseUnpauseRequest":
|
||||
@@ -101,14 +102,11 @@ struct SNZBResponseBase
|
||||
struct SNZBDownloadRequest
|
||||
{
|
||||
SNZBRequestBase m_MessageBase; // Must be the first in the struct
|
||||
char m_szNZBFilename[NZBREQUESTFILENAMESIZE];// Name of nzb-file. For URLs can be empty, then the filename is read from URL download response
|
||||
char m_szFilename[NZBREQUESTFILENAMESIZE]; // Name of nzb-file, may contain full path (local path on client) or only filename
|
||||
char m_szCategory[NZBREQUESTFILENAMESIZE]; // Category, can be empty
|
||||
int32_t m_bAddFirst; // 1 - add file to the top of download queue
|
||||
int32_t m_bAddPaused; // 1 - pause added files
|
||||
int32_t m_iPriority; // Priority for files (0 - default)
|
||||
int32_t m_iDupeScore; // Duplicate score
|
||||
int32_t m_iDupeMode; // Duplicate mode (EDupeMode)
|
||||
char m_szDupeKey[NZBREQUESTFILENAMESIZE]; // Duplicate key
|
||||
int32_t m_iTrailingDataLength; // Length of nzb-file in bytes
|
||||
//char m_szContent[m_iTrailingDataLength]; // variable sized
|
||||
};
|
||||
@@ -439,7 +437,6 @@ struct SNZBScanResponse
|
||||
struct SNZBHistoryRequest
|
||||
{
|
||||
SNZBRequestBase m_MessageBase; // Must be the first in the struct
|
||||
int32_t m_bHidden; // 0 - only return visible records, 1 - also return hidden records
|
||||
};
|
||||
|
||||
// history response
|
||||
@@ -456,13 +453,12 @@ struct SNZBHistoryResponse
|
||||
struct SNZBHistoryResponseEntry
|
||||
{
|
||||
int32_t m_iID; // History-ID
|
||||
int32_t m_iKind; // Kind of Item: 1 - Collection (NZB), 2 - URL, 3 - DUP (hidden record)
|
||||
int32_t m_iKind; // Kind of Item: 1 - Collection (NZB), 2 - URL
|
||||
int32_t m_tTime; // When the item was added to history. time since the Epoch (00:00:00 UTC, January 1, 1970), measured in seconds.
|
||||
int32_t m_iNicenameLen; // Length of Nicename-string (m_szNicename), following to this record
|
||||
// for Collection and Dup items (m_iKind = 1 or 2)
|
||||
// for Collection items (m_iKind = 1)
|
||||
int32_t m_iSizeLo; // Size of all files in bytes, Low 32-bits of 64-bit value
|
||||
int32_t m_iSizeHi; // Size of all files in bytes, High 32-bits of 64-bit value
|
||||
// for Collection items (m_iKind = 1)
|
||||
int32_t m_iFileCount; // Initial number of files included in NZB-file
|
||||
int32_t m_iParStatus; // See NZBInfo::EParStatus
|
||||
int32_t m_iScriptStatus; // See NZBInfo::EScriptStatus
|
||||
@@ -472,4 +468,25 @@ struct SNZBHistoryResponseEntry
|
||||
//char m_szNicename[m_iNicenameLen]; // variable sized
|
||||
};
|
||||
|
||||
// download url request
|
||||
struct SNZBDownloadUrlRequest
|
||||
{
|
||||
SNZBRequestBase m_MessageBase; // Must be the first in the struct
|
||||
char m_szURL[NZBREQUESTFILENAMESIZE]; // url to nzb-file
|
||||
char m_szNZBFilename[NZBREQUESTFILENAMESIZE];// Name of nzb-file. Can be empty, then the filename is read from URL download response
|
||||
char m_szCategory[NZBREQUESTFILENAMESIZE]; // Category, can be empty
|
||||
int32_t m_bAddFirst; // 1 - add url to the top of download queue
|
||||
int32_t m_bAddPaused; // 1 - pause added files
|
||||
int32_t m_iPriority; // Priority for files (0 - default)
|
||||
};
|
||||
|
||||
// download url response
|
||||
struct SNZBDownloadUrlResponse
|
||||
{
|
||||
SNZBResponseBase m_MessageBase; // Must be the first in the struct
|
||||
int32_t m_bSuccess; // 0 - command failed, 1 - command executed successfully
|
||||
int32_t m_iTrailingDataLength; // Length of Text-string (m_szText), following to this record
|
||||
//char m_szText[m_iTrailingDataLength]; // variable sized
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2005 Bo Cordes Petersen <placebodk@sourceforge.net>
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -159,26 +159,15 @@ bool RemoteClient::ReceiveBoolResponse()
|
||||
/*
|
||||
* Sends a message to the running nzbget process.
|
||||
*/
|
||||
bool RemoteClient::RequestServerDownload(const char* szNZBFilename, const char* szNZBContent,
|
||||
const char* szCategory, bool bAddFirst, bool bAddPaused, int iPriority,
|
||||
const char* szDupeKey, int iDupeMode, int iDupeScore)
|
||||
bool RemoteClient::RequestServerDownload(const char* szFilename, const char* szCategory, bool bAddFirst, bool bAddPaused, int iPriority)
|
||||
{
|
||||
// Read the file into the buffer
|
||||
char* szBuffer = NULL;
|
||||
int iLength = 0;
|
||||
bool bIsUrl = !strncasecmp(szNZBContent, "http://", 6) || !strncasecmp(szNZBContent, "https://", 7);
|
||||
if (bIsUrl)
|
||||
char* szBuffer = NULL;
|
||||
int iLength = 0;
|
||||
if (!Util::LoadFileIntoBuffer(szFilename, &szBuffer, &iLength))
|
||||
{
|
||||
iLength = strlen(szNZBContent) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Util::LoadFileIntoBuffer(szNZBContent, &szBuffer, &iLength))
|
||||
{
|
||||
printf("Could not load file %s\n", szNZBContent);
|
||||
return false;
|
||||
}
|
||||
iLength--;
|
||||
printf("Could not load file %s\n", szFilename);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OK = InitConnection();
|
||||
@@ -189,21 +178,10 @@ bool RemoteClient::RequestServerDownload(const char* szNZBFilename, const char*
|
||||
DownloadRequest.m_bAddFirst = htonl(bAddFirst);
|
||||
DownloadRequest.m_bAddPaused = htonl(bAddPaused);
|
||||
DownloadRequest.m_iPriority = htonl(iPriority);
|
||||
DownloadRequest.m_iDupeMode = htonl(iDupeMode);
|
||||
DownloadRequest.m_iDupeScore = htonl(iDupeScore);
|
||||
DownloadRequest.m_iTrailingDataLength = htonl(iLength);
|
||||
|
||||
DownloadRequest.m_szNZBFilename[0] = '\0';
|
||||
if (!Util::EmptyStr(szNZBFilename))
|
||||
{
|
||||
strncpy(DownloadRequest.m_szNZBFilename, szNZBFilename, NZBREQUESTFILENAMESIZE - 1);
|
||||
}
|
||||
else if (!bIsUrl)
|
||||
{
|
||||
strncpy(DownloadRequest.m_szNZBFilename, szNZBContent, NZBREQUESTFILENAMESIZE - 1);
|
||||
}
|
||||
DownloadRequest.m_szNZBFilename[NZBREQUESTFILENAMESIZE-1] = '\0';
|
||||
DownloadRequest.m_iTrailingDataLength = htonl(iLength - 1);
|
||||
|
||||
strncpy(DownloadRequest.m_szFilename, szFilename, NZBREQUESTFILENAMESIZE - 1);
|
||||
DownloadRequest.m_szFilename[NZBREQUESTFILENAMESIZE-1] = '\0';
|
||||
DownloadRequest.m_szCategory[0] = '\0';
|
||||
if (szCategory)
|
||||
{
|
||||
@@ -211,13 +189,6 @@ bool RemoteClient::RequestServerDownload(const char* szNZBFilename, const char*
|
||||
}
|
||||
DownloadRequest.m_szCategory[NZBREQUESTFILENAMESIZE-1] = '\0';
|
||||
|
||||
DownloadRequest.m_szDupeKey[0] = '\0';
|
||||
if (!Util::EmptyStr(szDupeKey))
|
||||
{
|
||||
strncpy(DownloadRequest.m_szDupeKey, szDupeKey, NZBREQUESTFILENAMESIZE - 1);
|
||||
}
|
||||
DownloadRequest.m_szDupeKey[NZBREQUESTFILENAMESIZE-1] = '\0';
|
||||
|
||||
if (!m_pConnection->Send((char*)(&DownloadRequest), sizeof(DownloadRequest)))
|
||||
{
|
||||
perror("m_pConnection->Send");
|
||||
@@ -225,7 +196,7 @@ bool RemoteClient::RequestServerDownload(const char* szNZBFilename, const char*
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pConnection->Send(bIsUrl ? szNZBContent : szBuffer, iLength);
|
||||
m_pConnection->Send(szBuffer, iLength);
|
||||
OK = ReceiveBoolResponse();
|
||||
m_pConnection->Disconnect();
|
||||
}
|
||||
@@ -1116,13 +1087,12 @@ bool RemoteClient::RequestScan(bool bSyncMode)
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool RemoteClient::RequestHistory(bool bWithHidden)
|
||||
bool RemoteClient::RequestHistory()
|
||||
{
|
||||
if (!InitConnection()) return false;
|
||||
|
||||
SNZBHistoryRequest HistoryRequest;
|
||||
InitMessageBase(&HistoryRequest.m_MessageBase, eRemoteRequestHistory, sizeof(HistoryRequest));
|
||||
HistoryRequest.m_bHidden = htonl(bWithHidden);
|
||||
|
||||
if (!m_pConnection->Send((char*)(&HistoryRequest), sizeof(HistoryRequest)))
|
||||
{
|
||||
@@ -1173,12 +1143,8 @@ bool RemoteClient::RequestHistory(bool bWithHidden)
|
||||
HistoryInfo::EKind eKind = (HistoryInfo::EKind)ntohl(pListAnswer->m_iKind);
|
||||
const char* szNicename = pBufPtr + sizeof(SNZBHistoryResponseEntry);
|
||||
|
||||
if (eKind == HistoryInfo::hkNzb || eKind == HistoryInfo::hkDup)
|
||||
if (eKind == HistoryInfo::hkNzb)
|
||||
{
|
||||
char szFiles[20];
|
||||
snprintf(szFiles, sizeof(szFiles), "%i files, ", ntohl(pListAnswer->m_iFileCount));
|
||||
szFiles[20 - 1] = '\0';
|
||||
|
||||
long long lSize = Util::JoinInt64(ntohl(pListAnswer->m_iSizeHi), ntohl(pListAnswer->m_iSizeLo));
|
||||
|
||||
char szSize[20];
|
||||
@@ -1186,14 +1152,11 @@ bool RemoteClient::RequestHistory(bool bWithHidden)
|
||||
|
||||
const char* szParStatusText[] = { "", "", ", Par failed", ", Par successful", ", Repair possible", ", Repair needed" };
|
||||
const char* szScriptStatusText[] = { "", ", Script status unknown", ", Script failed", ", Script successful" };
|
||||
int iParStatus = ntohl(pListAnswer->m_iParStatus);
|
||||
int iScriptStatus = ntohl(pListAnswer->m_iScriptStatus);
|
||||
|
||||
printf("[%i] %s (%s%s%s%s%s)\n", ntohl(pListAnswer->m_iID), szNicename,
|
||||
(eKind == HistoryInfo::hkDup ? "Hidden, " : ""),
|
||||
(eKind == HistoryInfo::hkDup ? "" : szFiles), szSize,
|
||||
(eKind == HistoryInfo::hkDup ? "" : szParStatusText[iParStatus]),
|
||||
(eKind == HistoryInfo::hkDup ? "" : szScriptStatusText[iScriptStatus]));
|
||||
printf("[%i] %s (%i files, %s%s%s)\n", ntohl(pListAnswer->m_iID), szNicename,
|
||||
ntohl(pListAnswer->m_iFileCount), szSize,
|
||||
szParStatusText[ntohl(pListAnswer->m_iParStatus)],
|
||||
szScriptStatusText[ntohl(pListAnswer->m_iScriptStatus)]);
|
||||
}
|
||||
else if (eKind == HistoryInfo::hkUrl)
|
||||
{
|
||||
@@ -1214,3 +1177,44 @@ bool RemoteClient::RequestHistory(bool bWithHidden)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RemoteClient::RequestServerDownloadUrl(const char* szURL, const char* szNZBFilename, const char* szCategory, bool bAddFirst, bool bAddPaused, int iPriority)
|
||||
{
|
||||
if (!InitConnection()) return false;
|
||||
|
||||
SNZBDownloadUrlRequest DownloadUrlRequest;
|
||||
InitMessageBase(&DownloadUrlRequest.m_MessageBase, eRemoteRequestDownloadUrl, sizeof(DownloadUrlRequest));
|
||||
DownloadUrlRequest.m_bAddFirst = htonl(bAddFirst);
|
||||
DownloadUrlRequest.m_bAddPaused = htonl(bAddPaused);
|
||||
DownloadUrlRequest.m_iPriority = htonl(iPriority);
|
||||
|
||||
strncpy(DownloadUrlRequest.m_szURL, szURL, NZBREQUESTFILENAMESIZE - 1);
|
||||
DownloadUrlRequest.m_szURL[NZBREQUESTFILENAMESIZE-1] = '\0';
|
||||
|
||||
DownloadUrlRequest.m_szCategory[0] = '\0';
|
||||
if (szCategory)
|
||||
{
|
||||
strncpy(DownloadUrlRequest.m_szCategory, szCategory, NZBREQUESTFILENAMESIZE - 1);
|
||||
}
|
||||
DownloadUrlRequest.m_szCategory[NZBREQUESTFILENAMESIZE-1] = '\0';
|
||||
|
||||
DownloadUrlRequest.m_szNZBFilename[0] = '\0';
|
||||
if (szNZBFilename)
|
||||
{
|
||||
strncpy(DownloadUrlRequest.m_szNZBFilename, szNZBFilename, NZBREQUESTFILENAMESIZE - 1);
|
||||
}
|
||||
DownloadUrlRequest.m_szNZBFilename[NZBREQUESTFILENAMESIZE-1] = '\0';
|
||||
|
||||
bool OK = m_pConnection->Send((char*)(&DownloadUrlRequest), sizeof(DownloadUrlRequest));
|
||||
if (OK)
|
||||
{
|
||||
OK = ReceiveBoolResponse();
|
||||
}
|
||||
else
|
||||
{
|
||||
perror("m_pConnection->Send");
|
||||
}
|
||||
|
||||
m_pConnection->Disconnect();
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2005 Bo Cordes Petersen <placebodk@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -60,9 +60,7 @@ public:
|
||||
RemoteClient();
|
||||
~RemoteClient();
|
||||
void SetVerbose(bool bVerbose) { m_bVerbose = bVerbose; };
|
||||
bool RequestServerDownload(const char* szNZBFilename, const char* szNZBContent, const char* szCategory,
|
||||
bool bAddFirst, bool bAddPaused, int iPriority,
|
||||
const char* szDupeKey, int iDupeMode, int iDupeScore);
|
||||
bool RequestServerDownload(const char* szFilename, const char* szCategory, bool bAddFirst, bool bAddPaused, int iPriority);
|
||||
bool RequestServerList(bool bFiles, bool bGroups, const char* szPattern);
|
||||
bool RequestServerPauseUnpause(bool bPause, eRemotePauseUnpauseAction iAction);
|
||||
bool RequestServerSetDownloadRate(int iRate);
|
||||
@@ -76,7 +74,8 @@ public:
|
||||
bool RequestPostQueue();
|
||||
bool RequestWriteLog(int iKind, const char* szText);
|
||||
bool RequestScan(bool bSyncMode);
|
||||
bool RequestHistory(bool bWithHidden);
|
||||
bool RequestHistory();
|
||||
bool RequestServerDownloadUrl(const char* szURL, const char* szNZBFilename, const char* szCategory, bool bAddFirst, bool bAddPaused, int iPriority);
|
||||
void BuildFileList(SNZBListResponse* pListResponse, const char* pTrailingData, DownloadQueue* pDownloadQueue);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -2101,7 +2101,6 @@ EditCommandEntry EditCommandNameMap[] = {
|
||||
{ DownloadQueue::eaGroupSetDupeKey, "GroupSetDupeKey" },
|
||||
{ DownloadQueue::eaGroupSetDupeScore, "GroupSetDupeScore" },
|
||||
{ DownloadQueue::eaGroupSetDupeMode, "GroupSetDupeMode" },
|
||||
{ DownloadQueue::eaGroupSort, "GroupSort" },
|
||||
{ DownloadQueue::eaPostDelete, "PostDelete" },
|
||||
{ DownloadQueue::eaHistoryDelete, "HistoryDelete" },
|
||||
{ DownloadQueue::eaHistoryFinalDelete, "HistoryFinalDelete" },
|
||||
@@ -2115,8 +2114,6 @@ EditCommandEntry EditCommandNameMap[] = {
|
||||
{ DownloadQueue::eaHistorySetDupeBackup, "HistorySetDupeBackup" },
|
||||
{ DownloadQueue::eaHistoryMarkBad, "HistoryMarkBad" },
|
||||
{ DownloadQueue::eaHistoryMarkGood, "HistoryMarkGood" },
|
||||
{ DownloadQueue::eaHistorySetCategory, "HistorySetCategory" },
|
||||
{ DownloadQueue::eaHistorySetName, "HistorySetName" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -637,12 +637,6 @@ void ScriptController::Terminate()
|
||||
// wait 60 seconds for process to terminate
|
||||
WaitForSingleObject(m_hProcess, 60 * 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD dExitCode = 0;
|
||||
GetExitCodeProcess(m_hProcess, &dExitCode);
|
||||
bOK = dExitCode != STILL_ACTIVE;
|
||||
}
|
||||
#else
|
||||
pid_t hKillProcess = m_hProcess;
|
||||
if (getpgid(hKillProcess) == hKillProcess)
|
||||
@@ -688,12 +682,6 @@ void ScriptController::Detach()
|
||||
fclose(pReadpipe);
|
||||
}
|
||||
|
||||
void ScriptController::Resume()
|
||||
{
|
||||
m_bTerminated = false;
|
||||
m_bDetached = false;
|
||||
m_hProcess = 0;
|
||||
}
|
||||
|
||||
bool ScriptController::ReadLine(char* szBuf, int iBufSize, FILE* pStream)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -92,7 +92,6 @@ public:
|
||||
virtual ~ScriptController();
|
||||
int Execute();
|
||||
void Terminate();
|
||||
void Resume();
|
||||
void Detach();
|
||||
static void TerminateAll();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2015 Andrey Prygunkov <hugbug@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 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
|
||||
@@ -215,13 +215,6 @@ void Thread::Stop()
|
||||
m_bStopped = true;
|
||||
}
|
||||
|
||||
void Thread::Resume()
|
||||
{
|
||||
debug("Resuming Thread");
|
||||
|
||||
m_bStopped = false;
|
||||
}
|
||||
|
||||
bool Thread::Kill()
|
||||
{
|
||||
debug("Killing Thread");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2015 Andrey Prygunkov <hugbug@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 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
|
||||
@@ -81,7 +81,6 @@ public:
|
||||
|
||||
virtual void Start();
|
||||
virtual void Stop();
|
||||
virtual void Resume();
|
||||
bool Kill();
|
||||
|
||||
bool IsStopped() { return m_bStopped; };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -260,14 +260,6 @@ StringBuilder::~StringBuilder()
|
||||
free(m_szBuffer);
|
||||
}
|
||||
|
||||
void StringBuilder::Clear()
|
||||
{
|
||||
free(m_szBuffer);
|
||||
m_szBuffer = NULL;
|
||||
m_iBufferSize = 0;
|
||||
m_iUsedSize = 0;
|
||||
}
|
||||
|
||||
void StringBuilder::Append(const char* szStr)
|
||||
{
|
||||
int iPartLen = strlen(szStr);
|
||||
@@ -1022,14 +1014,6 @@ bool Util::MatchFileExt(const char* szFilename, const char* szExtensionList, con
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (strchr(szExt, '*') || strchr(szExt, '?'))
|
||||
{
|
||||
WildMask mask(szExt);
|
||||
if (mask.Match(szFilename))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1056,28 +1040,6 @@ char* Util::GetLastErrorMessage(char* szBuffer, int iBufLen)
|
||||
return szBuffer;
|
||||
}
|
||||
|
||||
void Util::FormatSpeed(int iBytesPerSecond, char* szBuffer, int iBufSize)
|
||||
{
|
||||
if (iBytesPerSecond >= 100 * 1024 * 1024)
|
||||
{
|
||||
snprintf(szBuffer, iBufSize, "%i MB/s", iBytesPerSecond / 1024 / 1024);
|
||||
}
|
||||
else if (iBytesPerSecond >= 10 * 1024 * 1024)
|
||||
{
|
||||
snprintf(szBuffer, iBufSize, "%0.1f MB/s", (float)iBytesPerSecond / 1024.0 / 1024.0);
|
||||
}
|
||||
else if (iBytesPerSecond >= 1024 * 1000)
|
||||
{
|
||||
snprintf(szBuffer, iBufSize, "%0.2f MB/s", (float)iBytesPerSecond / 1024.0 / 1024.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(szBuffer, iBufSize, "%i KB/s", iBytesPerSecond / 1024);
|
||||
}
|
||||
|
||||
szBuffer[iBufSize - 1] = '\0';
|
||||
}
|
||||
|
||||
void Util::InitVersionRevision()
|
||||
{
|
||||
#ifndef WIN32
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -77,7 +77,6 @@ public:
|
||||
~StringBuilder();
|
||||
void Append(const char* szStr);
|
||||
const char* GetBuffer() { return m_szBuffer; }
|
||||
void Clear();
|
||||
};
|
||||
|
||||
class Util
|
||||
@@ -114,7 +113,6 @@ public:
|
||||
static bool SameFilename(const char* szFilename1, const char* szFilename2);
|
||||
static bool MatchFileExt(const char* szFilename, const char* szExtensionList, const char* szListSeparator);
|
||||
static char* GetLastErrorMessage(char* szBuffer, int iBufLen);
|
||||
static void FormatSpeed(int iBytesPerSecond, char* szBuffer, int iBufSize);
|
||||
|
||||
/*
|
||||
* Split command line int arguments.
|
||||
|
||||
@@ -201,24 +201,3 @@ void InstallUninstallServiceCheck(int argc, char *argv[])
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
bool IsServiceRunning()
|
||||
{
|
||||
SC_HANDLE scm = OpenSCManager(0, 0, 0);
|
||||
if (!scm)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SC_HANDLE hService = OpenService(scm, "NZBGet", SERVICE_QUERY_STATUS);
|
||||
SERVICE_STATUS ServiceStatus;
|
||||
bool bRunning = false;
|
||||
if (hService && QueryServiceStatus(hService, &ServiceStatus))
|
||||
{
|
||||
bRunning = ServiceStatus.dwCurrentState != SERVICE_STOPPED;
|
||||
}
|
||||
|
||||
CloseServiceHandle(scm);
|
||||
|
||||
return bRunning;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2007-2014 Andrey Prygunkov <hugbug@users.sourceforge.net>
|
||||
* Copyright (C) 2007 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
|
||||
@@ -30,6 +30,5 @@ typedef void (*RunProc)(void);
|
||||
|
||||
void InstallUninstallServiceCheck(int argc, char *argv[]);
|
||||
void StartService(RunProc RunProcPtr);
|
||||
bool IsServiceRunning();
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef WINCONSOLE_H
|
||||
#define WINCONSOLE_H
|
||||
|
||||
#include "Thread.h"
|
||||
|
||||
class WinConsole : public Thread
|
||||
{
|
||||
private:
|
||||
bool m_bAppMode;
|
||||
char** m_pDefaultArguments;
|
||||
char** m_pInitialArguments;
|
||||
int m_iInitialArgumentCount;
|
||||
HWND m_hTrayWindow;
|
||||
NOTIFYICONDATA* m_pNidIcon;
|
||||
UINT UM_TASKBARCREATED;
|
||||
HMENU m_hMenu;
|
||||
HINSTANCE m_hInstance;
|
||||
bool m_bModal;
|
||||
HFONT m_hLinkFont;
|
||||
HFONT m_hNameFont;
|
||||
HFONT m_hTitleFont;
|
||||
HCURSOR m_hHandCursor;
|
||||
HICON m_hAboutIcon;
|
||||
HICON m_hRunningIcon;
|
||||
HICON m_hIdleIcon;
|
||||
HICON m_hWorkingIcon;
|
||||
HICON m_hPausedIcon;
|
||||
bool m_bAutostart;
|
||||
bool m_bTray;
|
||||
bool m_bConsole;
|
||||
bool m_bWebUI;
|
||||
bool m_bAutoParam;
|
||||
bool m_bRunning;
|
||||
bool m_bRunningService;
|
||||
|
||||
void CreateResources();
|
||||
void CreateTrayIcon();
|
||||
void ShowWebUI();
|
||||
void ShowMenu();
|
||||
void ShowInExplorer(const char* szFileName);
|
||||
void ShowAboutBox();
|
||||
void OpenConfigFileInTextEdit();
|
||||
void ShowPrefsDialog();
|
||||
void SavePrefs();
|
||||
void LoadPrefs();
|
||||
void ApplyPrefs();
|
||||
void ShowRunningDialog();
|
||||
void CheckRunning();
|
||||
void UpdateTrayIcon();
|
||||
void BuildMenu();
|
||||
void ShowCategoryDir(int iCatIndex);
|
||||
void SetupConfigFile();
|
||||
void SetupScripts();
|
||||
|
||||
static BOOL WINAPI ConsoleCtrlHandler(DWORD dwCtrlType);
|
||||
static LRESULT CALLBACK TrayWndProcStat(HWND hwndWin, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT TrayWndProc(HWND hwndWin, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static BOOL CALLBACK AboutDialogProcStat(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
BOOL AboutDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static BOOL CALLBACK PrefsDialogProcStat(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
BOOL PrefsDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static BOOL CALLBACK RunningDialogProcStat(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
BOOL RunningDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
protected:
|
||||
virtual void Run();
|
||||
|
||||
public:
|
||||
WinConsole();
|
||||
~WinConsole();
|
||||
virtual void Stop();
|
||||
void InitAppMode();
|
||||
bool GetAppMode() { return m_bAppMode; }
|
||||
void SetupFirstStart();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -71,7 +71,7 @@
|
||||
/* Define to 1 if spinlocks are supported */
|
||||
#define HAVE_SPINLOCK
|
||||
|
||||
#define VERSION "15.0-testing"
|
||||
#define VERSION "14.2"
|
||||
|
||||
/* Suppress warnings */
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
@@ -81,11 +81,6 @@
|
||||
|
||||
#define _USE_32BIT_TIME_T
|
||||
|
||||
#if _WIN32_WINNT < 0x0501
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
// detection of memory leaks
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
|
||||
108
nzbget.conf
108
nzbget.conf
@@ -196,16 +196,6 @@ Server1.Cipher=
|
||||
# Maximum number of simultaneous connections to this server (0-999).
|
||||
Server1.Connections=4
|
||||
|
||||
# Server retention time (days).
|
||||
#
|
||||
# How long the articles are stored on the news server. The articles
|
||||
# whose age exceed the defined server retention time are not tried on
|
||||
# this news server, the articles are instead considered failed on this
|
||||
# news server.
|
||||
#
|
||||
# Value "0" disables retention check.
|
||||
Server1.Retention=0
|
||||
|
||||
# Second server, on level 0.
|
||||
|
||||
#Server2.Level=0
|
||||
@@ -717,29 +707,27 @@ CrcCheck=yes
|
||||
|
||||
# How many retries should be attempted if a download error occurs (0-99).
|
||||
#
|
||||
# If download fails because of incomplete or damaged article or due to
|
||||
# CRC-error the program tries to redownload the article from the same
|
||||
# news server as many times as defined in option <Retries>. If all
|
||||
# 1) If download fails because of "article or group not found error" the
|
||||
# program tries another news server.
|
||||
#
|
||||
# 2) If download fails because of interrupted connection, the program
|
||||
# tries the same server again until connection can be established.
|
||||
#
|
||||
# In both cases 1) and 2) option <Retries> is not used.
|
||||
#
|
||||
# If download however fails because of incomplete article, CRC-error or other
|
||||
# error not mentioned above the program tries to redownload the article from
|
||||
# the same news server as many times as defined in option <Retries>. If all
|
||||
# attempts fail the program tries another news server.
|
||||
#
|
||||
# If download fails because of "article or group not found error" the
|
||||
# program tries another news server without retrying on the failed server.
|
||||
#
|
||||
# If download fails because of interrupted connection the program
|
||||
# tries another news server or the same server after the block interval
|
||||
# expires.
|
||||
Retries=3
|
||||
|
||||
# Wait interval between retries (seconds).
|
||||
#
|
||||
# If download of an article fails because of interrupted connection
|
||||
# the server is temporary blocked until the retry interval expires.
|
||||
# Set the interval between retries (seconds).
|
||||
RetryInterval=10
|
||||
|
||||
# Connection timeout for article downloading (seconds).
|
||||
# Set connection timeout for article downloading (seconds).
|
||||
ArticleTimeout=60
|
||||
|
||||
# Connection timeout for URL fetching (seconds).
|
||||
# Set connection timeout for URL fetching (seconds).
|
||||
#
|
||||
# This includes fetching of nzb-files via URLs and fetching of RSS feeds.
|
||||
UrlTimeout=60
|
||||
@@ -1160,10 +1148,9 @@ ParThreads=0
|
||||
|
||||
# Files to ignore during par-check.
|
||||
#
|
||||
# List of file extensions, file names or file masks to ignore by
|
||||
# par-rename and par-check. The entries must be separated with
|
||||
# commas. The entries can be file extensions, any text the file name
|
||||
# may end with or file masks containing wildcard characters * and ?.
|
||||
# List of file extensions or file names to ignore by par-rename and
|
||||
# par-check. The entries must be separated with commas. The entries
|
||||
# can be file extensions or any text the file name may end with.
|
||||
#
|
||||
# If par-rename or par-check detect missing or damaged files they
|
||||
# will ignore files matching this option and will not initiate
|
||||
@@ -1225,6 +1212,20 @@ ParPauseQueue=no
|
||||
# from download queue after successful check/repair.
|
||||
ParCleanupQueue=yes
|
||||
|
||||
# Files to delete after successful check/repair.
|
||||
#
|
||||
# List of file extensions or file names to delete after successful
|
||||
# download. The entries must be separated with commas. The entries
|
||||
# can be file extensions or any text the file name may end with.
|
||||
#
|
||||
# Files or extensions listed here are also ignored by par-rename
|
||||
# and par-check.
|
||||
#
|
||||
# NOTE: See also option <ParIgnoreExt>.
|
||||
#
|
||||
# Example: .par2, .sfv
|
||||
ExtCleanupDisk=.par2, .sfv, _brokenlog.txt
|
||||
|
||||
|
||||
##############################################################################
|
||||
### UNPACK ###
|
||||
@@ -1261,24 +1262,6 @@ UnpackCleanupDisk=yes
|
||||
#
|
||||
# Example: /usr/bin/unrar.
|
||||
#
|
||||
# The option can also contain extra switches to pass to unrar. To the
|
||||
# here defined command line NZBGet adds the following switches:
|
||||
# x -y -p- -o+ *.rar ./_unpack/
|
||||
#
|
||||
# Switch "x" is added only if neither "x" nor "e" were defined in
|
||||
# the option (this allows you to use switch "e" instead of "x"). switch
|
||||
# "-o+" is added only if neither "-o+" nor "-o-" were defined
|
||||
# in the command line. All other paramaters are always added. Parameter
|
||||
# "-p-" is replaced with "-ppassword" if a password is set for nzb-file.
|
||||
#
|
||||
# Examples:
|
||||
# 1) ignore file attributes (pemissions):
|
||||
# /usr/bin/unrar x -ai;
|
||||
# 2) decrease priority of unrar-process:
|
||||
# nice -n 19 unrar.
|
||||
#
|
||||
# For other useful switches refer to unrar documentation.
|
||||
#
|
||||
# If unrar is in your PATH you may leave the path part and set only
|
||||
# the executable name ("unrar" on POSIX or "unrar.exe" on Windows).
|
||||
UnrarCmd=unrar
|
||||
@@ -1287,39 +1270,10 @@ UnrarCmd=unrar
|
||||
#
|
||||
# Example: /usr/bin/7z.
|
||||
#
|
||||
# Similar to option <UnrarCmd> this option can also include extra switches.
|
||||
#
|
||||
# If 7-Zip binary is in your PATH you may leave the path part and set only
|
||||
# the executable name ("7z" or "7za" on POSIX or "7z.exe" on Windows).
|
||||
SevenZipCmd=7z
|
||||
|
||||
# Files to delete after successful download.
|
||||
#
|
||||
# List of file extensions, file names or file masks to delete after
|
||||
# successful unpack or successful par-check (if the unpack was not
|
||||
# performed). The entries must be separated with commas. The
|
||||
# entries can be file extensions, any text the file name may end with
|
||||
# or file masks containing wildcard characters * and ?.
|
||||
#
|
||||
# Files listed here are also ignored by par-rename and par-check.
|
||||
#
|
||||
# NOTE: See also option <ParIgnoreExt>.
|
||||
#
|
||||
# Example: .par2, .sfv
|
||||
ExtCleanupDisk=.par2, .sfv, _brokenlog.txt
|
||||
|
||||
# Path to file containing unpack passwords.
|
||||
#
|
||||
# If the option is set the program will try all passwords from the file
|
||||
# when unpacking the archives. The file must be a text file containing
|
||||
# one password per line.
|
||||
#
|
||||
# If an nzb-file has a defined password (in the post-processing settings)
|
||||
# then the password-file is not used for that nzb-file.
|
||||
#
|
||||
# NOTE: Trying multiple passwords is a time consuming task. Whenever possible
|
||||
# passwords should be set per nzb-file in their post-processing settings.
|
||||
UnpackPassFile=
|
||||
|
||||
##############################################################################
|
||||
### EXTENSION SCRIPTS ###
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".\daemon\connect;.\daemon\feed;.\daemon\frontend;.\daemon\main;.\daemon\nntp;.\daemon\postprocess;.\daemon\queue;.\daemon\remote;.\daemon\util;.\daemon\windows;.\lib\par2;.\windows\resources"
|
||||
AdditionalIncludeDirectories=".\daemon\connect;.\daemon\feed;.\daemon\frontend;.\daemon\main;.\daemon\nntp;.\daemon\postprocess;.\daemon\queue;.\daemon\remote;.\daemon\util;.\daemon\windows;.\lib\par2"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;DEBUG;_WIN32_WINNT=0x0403"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -61,7 +61,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="WS2_32.lib ole32.lib OleAut32.Lib comsuppwd.lib Advapi32.lib Winmm.lib gdi32.lib shell32.lib dbghelp.lib ssleay32MTd.lib libeay32MTd.lib regex.lib zlib.lib $(NOINHERIT)"
|
||||
AdditionalDependencies="WS2_32.lib ole32.lib OleAut32.Lib comsuppwd.lib Advapi32.lib Winmm.lib dbghelp.lib ssleay32MTd.lib libeay32MTd.lib regex.lib zlib.lib $(NOINHERIT)"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
@@ -115,7 +115,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=".\daemon\connect;.\daemon\feed;.\daemon\frontend;.\daemon\main;.\daemon\nntp;.\daemon\postprocess;.\daemon\queue;.\daemon\remote;.\daemon\util;.\daemon\windows;.\lib\par2;.\windows\resources"
|
||||
AdditionalIncludeDirectories=".\daemon\connect;.\daemon\feed;.\daemon\frontend;.\daemon\main;.\daemon\nntp;.\daemon\postprocess;.\daemon\queue;.\daemon\remote;.\daemon\util;.\daemon\windows;.\lib\par2"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0403"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -136,7 +136,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="WS2_32.lib ole32.lib OleAut32.Lib comsuppwd.lib Advapi32.lib gdi32.lib shell32.lib Winmm.lib ssleay32MT.lib libeay32MT.lib regex.lib zlib.lib $(NOINHERIT)"
|
||||
AdditionalDependencies="WS2_32.lib ole32.lib OleAut32.Lib comsuppwd.lib Advapi32.lib Winmm.lib ssleay32MT.lib libeay32MT.lib regex.lib zlib.lib $(NOINHERIT)"
|
||||
LinkIncremental="0"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
@@ -480,14 +480,6 @@
|
||||
RelativePath=".\daemon\windows\win32.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\daemon\windows\WinConsole.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\daemon\windows\WinConsole.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="postprocess"
|
||||
@@ -926,34 +918,6 @@
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="resources"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\windows\resources\mainicon.ico"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\windows\resources\nzbget.rc"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\windows\resources\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\windows\resources\trayicon_idle.ico"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\windows\resources\trayicon_paused.ico"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\windows\resources\trayicon_working.ico"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>15.0-testing</string>
|
||||
<string>13.0-testing-r1011M</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.utilities</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
@@ -25,7 +25,7 @@
|
||||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2007-2015 Andrey Prygunkov</string>
|
||||
<string>Copyright © 2007-2014 Andrey Prygunkov</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainApp</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2012-2015 Andrey Prygunkov <hugbug@users.sourceforge.net>
|
||||
* Copyright (C) 2012-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
|
||||
@@ -352,7 +352,7 @@ var Downloads = (new function($)
|
||||
|
||||
/*** CHECKMARKS ******************************************************/
|
||||
|
||||
function checkBuildEditIDList(allowPostProcess, allowUrl, allowEmpty)
|
||||
function checkBuildEditIDList(allowPostProcess, allowUrl)
|
||||
{
|
||||
var checkedRows = $DownloadsTable.fasttable('checkedRows');
|
||||
|
||||
@@ -378,7 +378,7 @@ var Downloads = (new function($)
|
||||
}
|
||||
}
|
||||
|
||||
if (checkedEditIDs.length === 0 && !allowEmpty)
|
||||
if (checkedEditIDs.length === 0)
|
||||
{
|
||||
Notification.show('#Notif_Downloads_Select');
|
||||
return null;
|
||||
@@ -546,13 +546,6 @@ var Downloads = (new function($)
|
||||
notification = '';
|
||||
RPC.call('editqueue', [EditAction, EditOffset, '', checkedEditIDs], editCompleted);
|
||||
}
|
||||
|
||||
this.sort = function(order)
|
||||
{
|
||||
var checkedEditIDs = checkBuildEditIDList(true, true, true);
|
||||
notification = '#Notif_Downloads_Sorted';
|
||||
RPC.call('editqueue', ['GroupSort', 0, order, checkedEditIDs], editCompleted);
|
||||
}
|
||||
}(jQuery));
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2012-2015 Andrey Prygunkov <hugbug@users.sourceforge.net>
|
||||
* Copyright (C) 2012-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
|
||||
@@ -1603,23 +1603,14 @@ var HistoryEditDialog = (new function()
|
||||
(hist.Kind === 'DUP' ? 'hidden' : hist.Kind) + '</span>');
|
||||
}
|
||||
|
||||
$('#HistoryEdit_NZBName').val(hist.Name);
|
||||
|
||||
if (hist.Kind !== 'DUP')
|
||||
{
|
||||
// Category
|
||||
var v = $('#HistoryEdit_Category');
|
||||
DownloadsUI.fillCategoryCombo(v);
|
||||
v.val(hist.Category);
|
||||
if (v.val() != hist.Category)
|
||||
{
|
||||
v.append($('<option selected="selected"></option>').text(hist.Category));
|
||||
}
|
||||
$('#HistoryEdit_Category').text(hist.Category);
|
||||
}
|
||||
|
||||
if (hist.Kind === 'NZB')
|
||||
{
|
||||
$('#HistoryEdit_Path').val(hist.FinalDir !== '' ? hist.FinalDir : hist.DestDir);
|
||||
$('#HistoryEdit_Path').text(hist.FinalDir !== '' ? hist.FinalDir : hist.DestDir);
|
||||
|
||||
var size = Util.formatSizeMB(hist.FileSizeMB, hist.FileSizeLo);
|
||||
var completion = hist.SuccessArticles + hist.FailedArticles > 0 ? Util.round0(hist.SuccessArticles * 100.0 / (hist.SuccessArticles + hist.FailedArticles)) + '%' : '--';
|
||||
@@ -1845,7 +1836,7 @@ var HistoryEditDialog = (new function()
|
||||
|
||||
function reprocess()
|
||||
{
|
||||
notification = '#Notif_History_Reprocess';
|
||||
notification = '#Notif_History_Reproces';
|
||||
RPC.call('editqueue', ['HistoryProcess', 0, '', [curHist.ID]], completed);
|
||||
}
|
||||
|
||||
@@ -1866,37 +1857,13 @@ var HistoryEditDialog = (new function()
|
||||
disableAllButtons();
|
||||
notification = null;
|
||||
saveCompleted = completed;
|
||||
saveName();
|
||||
}
|
||||
|
||||
function saveName()
|
||||
{
|
||||
var name = $('#HistoryEdit_NZBName').val();
|
||||
name !== curHist.Name && !curHist.postprocess ?
|
||||
RPC.call('editqueue', ['HistorySetName', 0, name, [curHist.ID]], function()
|
||||
{
|
||||
notification = '#Notif_History_Saved';
|
||||
saveCategory();
|
||||
})
|
||||
:saveCategory();
|
||||
}
|
||||
|
||||
function saveCategory()
|
||||
{
|
||||
var category = $('#HistoryEdit_Category').val();
|
||||
category !== curHist.Category && curHist.Kind !== 'DUP' ?
|
||||
RPC.call('editqueue', ['HistorySetCategory', 0, category, [curHist.ID]], function()
|
||||
{
|
||||
notification = '#Notif_History_Saved';
|
||||
saveDupeKey();
|
||||
})
|
||||
: saveDupeKey();
|
||||
saveDupeKey();
|
||||
}
|
||||
|
||||
function itemGood(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
ConfirmDialog.showModal('HistoryEditGoodConfirmDialog', doItemGood, function () { HistoryUI.confirmMulti(false); });
|
||||
ConfirmDialog.showModal('HistoryEditGoodConfirmDialog', doItemGood);
|
||||
}
|
||||
|
||||
function doItemGood()
|
||||
@@ -1909,7 +1876,7 @@ var HistoryEditDialog = (new function()
|
||||
function itemBad(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
ConfirmDialog.showModal('HistoryEditBadConfirmDialog', doItemBad, function () { HistoryUI.confirmMulti(false); });
|
||||
ConfirmDialog.showModal('HistoryEditBadConfirmDialog', doItemBad);
|
||||
}
|
||||
|
||||
function doItemBad()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2012-2015 Andrey Prygunkov <hugbug@users.sourceforge.net>
|
||||
* Copyright (C) 2012-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
|
||||
@@ -269,7 +269,7 @@ var History = (new function($)
|
||||
}
|
||||
}
|
||||
|
||||
this.actionClick = function(action)
|
||||
this.deleteClick = function()
|
||||
{
|
||||
var checkedRows = $HistoryTable.fasttable('checkedRows');
|
||||
if (checkedRows.length == 0)
|
||||
@@ -279,7 +279,6 @@ var History = (new function($)
|
||||
}
|
||||
|
||||
var hasNzb = false;
|
||||
var hasUrl = false;
|
||||
var hasDup = false;
|
||||
var hasFailed = false;
|
||||
for (var i = 0; i < history.length; i++)
|
||||
@@ -288,69 +287,23 @@ var History = (new function($)
|
||||
if (checkedRows.indexOf(hist.ID) > -1)
|
||||
{
|
||||
hasNzb |= hist.Kind === 'NZB';
|
||||
hasUrl |= hist.Kind === 'URL';
|
||||
hasDup |= hist.Kind === 'DUP';
|
||||
hasFailed |= hist.ParStatus === 'FAILURE' || hist.UnpackStatus === 'FAILURE';
|
||||
}
|
||||
}
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case 'DELETE':
|
||||
notification = '#Notif_History_Deleted';
|
||||
HistoryUI.deleteConfirm(historyAction, hasNzb, hasDup, hasFailed, true);
|
||||
break;
|
||||
|
||||
case 'REPROCESS':
|
||||
if (hasUrl || hasDup)
|
||||
{
|
||||
Notification.show('#Notif_History_CantReprocess');
|
||||
return;
|
||||
}
|
||||
notification = '#Notif_History_Reprocess';
|
||||
historyAction('HistoryProcess');
|
||||
break;
|
||||
|
||||
case 'REDOWNLOAD':
|
||||
if (hasDup)
|
||||
{
|
||||
Notification.show('#Notif_History_CantRedownload');
|
||||
return;
|
||||
}
|
||||
notification = '#Notif_History_Returned';
|
||||
historyAction('HistoryRedownload');
|
||||
break;
|
||||
|
||||
case 'MARKGOOD':
|
||||
case 'MARKBAD':
|
||||
if (hasUrl)
|
||||
{
|
||||
Notification.show('#Notif_History_CantMark');
|
||||
return;
|
||||
}
|
||||
notification = '#Notif_History_Marked';
|
||||
|
||||
ConfirmDialog.showModal(action === 'MARKGOOD' ?
|
||||
'HistoryEditGoodConfirmDialog' : 'HistoryEditBadConfirmDialog',
|
||||
function () // action
|
||||
{
|
||||
historyAction(action === 'MARKGOOD' ? 'HistoryMarkGood' : 'HistoryMarkBad');
|
||||
},
|
||||
function (_dialog) // init
|
||||
{
|
||||
HistoryUI.confirmMulti(checkedRows.length > 1);
|
||||
}
|
||||
);
|
||||
break;
|
||||
}
|
||||
HistoryUI.deleteConfirm(historyDelete, hasNzb, hasDup, hasFailed, true);
|
||||
}
|
||||
|
||||
function historyAction(command)
|
||||
function historyDelete(command)
|
||||
{
|
||||
Refresher.pause();
|
||||
|
||||
var IDs = $HistoryTable.fasttable('checkedRows');
|
||||
|
||||
RPC.call('editqueue', [command, 0, '', [IDs]], function()
|
||||
{
|
||||
notification = '#Notif_History_Deleted';
|
||||
editCompleted();
|
||||
});
|
||||
}
|
||||
@@ -503,7 +456,14 @@ var HistoryUI = (new function($)
|
||||
function init(_dialog)
|
||||
{
|
||||
dialog = _dialog;
|
||||
HistoryUI.confirmMulti(multi);
|
||||
|
||||
if (!multi)
|
||||
{
|
||||
var html = $('#ConfirmDialog_Text').html();
|
||||
html = html.replace(/records/g, 'record');
|
||||
$('#ConfirmDialog_Text').html(html);
|
||||
}
|
||||
|
||||
$('#HistoryDeleteConfirmDialog_Hide', dialog).prop('checked', true);
|
||||
Util.show($('#HistoryDeleteConfirmDialog_Options', dialog), hasNzb && dupeCheck);
|
||||
Util.show($('#HistoryDeleteConfirmDialog_Simple', dialog), !(hasNzb && dupeCheck));
|
||||
@@ -523,14 +483,5 @@ var HistoryUI = (new function($)
|
||||
|
||||
ConfirmDialog.showModal('HistoryDeleteConfirmDialog', action, init);
|
||||
}
|
||||
|
||||
this.confirmMulti = function(multi)
|
||||
{
|
||||
if (multi === undefined || !multi)
|
||||
{
|
||||
var html = $('#ConfirmDialog_Text').html();
|
||||
html = html.replace(/records/g, 'record');
|
||||
$('#ConfirmDialog_Text').html(html);
|
||||
}
|
||||
}
|
||||
|
||||
}(jQuery));
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!--
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2012-2015 Andrey Prygunkov <hugbug@users.sourceforge.net>
|
||||
* Copyright (C) 2012-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
|
||||
@@ -286,10 +286,10 @@
|
||||
<tr>
|
||||
<th><div class="check img-check"></div></th>
|
||||
<th width="95px">Status</th>
|
||||
<th id="DownloadsTable_Name"><a href="#" onclick="Downloads.sort('name')">Name</a></th>
|
||||
<th id="DownloadsTable_Category"><a href="#" onclick="Downloads.sort('category')">Category</a></th>
|
||||
<th width="30px" class="text-right"><a href="#" onclick="Downloads.sort('age')">Age</a></th>
|
||||
<th width="120px"><div style="float:left; position:relative; width:50%; text-align:left;"><a href="#"onclick="Downloads.sort('size')">Size</a></div><div style="float:right; position:relative; width:50%; text-align:right;"><a href="#" onclick="Downloads.sort('left')">Left</a></div></th>
|
||||
<th id="DownloadsTable_Name">Name</th>
|
||||
<th id="DownloadsTable_Category">Category</th>
|
||||
<th width="30px" class="text-right">Age</th>
|
||||
<th width="120px"><div style="float:left; position:relative; width:50%; text-align:left;">Size</div><div style="float:right; position:relative; width:50%; text-align:right;">Left</div></th>
|
||||
<th width="58px" class="text-right">Est. Time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -316,17 +316,9 @@
|
||||
|
||||
<div class="btn-toolbar form-inline section-toolbar" id ="HistoryTab_Toolbar">
|
||||
<div class="btn-group">
|
||||
<button class="btn" onclick="History.actionClick('DELETE')" title="Delete selected records"><i class="icon-trash"></i><span class="btn-caption"> Delete</span></button>
|
||||
<button class="btn dropdown-toggle" data-toggle="dropdown" title="More actions"><span class="btn-caption"> More </span><span class="phone-only inline"> </span><span class="caret"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="menu-header">Actions</li>
|
||||
<li><a href="#" id="HistoryTab_Reprocess" onclick="History.actionClick('REPROCESS')"><i class="icon-process"></i> Post-Process Again</a></li>
|
||||
<li><a href="#" id="HistoryTab_Redownload" onclick="History.actionClick('REDOWNLOAD')"><i class="icon-downloads"></i> Download Again</a></li>
|
||||
<li><a href="#" id="HistoryTab_MarkGood" onclick="History.actionClick('MARKGOOD')"><i class="icon-ok"></i> Mark as Good</a></li>
|
||||
<li><a href="#" id="HistoryTab_MarkBad" onclick="History.actionClick('MARKBAD')"><i class="icon-remove"></i> Mark as Bad</a></li>
|
||||
</ul>
|
||||
<button class="btn" onclick="History.deleteClick()" title="Delete selected records"><i class="icon-trash"></i><span class="btn-caption"> Delete</span></button>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- STATUS FILTER BUTTONS -->
|
||||
<div class="btn-group phone-hide">
|
||||
<button class="btn history-filter btn-inverse" onclick="History.filter('ALL')" title="Show All">All <span class="badge badge-active" id="History_Badge_ALL">?</span></button>
|
||||
@@ -1266,13 +1258,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="HistoryEdit_NZBNameGroup">Name</label>
|
||||
<div class="controls" id="HistoryEdit_NZBNameGroup">
|
||||
<input type="text" class="input-xlarge" id="HistoryEdit_NZBName" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group" id="HistoryEdit_URLGroup">
|
||||
<label class="control-label" for="HistoryEdit_URL">Link</label>
|
||||
<div class="controls">
|
||||
@@ -1283,15 +1268,14 @@
|
||||
<div class="control-group" id="HistoryEdit_CategoryGroup">
|
||||
<label class="control-label" for="HistoryEdit_Category">Category</label>
|
||||
<div class="controls">
|
||||
<select id="HistoryEdit_Category">
|
||||
</select>
|
||||
<span class="input-medium uneditable-input" id="HistoryEdit_Category"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group" id="HistoryEdit_PathGroup">
|
||||
<label class="control-label" for="HistoryEdit_Path">Destination</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-xlarge" id="HistoryEdit_Path" readonly="true" />
|
||||
<span class="uneditable-mulitline-input" id="HistoryEdit_Path"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1307,7 +1291,8 @@
|
||||
|
||||
<div class="control-group control-group-last" id="HistoryEdit_DupGroup">
|
||||
<div class="controls">
|
||||
This hidden history record has little information. It remains in history mostly for duplicate check.
|
||||
This hidden history record has no information other than status.
|
||||
It remains in history for duplicate check.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1920,7 +1905,7 @@
|
||||
<div id="HistoryEditGoodConfirmDialog_Title">History</div>
|
||||
<div id="HistoryEditGoodConfirmDialog_Text">
|
||||
<p>
|
||||
Mark selected history records as good?
|
||||
Mark this history record as good?
|
||||
</p>
|
||||
<p class="confirm-help-block">
|
||||
Marking has an effect on duplicate handling and RSS.<br>For titles marked as good no more duplicates
|
||||
@@ -1936,7 +1921,7 @@
|
||||
<div id="HistoryEditBadConfirmDialog_Title">History</div>
|
||||
<div id="HistoryEditBadConfirmDialog_Text">
|
||||
<p>
|
||||
Mark selected history records as Bad?
|
||||
Mark this history record as Bad?
|
||||
</p>
|
||||
<p class="confirm-help-block">
|
||||
Marking has an effect on duplicate handling and RSS.<br>If dupe-backups exist in the history
|
||||
@@ -2435,10 +2420,6 @@
|
||||
<strong>URLs cannot be merged or paused</strong>
|
||||
</div>
|
||||
|
||||
<div id="Notif_Downloads_Sorted" data-duration="1000" class="alert alert-inverse alert-center alert-center-small hide">
|
||||
<strong>Sorted</strong>
|
||||
</div>
|
||||
|
||||
<div id="Notif_Edit_Select" data-duration="2000" class="alert alert-error alert-center alert-center-small hide">
|
||||
<strong>Please select records first</strong>
|
||||
</div>
|
||||
@@ -2459,7 +2440,7 @@
|
||||
<strong>Returned to Queue</strong>
|
||||
</div>
|
||||
|
||||
<div id="Notif_History_Reprocess" data-duration="1000" class="alert alert-inverse alert-center alert-center-small hide">
|
||||
<div id="Notif_History_Reproces" data-duration="1000" class="alert alert-inverse alert-center alert-center-small hide">
|
||||
<strong>Post-Processing</strong>
|
||||
</div>
|
||||
|
||||
@@ -2471,22 +2452,10 @@
|
||||
<strong>Please select records first</strong>
|
||||
</div>
|
||||
|
||||
<div id="Notif_History_CantMark" data-duration="2000" class="alert alert-error alert-center alert-center-small hide">
|
||||
<strong>Cannot mark URL-records</strong>
|
||||
</div>
|
||||
|
||||
<div id="Notif_History_Marked" data-duration="1000" class="alert alert-inverse alert-center alert-center-small hide">
|
||||
<strong>Marked</strong>
|
||||
</div>
|
||||
|
||||
<div id="Notif_History_CantReprocess" data-duration="2000" class="alert alert-error alert-center alert-center-medium hide">
|
||||
<strong>Cannot post-process URL- or hidden records</strong>
|
||||
</div>
|
||||
|
||||
<div id="Notif_History_CantRedownload" data-duration="2000" class="alert alert-error alert-center alert-center-medium hide">
|
||||
<strong>Cannot redownload hidden records</strong>
|
||||
</div>
|
||||
|
||||
<div id="Notif_Feeds_FetchAll" data-duration="1000" class="alert alert-inverse alert-center alert-center-small hide">
|
||||
<strong>Fetching new items</strong>
|
||||
</div>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 361 KiB |
@@ -1,217 +0,0 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Neutral resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDR_TRAYMENU MENU
|
||||
BEGIN
|
||||
POPUP "Menu"
|
||||
BEGIN
|
||||
MENUITEM "Show Web-Interface", ID_SHOWWEBUI
|
||||
POPUP "Show in Windows Explorer"
|
||||
BEGIN
|
||||
MENUITEM "Default Destination", ID_SHOW_DESTDIR
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Intermediate Files", ID_SHOW_INTERDIR
|
||||
MENUITEM "Incoming NZBs", ID_SHOW_NZBDIR
|
||||
MENUITEM "Scripts", ID_SHOW_SCRIPTDIR
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Config-File", ID_SHOW_CONFIGFILE
|
||||
MENUITEM "Log-File", ID_SHOW_LOGFILE
|
||||
END
|
||||
POPUP "Info-Links"
|
||||
BEGIN
|
||||
MENUITEM "Home Page", ID_INFO_HOMEPAGE
|
||||
MENUITEM "Downloads", ID_INFO_DOWNLOADS
|
||||
MENUITEM "Forum", ID_INFO_FORUM
|
||||
END
|
||||
POPUP "Troubleshooting"
|
||||
BEGIN
|
||||
MENUITEM "Restart", ID_TROUBLESHOOTING_RESTART
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Open Config-File in a Text Editor", ID_TROUBLESHOOTING_OPENCONFIG
|
||||
END
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "About...", ID_ABOUT
|
||||
MENUITEM "Preferences...", ID_PREFERENCES
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Exit", ID_EXIT
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_MAINICON ICON "mainicon.ico"
|
||||
IDI_TRAYICON_IDLE ICON "trayicon_idle.ico"
|
||||
IDI_TRAYICON_PAUSED ICON "trayicon_paused.ico"
|
||||
IDI_TRAYICON_WORKING ICON "trayicon_working.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUTBOX DIALOGEX 0, 0, 176, 194
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About NZBGet"
|
||||
FONT 8, "Tahoma", 400, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,63,173,50,14
|
||||
CTEXT "Version 15.0-testing-r1200",IDC_ABOUT_VERSION,16,70,144,8
|
||||
CTEXT "Lightweight usenet downloader",IDC_STATIC,16,83,144,8
|
||||
CTEXT "http://nzbget.net",IDC_ABOUT_HOMEPAGE,55,144,64,9,SS_NOTIFY
|
||||
CTEXT "Copyright <20> 2007-2015 Andrey Prygunkov",IDC_STATIC,16,156,144,8
|
||||
ICON "",IDC_ABOUT_ICON,67,7,21,20
|
||||
CTEXT "NZBGet",IDC_ABOUT_NAME,16,51,144,16
|
||||
CTEXT "The package includes other software; see program's folder for licenses.",IDC_STATIC,16,121,144,20
|
||||
CTEXT "NZBGet is free software; use it under the terms of the ",IDC_STATIC,16,99,144,20
|
||||
CTEXT "GNU General Public License",IDC_ABOUT_GPL,62,107,90,8,SS_NOTIFY
|
||||
LTEXT ".",IDC_STATIC,151,107,8,8,SS_NOTIFY
|
||||
END
|
||||
|
||||
IDD_PREFDIALOG DIALOGEX 0, 0, 212, 137
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "NZBGet Preferences"
|
||||
FONT 8, "Tahoma", 400, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,100,116,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,155,116,50,14
|
||||
LTEXT "*",IDC_STATIC,13,70,8,9
|
||||
CONTROL "Start at login *",IDC_PREF_AUTOSTART,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,13,58,10
|
||||
CONTROL "Show console window",IDC_PREF_CONSOLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,37,86,10
|
||||
CONTROL "Show in tray (near clock)",IDC_PREF_TRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,25,94,10
|
||||
CONTROL "Show Web-Interface on start",IDC_PREF_WEBUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,49,108,10
|
||||
LTEXT "Only Windows-specific options are located here. For all other options see Settings page in Web-Interface.",IDC_STATIC,21,90,175,17
|
||||
LTEXT "NZBGet can also run as Windows service. See README-WINDOWS.txt for details.",IDC_STATIC,21,68,172,17
|
||||
END
|
||||
|
||||
IDD_RUNNINGDIALOG DIALOGEX 0, 0, 342, 69
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "NZBGet"
|
||||
FONT 8, "Tahoma", 400, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Show Web-Interface",IDC_RUNNING_WEBUI,54,48,90,14
|
||||
LTEXT "NZBGet is already running.",IDC_RUNNING_TITLE,54,7,272,13
|
||||
ICON "",IDC_RUNNING_ICON,7,7,21,20
|
||||
LTEXT "Please use tray icon near clock to acces the program's menu.",IDC_RUNNING_TEXT,54,21,276,18
|
||||
PUSHBUTTON "Open Preferences...",IDC_RUNNING_PREFS,149,48,90,14
|
||||
PUSHBUTTON "Quit NZBGet",IDC_RUNNING_QUIT,245,48,90,14
|
||||
PUSHBUTTON "OK",IDC_RUNNING_OK,140,48,61,14,NOT WS_VISIBLE
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_ABOUTBOX, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 16
|
||||
RIGHTMARGIN, 160
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 187
|
||||
END
|
||||
|
||||
IDD_PREFDIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 205
|
||||
VERTGUIDE, 13
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 130
|
||||
END
|
||||
|
||||
IDD_RUNNINGDIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 335
|
||||
VERTGUIDE, 54
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 62
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // Neutral resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// German (Germany) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // German (Germany) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1,64 +0,0 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by nzbget.rc
|
||||
//
|
||||
#define IDI_MAINICON 101
|
||||
#define IDR_TRAYMENU 102
|
||||
#define IDI_TRAYICON_IDLE 102
|
||||
#define IDD_ABOUTBOX 103
|
||||
#define IDI_TRAYICON_PAUSED 103
|
||||
#define IDI_TRAYICON_WORKING 104
|
||||
#define IDD_PREFDIALOG 105
|
||||
#define IDD_RUNNINGDIALOG 106
|
||||
#define IDC_ABOUT_ICON 1001
|
||||
#define IDC_ABOUT_VERSION 1002
|
||||
#define IDC_ABOUT_HOMEPAGE 1003
|
||||
#define IDC_ABOUT_NAME 1004
|
||||
#define IDC_PREF_AUTOSTART 1005
|
||||
#define IDC_ABOUT_GPL 1005
|
||||
#define IDC_PREF_CONSOLE 1006
|
||||
#define IDC_PREF_TRAY 1007
|
||||
#define IDC_PREF_WEBUI 1008
|
||||
#define IDC_RUNNING_ICON 1009
|
||||
#define IDC_RUNNING_TITLE 1010
|
||||
#define IDC_RUNNING_TITLE2 1011
|
||||
#define IDC_RUNNING_TEXT 1011
|
||||
#define IDC_QUIT 1013
|
||||
#define IDC_RUNNING_QUIT 1013
|
||||
#define IDC_RUNNING_PREFS 1014
|
||||
#define IDC_RUNNING_WEBUI 1015
|
||||
#define IDC_RUNNING_OK 1016
|
||||
#define ID_SHOWWEBUI 40004
|
||||
#define ID_ABOUT 40005
|
||||
#define ID_EXIT 40006
|
||||
#define ID_MENU_INFO 40007
|
||||
#define ID_INFO_HOMEPAGE 40008
|
||||
#define ID_INFO_DOWNLOADS 40009
|
||||
#define ID_INFO_FORUM 40010
|
||||
#define ID_Menu 40011
|
||||
#define ID_PREFERENCES 40012
|
||||
#define ID_SHOW_CONFIGFILE 40020
|
||||
#define ID_SHOW_LOGFILE 40021
|
||||
#define ID_SHOW_DESTDIR 40022
|
||||
#define ID_SHOW_INTERDIR 40023
|
||||
#define ID_SHOW_NZBDIR 40024
|
||||
#define ID_SHOW_SCRIPTDIR 40025
|
||||
#define ID_MENU_TROUBLESHOOTING 40026
|
||||
#define ID_TROUBLESHOOTING_RESTART 40027
|
||||
#define ID_TROUBLESHOOTING_RESTARTINRECOVERYMODE 40028
|
||||
#define ID_TROUBLESHOOTING_RESETTOFACTORYDEFAULTS 40029
|
||||
#define ID_TROUBLESHOOTING_RESTART_RECOVERY 40030
|
||||
#define ID_TROUBLESHOOTING_RESET_TO_DEFAULTS 40031
|
||||
#define ID_TROUBLESHOOTING_OPENCONFIG 40032
|
||||
#define ID_Menu40033 40033
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 106
|
||||
#define _APS_NEXT_COMMAND_VALUE 40034
|
||||
#define _APS_NEXT_CONTROL_VALUE 1016
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 51 KiB |
@@ -1,195 +0,0 @@
|
||||
/*
|
||||
* This file is part of nzbget
|
||||
*
|
||||
* Copyright (C) 2014-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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Includes
|
||||
|
||||
!include "MUI2.nsh"
|
||||
!include "FileFunc.nsh"
|
||||
!include "LogicLib.nsh"
|
||||
|
||||
; Also requires NSIS Simple Service Plugin:
|
||||
; http://nsis.sourceforge.net/NSIS_Simple_Service_Plugin
|
||||
|
||||
;--------------------------------
|
||||
;General
|
||||
|
||||
Name "NZBGet"
|
||||
OutFile "..\nzbget-setup.exe"
|
||||
|
||||
;Default installation folder
|
||||
InstallDir "$PROGRAMFILES\NZBGet"
|
||||
|
||||
;Get installation folder from registry if available
|
||||
InstallDirRegKey HKCU "Software\NZBGet" ""
|
||||
|
||||
!ifndef DEBUG_UI
|
||||
;Request application privileges for Windows Vista
|
||||
RequestExecutionLevel admin
|
||||
!endif
|
||||
|
||||
;--------------------------------
|
||||
;Interface Settings
|
||||
|
||||
; !define MUI_ABORTWARNING
|
||||
|
||||
!define MUI_ICON "..\resources\mainicon.ico"
|
||||
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
|
||||
|
||||
!define MUI_WELCOMEFINISHPAGE_BITMAP "install.bmp"
|
||||
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "uninstall.bmp"
|
||||
|
||||
!define MUI_FINISHPAGE_RUN "$INSTDIR\nzbget.exe"
|
||||
!define MUI_FINISHPAGE_SHOWREADME ""
|
||||
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
|
||||
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut"
|
||||
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION FinishPageAction
|
||||
|
||||
;--------------------------------
|
||||
;Pages
|
||||
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_LICENSE "..\NZBGet\COPYING"
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
!insertmacro MUI_UNPAGE_WELCOME
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
!insertmacro MUI_UNPAGE_FINISH
|
||||
|
||||
;--------------------------------
|
||||
;Languages
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
;--------------------------------
|
||||
;Installer Sections
|
||||
|
||||
Section "Main"
|
||||
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
; Stop NZBGet (if running)
|
||||
ReadRegStr $R1 HKCU "Software\NZBGet" ""
|
||||
${If} $R1 != ""
|
||||
${AndIf} ${FileExists} "$R1\nzbget.exe"
|
||||
Delete "$R1\nzbget.exe"
|
||||
ExecWait '"$R1\nzbget.exe" -Q' $R2
|
||||
DetailPrint "Stopping NZBGet..."
|
||||
|
||||
try_delete:
|
||||
; Wait up to 10 seconds until stopped
|
||||
StrCpy $R2 20
|
||||
${While} ${FileExists} "$R1\nzbget.exe"
|
||||
${If} $R2 = 0
|
||||
${Break}
|
||||
${EndIf}
|
||||
Sleep 500
|
||||
IntOp $R2 $R2 - 1
|
||||
Delete "$R1\nzbget.exe"
|
||||
${EndWhile}
|
||||
|
||||
${If} ${FileExists} "$R1\nzbget.exe"
|
||||
MessageBox MB_RETRYCANCEL "NZBGet seems to be running right now. Please stop NZBGet and try again." \
|
||||
IDRETRY try_delete IDCANCEL cancel
|
||||
cancel:
|
||||
abort
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
!ifndef DEBUG_UI
|
||||
File /r "..\NZBGet\*"
|
||||
!endif
|
||||
|
||||
; Create shortcuts
|
||||
CreateDirectory "$SMPROGRAMS\NZBGet"
|
||||
CreateShortCut "$SMPROGRAMS\NZBGet\NZBGet.lnk" "$INSTDIR\nzbget.exe"
|
||||
CreateShortCut "$SMPROGRAMS\NZBGet\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||
|
||||
; Store installation folder
|
||||
WriteRegStr HKCU "Software\NZBGet" "" $INSTDIR
|
||||
|
||||
; Add control panel entry for Uninstall
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NZBGet" "DisplayName" "NZBGet"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NZBGet" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NZBGet" "Publisher" "Andrey Prygunkov"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NZBGet" "InstallLocation" "$INSTDIR"
|
||||
|
||||
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
|
||||
IntFmt $0 "0x%08X" $0
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NZBGet" "EstimatedSize" "$0"
|
||||
|
||||
; Create uninstaller
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
|
||||
SectionEnd
|
||||
|
||||
|
||||
Function FinishPageAction
|
||||
|
||||
; Create desktop shortcut
|
||||
CreateShortcut "$DESKTOP\NZBGet.lnk" "$INSTDIR\nzbget.exe"
|
||||
|
||||
; Refresh desktop window
|
||||
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
|
||||
|
||||
FunctionEnd
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Uninstaller Section
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
; Stop service (if installed)
|
||||
SimpleSC::StopService "NZBGet" 1 30
|
||||
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
|
||||
|
||||
; Remove a service
|
||||
SimpleSC::RemoveService "NZBGet"
|
||||
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
|
||||
|
||||
try_delete:
|
||||
Delete "$INSTDIR\nzbget.exe"
|
||||
IfFileExists "$INSTDIR\nzbget.exe" 0 not_running
|
||||
MessageBox MB_RETRYCANCEL "File nzbget.exe could not be deleted. Please make sure the program isn't running." \
|
||||
IDRETRY try_delete IDCANCEL cancel
|
||||
cancel:
|
||||
quit
|
||||
not_running:
|
||||
|
||||
RMDir /r "$INSTDIR"
|
||||
RMDir /r "$SMPROGRAMS\NZBGet"
|
||||
Delete "$DESKTOP\NZBGet.lnk"
|
||||
|
||||
DeleteRegKey HKCU "Software\NZBGet"
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NZBGet"
|
||||
|
||||
; Refresh desktop window
|
||||
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
|
||||
|
||||
SectionEnd
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 51 KiB |
Reference in New Issue
Block a user