Logo Search packages:      
Sourcecode: hellanzb version File versions  Download package

def Hellanzb::HellaXMLRPC::HellaXMLRPCServer::xmlrpc_status (   self  ) 

Return hellanzb's current status text 

Definition at line 273 of file __init__.py.

00273                            :
        """ Return hellanzb's current status text """
        from Hellanzb.NZBQueue import listQueue
        s = {}
    
        totalSpeed = 0
        activeClients = 0
        # FIXME: rename nsfs. call it factories
        for nsf in Hellanzb.nsfs:
            totalSpeed += nsf.sessionSpeed
            activeClients += len(nsf.activeClients)

        if Hellanzb.downloadPaused:
            totalSpeed = 0

        s['time'] = DateTime()
        s['uptime'] = secondsToUptime(time.time() - Hellanzb.BEGIN_TIME)
        s['is_paused'] = Hellanzb.downloadPaused
        s['rate'] = totalSpeed
        s['queued_mb'] = Hellanzb.queue.totalQueuedBytes / 1024 / 1024
        
        if totalSpeed == 0:
            s['eta'] = 0
        else:
            s['eta'] = int((Hellanzb.queue.totalQueuedBytes / 1024) / totalSpeed)

        s['percent_complete'] = 0
        currentNZBs = Hellanzb.queue.currentNZBs()
        if len(currentNZBs):
            currentNZB = currentNZBs[0]
            s['percent_complete'] = currentNZB.getPercentDownloaded()
            
        if Hellanzb.ht.readLimit == None or Hellanzb.ht.readLimit == 0:
            s['maxrate'] = 0
        else:
            s['maxrate'] = Hellanzb.ht.readLimit / 1024
            
        s['total_dl_nzbs'] = Hellanzb.totalArchivesDownloaded
        s['total_dl_files'] = Hellanzb.totalFilesDownloaded
        s['total_dl_segments'] = Hellanzb.totalSegmentsDownloaded
        s['total_dl_mb'] = Hellanzb.totalBytesDownloaded / 1024 / 1024
        s['config_file'] = Hellanzb.CONFIG_FILENAME
        s['hostname'] = Hellanzb.HOSTNAME
        s['version'] = Hellanzb.version

        s['currently_downloading'] = [self.makeNZBStruct(nzb.id, nzb.archiveName, nzb.rarPassword,
                                                         nzb.isParRecovery, nzb.msgid) for \
                                      nzb in currentNZBs]

        Hellanzb.postProcessorLock.acquire()
        s['currently_processing'] = [self.makeNZBStruct(processor.id, archiveName(processor.dirName),
                                                        processor.rarPassword, processor.isParRecovery,
                                                        processor.msgid) \
                                     for processor in Hellanzb.postProcessors]

        Hellanzb.postProcessorLock.release()
        s['queued'] = listQueue()
        s['log_entries'] = [{getLevelName(entry[0]): self.cleanLog(entry[1])} \
                            for entry in Hellanzb.recentLogs]
        
        return s

    xmlrpc_status.signature = [ ['struct'] ]


Generated by  Doxygen 1.6.0   Back to index