~ubuntu-branches/debian/experimental/nzbget/experimental

« back to all changes in this revision

Viewing changes to .pc/fix_fsf_address.patch/QueueCoordinator.h

  • Committer: Package Import Robot
  • Author(s): Andreas Moog
  • Date: 2013-07-18 14:50:28 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130718145028-qhxse81w1sj5w424
Tags: 11.0+dfsg-1
* New upstream release (Closes: #701896)
* Repackage original tarball to remove copies of jquery and twitter-
  bootstrap
* debian/watch: Update for new versioning scheme
* debian/patches: Remove all old patches, add one patch:
  - dont-embed-libraries.patch: Don't install embedded jquery and bootstrap 
    libraries
* debian/combat: Upgrade to debhelper combat 9
* debian/control:
  - Fix Vcs-Git field
  - Adjust debhelper version for combat level 9
  - Add jquery and bootstrap to depends for integrated webserver
  - Add python to recommends for post-processing scripts
  - Bump build-depends on libpar2-dev to support the cancel function
* debian/links:
  - Use the system jquery and bootstrap libraries
* debian/rules:
  - Add get-orig-source target to build modified upstream tarball
* Adjust sample nzbget.conf:
  - Only listen to 127.0.0.1 instead of 0.0.0.0
  - Use nzbget.conf as template for webui configuration
* Adjust sample nzbgetd init file:
  - Point to correct location of nzbget binary

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  This file is part of nzbget
3
 
 *
4
 
 *  Copyright (C) 2004 Sven Henkel <sidddy@users.sourceforge.net>
5
 
 *  Copyright (C) 2007-2010 Andrei Prygounkov <hugbug@users.sourceforge.net>
6
 
 *
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.
11
 
 *
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.
16
 
 *
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.
20
 
 *
21
 
 * $Revision: 378 $
22
 
 * $Date: 2010-01-29 10:34:44 +0100 (Fri, 29 Jan 2010) $
23
 
 *
24
 
 */
25
 
 
26
 
 
27
 
#ifndef QUEUECOORDINATOR_H
28
 
#define QUEUECOORDINATOR_H
29
 
 
30
 
#include <deque>
31
 
#include <list>
32
 
#include <time.h>
33
 
 
34
 
#include "Thread.h"
35
 
#include "NZBFile.h"
36
 
#include "ArticleDownloader.h"
37
 
#include "DownloadInfo.h"
38
 
#include "Observer.h"
39
 
#include "QueueEditor.h"
40
 
#include "NNTPConnection.h"
41
 
                                            
42
 
class QueueCoordinator : public Thread, public Observer, public Subject, public DownloadSpeedMeter, public DownloadQueueHolder
43
 
{
44
 
public:
45
 
        typedef std::list<ArticleDownloader*>   ActiveDownloads;
46
 
        enum EAspectAction
47
 
        {
48
 
                eaNZBFileAdded,
49
 
                eaFileCompleted,
50
 
                eaFileDeleted
51
 
        };
52
 
        struct Aspect
53
 
        {
54
 
                EAspectAction eAction;
55
 
                DownloadQueue* pDownloadQueue;
56
 
                NZBInfo* pNZBInfo;
57
 
                FileInfo* pFileInfo;
58
 
        };
59
 
 
60
 
private:
61
 
        DownloadQueue                   m_DownloadQueue;
62
 
        ActiveDownloads                 m_ActiveDownloads;
63
 
        QueueEditor                             m_QueueEditor;
64
 
        Mutex                                   m_mutexDownloadQueue;
65
 
        bool                                    m_bHasMoreJobs;
66
 
 
67
 
        // statistics
68
 
        static const int                SPEEDMETER_SLOTS = 30;    
69
 
        static const int                SPEEDMETER_SLOTSIZE = 1;  //Split elapsed time into this number of secs.
70
 
    int                                         m_iSpeedBytes[SPEEDMETER_SLOTS];
71
 
    int                     m_iSpeedTotalBytes;
72
 
    int                                         m_iSpeedTime[SPEEDMETER_SLOTS];
73
 
    int                     m_iSpeedStartTime; 
74
 
 
75
 
    int                                         m_iSpeedBytesIndex;
76
 
        long long                               m_iAllBytes;
77
 
        time_t                                  m_tStartServer;
78
 
        time_t                                  m_tLastCheck;
79
 
        time_t                                  m_tStartDownload;
80
 
        time_t                                  m_tPausedFrom;
81
 
        bool                                    m_bStandBy;
82
 
        Mutex                                   m_mutexStat;
83
 
 
84
 
        bool                                    GetNextArticle(FileInfo* &pFileInfo, ArticleInfo* &pArticleInfo);
85
 
        void                                    StartArticleDownload(FileInfo* pFileInfo, ArticleInfo* pArticleInfo, NNTPConnection* pConnection);
86
 
        void                                    BuildArticleFilename(ArticleDownloader* pArticleDownloader, FileInfo* pFileInfo, ArticleInfo* pArticleInfo);
87
 
        bool                                    IsDupe(FileInfo* pFileInfo);
88
 
        void                                    ArticleCompleted(ArticleDownloader* pArticleDownloader);
89
 
        void                                    DeleteFileInfo(FileInfo* pFileInfo, bool bCompleted);
90
 
        void                                    ResetHangingDownloads();
91
 
        void                                    ResetSpeedStat();
92
 
        void                                    EnterLeaveStandBy(bool bEnter);
93
 
        void                                    AdjustStartTime();
94
 
 
95
 
public:
96
 
                                                        QueueCoordinator();                
97
 
        virtual                                 ~QueueCoordinator();
98
 
        virtual void                    Run();
99
 
        virtual void                    Stop();
100
 
        void                                    Update(Subject* Caller, void* Aspect);
101
 
 
102
 
        // statistics
103
 
        long long                               CalcRemainingSize();
104
 
        virtual float                   CalcCurrentDownloadSpeed();
105
 
        virtual void                    AddSpeedReading(int iBytes);
106
 
        void                                    CalcStat(int* iUpTimeSec, int* iDnTimeSec, long long* iAllBytes, bool* bStandBy);
107
 
 
108
 
        // Editing the queue
109
 
        DownloadQueue*                  LockQueue();
110
 
        void                                    UnlockQueue() ;
111
 
        void                                    AddNZBFileToQueue(NZBFile* pNZBFile, bool bAddFirst);
112
 
        bool                                    HasMoreJobs() { return m_bHasMoreJobs; }
113
 
        bool                                    GetStandBy() { return m_bStandBy; }
114
 
        bool                                    DeleteQueueEntry(FileInfo* pFileInfo);
115
 
        bool                                    SetQueueEntryNZBCategory(NZBInfo* pNZBInfo, const char* szCategory);
116
 
        bool                                    MergeQueueEntries(NZBInfo* pDestNZBInfo, NZBInfo* pSrcNZBInfo);
117
 
        void                                    DiscardDiskFile(FileInfo* pFileInfo);
118
 
        QueueEditor*                    GetQueueEditor() { return &m_QueueEditor; }
119
 
 
120
 
        void                                    LogDebugInfo();
121
 
};
122
 
 
123
 
#endif