Exemplo n.º 1
0
 def check_space(self):
     """
     Check the amount of disk space has not dropped below the minimum required.
     If it has attempt to remove some recordings.
     """
     if util.freespace(config.TV_RECORD_DIR) < self.required_space:
         candidates = self.generate_candidates()
         while (util.freespace(config.TV_RECORD_DIR) < self.required_space) and (len(candidates) > 0):
             # Delete a candidate
             candidate = candidates.pop(0)
             if (not candidate):
                 break
             logger.log( 9, 'deleting %s, because we are running out of space.', candidate.name)
             candidate.files.delete()
             del(candidate)
Exemplo n.º 2
0
    def actions(self, item):
        if item.type == 'dir' and hasattr(item, 'dir'):
            freespace = util.freespace(item.dir)
            totalspace = util.totalspace(item.dir)
            try:
                percentage = freespace * 100.0 / totalspace
            except ZeroDivisionError, e:
                percentage = 0.0
                print e

            if (totalspace == 0): # no space perhaps a bad path
                diskfree = _( 'Bad Path' )
            else:
                diskfree = _( '%(freespace)s free of %(totalspace)s total (%(percentage)i%% free)' ) % ({
                    'freespace': util.human_size(freespace),
                    'totalspace': util.human_size(totalspace),
                    'percentage': percentage})
            return  [ ( self.dud, diskfree) ]
Exemplo n.º 3
0
    def actions(self, item):
        if item.type == 'dir':
            freespace = util.freespace(item.dir)
            totalspace = util.totalspace(item.dir)
            freespacemb = (freespace / 1024) / 1024
            freespacegb = freespacemb / 1024
            totalspacemb = (totalspace / 1024) / 1024
            totalspacegb = totalspacemb / 1024
            percentage = freespace * 100.0 / totalspace

            if (totalspace > 1073741824):  # more than 1024 Mb
                diskfree = _('%i free of %i GB total (%i%% free)') % (
                    freespacegb, totalspacegb, percentage)
            else:
                diskfree = _('%i free of %i MB total (%i%% free)') % (
                    freespacemb, totalspacemb, percentage)
            return [(self.dud, diskfree)]
        else:
            return []
Exemplo n.º 4
0
    def actions(self, item):
        if item.type == 'dir' and hasattr(item, 'dir'):
            freespace = util.freespace(item.dir)
            totalspace = util.totalspace(item.dir)
            try:
                percentage = freespace * 100.0 / totalspace
            except ZeroDivisionError, e:
                percentage = 0.0
                print e

            if (totalspace == 0):  # no space perhaps a bad path
                diskfree = _('Bad Path')
            else:
                diskfree = _(
                    '%(freespace)s free of %(totalspace)s total (%(percentage)i%% free)'
                ) % ({
                    'freespace': util.human_size(freespace),
                    'totalspace': util.human_size(totalspace),
                    'percentage': percentage
                })
            return [(self.dud, diskfree)]
Exemplo n.º 5
0
    def actions(self, item):
        if item.type == 'dir' and hasattr(item, 'dir'):
            freespace = util.freespace(item.dir)
            totalspace = util.totalspace(item.dir)
            freespacemb = (freespace / 1024) / 1024
            freespacegb = freespacemb / 1024
            totalspacemb = (totalspace / 1024) / 1024
            totalspacegb = totalspacemb / 1024
            try:
                percentage = freespace * 100.0 / totalspace
            except ZeroDivisionError, e:
                percentage = 0.0
                print e

            if (totalspace == 0): # no space perhaps a bad path
                diskfree = _( 'Bad Path' )
            elif (totalspace > 1073741824): # more than 1024 Mb
                diskfree = _( '%i free of %i GB total (%i%% free)' ) % (freespacegb, totalspacegb, percentage)
            else:
                diskfree = _( '%i free of %i MB total (%i%% free)' ) % (freespacemb, totalspacemb, percentage)
            return  [ ( self.dud, diskfree) ]