2
* This file is part of nzbget
4
* Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
5
* Copyright (C) 2007-2010 Andrei Prygounkov <hugbug@users.sourceforge.net>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
* $Date: 2010-01-29 10:34:44 +0100 (Fri, 29 Jan 2010) $
27
#ifndef DOWNLOADINFO_H
28
#define DOWNLOADINFO_H
56
char* m_szResultFilename;
61
void SetPartNumber(int s) { m_iPartNumber = s; }
62
int GetPartNumber() { return m_iPartNumber; }
63
const char* GetMessageID() { return m_szMessageID; }
64
void SetMessageID(const char* szMessageID);
65
void SetSize(int s) { m_iSize = s; }
66
int GetSize() { return m_iSize; }
67
EStatus GetStatus() { return m_eStatus; }
68
void SetStatus(EStatus Status) { m_eStatus = Status; }
69
const char* GetResultFilename() { return m_szResultFilename; }
70
void SetResultFilename(const char* v);
76
typedef std::vector<ArticleInfo*> Articles;
77
typedef std::vector<char*> Groups;
87
long long m_lRemainingSize;
91
bool m_bFilenameConfirmed;
93
bool m_bOutputInitialized;
94
Mutex m_mutexOutputFile;
101
int GetID() { return m_iID; }
103
NZBInfo* GetNZBInfo() { return m_pNZBInfo; }
104
void SetNZBInfo(NZBInfo* pNZBInfo);
105
Articles* GetArticles() { return &m_Articles; }
106
Groups* GetGroups() { return &m_Groups; }
107
const char* GetSubject() { return m_szSubject; }
108
void SetSubject(const char* szSubject);
109
const char* GetFilename() { return m_szFilename; }
110
void SetFilename(const char* szFilename);
111
void MakeValidFilename();
112
bool GetFilenameConfirmed() { return m_bFilenameConfirmed; }
113
void SetFilenameConfirmed(bool bFilenameConfirmed) { m_bFilenameConfirmed = bFilenameConfirmed; }
114
void SetSize(long long s) { m_lSize = s; m_lRemainingSize = s; }
115
long long GetSize() { return m_lSize; }
116
long long GetRemainingSize() { return m_lRemainingSize; }
117
void SetRemainingSize(long long s) { m_lRemainingSize = s; }
118
time_t GetTime() { return m_tTime; }
119
void SetTime(time_t tTime) { m_tTime = tTime; }
120
bool GetPaused() { return m_bPaused; }
121
void SetPaused(bool Paused) { m_bPaused = Paused; }
122
bool GetDeleted() { return m_bDeleted; }
123
void SetDeleted(bool Deleted) { m_bDeleted = Deleted; }
124
int GetCompleted() { return m_iCompleted; }
125
void SetCompleted(int s) { m_iCompleted = s; }
126
void ClearArticles();
127
void LockOutputFile();
128
void UnlockOutputFile();
129
bool GetOutputInitialized() { return m_bOutputInitialized; }
130
void SetOutputInitialized(bool bOutputInitialized) { m_bOutputInitialized = bOutputInitialized; }
131
bool IsDupe(const char* szFilename);
134
typedef std::deque<FileInfo*> FileQueue;
142
int m_iRemainingFileCount;
143
int m_iPausedFileCount;
144
long long m_lRemainingSize;
145
long long m_lPausedSize;
146
int m_iRemainingParCount;
150
friend class DownloadQueue;
155
NZBInfo* GetNZBInfo() { return m_pNZBInfo; }
156
int GetFirstID() { return m_iFirstID; }
157
int GetLastID() { return m_iLastID; }
158
long long GetRemainingSize() { return m_lRemainingSize; }
159
long long GetPausedSize() { return m_lPausedSize; }
160
int GetRemainingFileCount() { return m_iRemainingFileCount; }
161
int GetPausedFileCount() { return m_iPausedFileCount; }
162
int GetRemainingParCount() { return m_iRemainingParCount; }
163
time_t GetMinTime() { return m_tMinTime; }
164
time_t GetMaxTime() { return m_tMaxTime; }
167
typedef std::deque<GroupInfo*> GroupQueue;
175
void SetValue(const char* szValue);
177
friend class NZBParameterList;
180
NZBParameter(const char* szName);
182
const char* GetName() { return m_szName; }
183
const char* GetValue() { return m_szValue; }
186
typedef std::deque<NZBParameter*> NZBParameterListBase;
188
class NZBParameterList : public NZBParameterListBase
191
void SetParameter(const char* szName, const char* szValue);
215
typedef std::vector<char*> Files;
216
typedef std::deque<Message*> Messages;
225
int m_iParkedFileCount;
227
Files m_completedFiles;
229
EParStatus m_eParStatus;
230
EScriptStatus m_eScriptStatus;
231
char* m_szQueuedFilename;
235
time_t m_tHistoryTime;
236
NZBInfoList* m_Owner;
237
NZBParameterList m_ppParameters;
244
friend class NZBInfoList;
251
int GetID() { return m_iID; }
252
const char* GetFilename() { return m_szFilename; }
253
void SetFilename(const char* szFilename);
254
void GetNiceNZBName(char* szBuffer, int iSize);
255
static void MakeNiceNZBName(const char* szNZBFilename, char* szBuffer, int iSize);
256
const char* GetDestDir() { return m_szDestDir; } // needs locking (for shared objects)
257
void SetDestDir(const char* szDestDir); // needs locking (for shared objects)
258
const char* GetCategory() { return m_szCategory; } // needs locking (for shared objects)
259
void SetCategory(const char* szCategory); // needs locking (for shared objects)
260
long long GetSize() { return m_lSize; }
261
void SetSize(long long lSize) { m_lSize = lSize; }
262
int GetFileCount() { return m_iFileCount; }
263
void SetFileCount(int iFileCount) { m_iFileCount = iFileCount; }
264
int GetParkedFileCount() { return m_iParkedFileCount; }
265
void SetParkedFileCount(int iParkedFileCount) { m_iParkedFileCount = iParkedFileCount; }
266
void BuildDestDirName();
267
Files* GetCompletedFiles() { return &m_completedFiles; } // needs locking (for shared objects)
268
void ClearCompletedFiles();
269
bool GetPostProcess() { return m_bPostProcess; }
270
void SetPostProcess(bool bPostProcess) { m_bPostProcess = bPostProcess; }
271
EParStatus GetParStatus() { return m_eParStatus; }
272
void SetParStatus(EParStatus eParStatus) { m_eParStatus = eParStatus; }
273
EScriptStatus GetScriptStatus() { return m_eScriptStatus; }
274
void SetScriptStatus(EScriptStatus eScriptStatus) { m_eScriptStatus = eScriptStatus; }
275
const char* GetQueuedFilename() { return m_szQueuedFilename; }
276
void SetQueuedFilename(const char* szQueuedFilename);
277
bool GetDeleted() { return m_bDeleted; }
278
void SetDeleted(bool bDeleted) { m_bDeleted = bDeleted; }
279
bool GetParCleanup() { return m_bParCleanup; }
280
void SetParCleanup(bool bParCleanup) { m_bParCleanup = bParCleanup; }
281
bool GetCleanupDisk() { return m_bCleanupDisk; }
282
void SetCleanupDisk(bool bCleanupDisk) { m_bCleanupDisk = bCleanupDisk; }
283
time_t GetHistoryTime() { return m_tHistoryTime; }
284
void SetHistoryTime(time_t tHistoryTime) { m_tHistoryTime = tHistoryTime; }
285
NZBParameterList* GetParameters() { return &m_ppParameters; } // needs locking (for shared objects)
286
void SetParameter(const char* szName, const char* szValue); // needs locking (for shared objects)
287
void AppendMessage(Message::EKind eKind, time_t tTime, const char* szText);
288
Messages* LockMessages();
289
void UnlockMessages();
292
typedef std::deque<NZBInfo*> NZBInfoListBase;
294
class NZBInfoList : public NZBInfoListBase
297
void Add(NZBInfo* pNZBInfo);
298
void Remove(NZBInfo* pNZBInfo);
324
enum ERequestParCheck
339
typedef std::deque<Message*> Messages;
344
char* m_szParFilename;
349
EParStatus m_eParStatus;
350
EScriptStatus m_eScriptStatus;
351
ERequestParCheck m_eRequestParCheck;
353
char* m_szProgressLabel;
355
int m_iStageProgress;
358
Thread* m_pScriptThread;
369
int GetID() { return m_iID; }
370
NZBInfo* GetNZBInfo() { return m_pNZBInfo; }
371
void SetNZBInfo(NZBInfo* pNZBInfo);
372
const char* GetParFilename() { return m_szParFilename; }
373
void SetParFilename(const char* szParFilename);
374
const char* GetInfoName() { return m_szInfoName; }
375
void SetInfoName(const char* szInfoName);
376
EStage GetStage() { return m_eStage; }
377
void SetStage(EStage eStage) { m_eStage = eStage; }
378
void SetProgressLabel(const char* szProgressLabel);
379
const char* GetProgressLabel() { return m_szProgressLabel; }
380
int GetFileProgress() { return m_iFileProgress; }
381
void SetFileProgress(int iFileProgress) { m_iFileProgress = iFileProgress; }
382
int GetStageProgress() { return m_iStageProgress; }
383
void SetStageProgress(int iStageProgress) { m_iStageProgress = iStageProgress; }
384
time_t GetStartTime() { return m_tStartTime; }
385
void SetStartTime(time_t tStartTime) { m_tStartTime = tStartTime; }
386
time_t GetStageTime() { return m_tStageTime; }
387
void SetStageTime(time_t tStageTime) { m_tStageTime = tStageTime; }
388
bool GetWorking() { return m_bWorking; }
389
void SetWorking(bool bWorking) { m_bWorking = bWorking; }
390
bool GetDeleted() { return m_bDeleted; }
391
void SetDeleted(bool bDeleted) { m_bDeleted = bDeleted; }
392
bool GetParCheck() { return m_bParCheck; }
393
void SetParCheck(bool bParCheck) { m_bParCheck = bParCheck; }
394
EParStatus GetParStatus() { return m_eParStatus; }
395
void SetParStatus(EParStatus eParStatus) { m_eParStatus = eParStatus; }
396
ERequestParCheck GetRequestParCheck() { return m_eRequestParCheck; }
397
void SetRequestParCheck(ERequestParCheck eRequestParCheck) { m_eRequestParCheck = eRequestParCheck; }
398
EScriptStatus GetScriptStatus() { return m_eScriptStatus; }
399
void SetScriptStatus(EScriptStatus eScriptStatus) { m_eScriptStatus = eScriptStatus; }
400
void AppendMessage(Message::EKind eKind, const char* szText);
401
Thread* GetScriptThread() { return m_pScriptThread; }
402
void SetScriptThread(Thread* pScriptThread) { m_pScriptThread = pScriptThread; }
403
Messages* LockMessages();
404
void UnlockMessages();
407
typedef std::deque<PostInfo*> PostQueue;
409
typedef std::vector<int> IDList;
411
typedef std::deque<NZBInfo*> HistoryList;
416
NZBInfoList m_NZBInfoList;
417
FileQueue m_FileQueue;
418
PostQueue m_PostQueue;
419
HistoryList m_HistoryList;
420
FileQueue m_ParkedFiles;
423
NZBInfoList* GetNZBInfoList() { return &m_NZBInfoList; }
424
FileQueue* GetFileQueue() { return &m_FileQueue; }
425
PostQueue* GetPostQueue() { return &m_PostQueue; }
426
HistoryList* GetHistoryList() { return &m_HistoryList; }
427
FileQueue* GetParkedFiles() { return &m_ParkedFiles; }
428
void BuildGroups(GroupQueue* pGroupQueue);
431
class DownloadQueueHolder
434
virtual ~DownloadQueueHolder() {};
435
virtual DownloadQueue* LockQueue() = 0;
436
virtual void UnlockQueue() = 0;