Example #1
0
    def xmlrpc_status(self):
        """ Return hellanzb's current status text """
        from Hellanzb.NZBQueue import listQueue
        s = {}

        totalSpeed = Hellanzb.getCurrentRate()

        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) for nzb in currentNZBs
        ]

        Hellanzb.postProcessorLock.acquire()
        s['currently_processing'] = [self.makeNZBStruct(processor) 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
Example #2
0
    def xmlrpc_status(self):
        """ Return hellanzb's current status text """
        from Hellanzb.NZBQueue import listQueue
        s = {}

        if Hellanzb.downloadPaused:
            totalSpeed = 0
        else:
            totalSpeed = Hellanzb.getCurrentRate()

        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) for nzb in currentNZBs]

        Hellanzb.postProcessorLock.acquire()
        s['currently_processing'] = [self.makeNZBStruct(processor) 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
Example #3
0
 def xmlrpc_dequeue(self, nzbId):
     """ Remove the NZB with specified ID from the queue """
     from Hellanzb.NZBQueue import dequeueNZBs, listQueue
     dequeueNZBs(nzbId)
     return listQueue()
Example #4
0
 def xmlrpc_up(self, nzbId, shift=1):
     """ Move the NZB with the specified ID up in the queue. The optional second argument
     specifies the number of spaces to shift by (Default: 1) """
     from Hellanzb.NZBQueue import listQueue, moveUp
     moveUp(nzbId, shift)
     return listQueue()
Example #5
0
 def xmlrpc_next(self, nzbId):
     """ Move the NZB with the specified ID to the beginning of the queue """
     from Hellanzb.NZBQueue import listQueue, nextNZBId
     nextNZBId(nzbId)
     return listQueue()
Example #6
0
 def xmlrpc_move(self, nzbId, index):
     """ Move the NZB with the specified ID to the specified index in the queue """
     from Hellanzb.NZBQueue import listQueue, moveNZB
     moveNZB(nzbId, index)
     return listQueue()
Example #7
0
 def xmlrpc_list(self, excludeIds=False):
     """ List the NZBs in the queue, along with their NZB IDs. Specify True as the second
     argument to exclude the NZB ID in the listing """
     from Hellanzb.NZBQueue import listQueue
     return listQueue(not excludeIds)
Example #8
0
 def xmlrpc_last(self, nzbId):
     """ Move the NZB with the specified ID to the end of the queue """
     from Hellanzb.NZBQueue import lastNZB, listQueue
     lastNZB(nzbId)
     return listQueue()
Example #9
0
 def xmlrpc_dequeue(self, nzbId):
     """ Remove the NZB with specified ID from the queue """
     from Hellanzb.NZBQueue import dequeueNZBs, listQueue
     dequeueNZBs(nzbId)
     return listQueue()
Example #10
0
 def xmlrpc_up(self, nzbId, shift = 1):
     """ Move the NZB with the specified ID up in the queue. The optional second argument
     specifies the number of spaces to shift by (Default: 1) """
     from Hellanzb.NZBQueue import listQueue, moveUp
     moveUp(nzbId, shift)
     return listQueue()
Example #11
0
 def xmlrpc_next(self, nzbId):
     """ Move the NZB with the specified ID to the beginning of the queue """
     from Hellanzb.NZBQueue import listQueue, nextNZBId
     nextNZBId(nzbId)
     return listQueue()
Example #12
0
 def xmlrpc_move(self, nzbId, index):
     """ Move the NZB with the specified ID to the specified index in the queue """
     from Hellanzb.NZBQueue import listQueue, moveNZB
     moveNZB(nzbId, index)
     return listQueue()
Example #13
0
 def xmlrpc_list(self, excludeIds = False):
     """ List the NZBs in the queue, along with their NZB IDs. Specify True as the second
     argument to exclude the NZB ID in the listing """
     from Hellanzb.NZBQueue import listQueue
     return listQueue(not excludeIds)
Example #14
0
 def xmlrpc_last(self, nzbId):
     """ Move the NZB with the specified ID to the end of the queue """
     from Hellanzb.NZBQueue import lastNZB, listQueue
     lastNZB(nzbId)
     return listQueue()