def isDiskSpaceChanged(self, update=True): total, used, free = diskUsage(self.dir_path) result = self.used != used if result and update: print("[AdvancedMovieSelection] update disc usage:", total, self.used, used, free) self.used = used return result
def getDirDescription(self): text = _("Name:") + ' ' + self.name text1 = [] if self.dir_size > -1: text1.append(realSize(self.dir_size, 3)) if self.dir_count > 0: text1.append(str(self.dir_count) + ' ' + _("Directories")) if self.mov_count > 0: text1.append(str(self.mov_count) + ' ' + _("Movies")) if len(text1) > 0: text += " (" + ", ".join(text1) + ")" text = [text] #mount_path = self.getmount() # TODO temporary disabled, performance issue on mass storage devices if config.AdvancedMovieSelection.show_diskusage.value and os.path.exists( self.dir_path): total, used, free = diskUsage(self.dir_path) #text.append(_("Media:") + ' ' + str(mount_path)) text.append(_("Total:") + ' ' + realSize(total, 3)) text.append(_("Used:") + ' ' + realSize(used, 3)) text.append(_("Free:") + ' ' + realSize(free, 3)) real_path = os.path.realpath(self.dir_path) + os.sep if self.dir_path != real_path: text.append(_("Symlink:") + ' ' + real_path) return "\n".join(text)
def getDirDescription(self): text = _("Name:") + ' ' + self.name text1 = [] if self.dir_size > -1: text1.append(realSize(self.dir_size, 3)) if self.dir_count > 0: text1.append(str(self.dir_count) + ' ' + _("Directories")) if self.mov_count > 0: text1.append(str(self.mov_count) + ' ' + _("Movies")) if len(text1) > 0: text += " (" + ", ".join(text1) + ")" text = [text] #mount_path = self.getmount() # TODO temporary disabled, performance issue on mass storage devices if config.AdvancedMovieSelection.show_diskusage.value and os.path.exists(self.dir_path): total, used, free = diskUsage(self.dir_path) #text.append(_("Media:") + ' ' + str(mount_path)) text.append(_("Total:") + ' ' + realSize(total, 3)) text.append(_("Used:") + ' ' + realSize(used, 3)) text.append(_("Free:") + ' ' + realSize(free, 3)) real_path = os.path.realpath(self.dir_path) + os.sep if self.dir_path != real_path: text.append(_("Symlink:") + ' ' + real_path) return "\n".join(text)
def isDiskSpaceChanged(self, update=True): total, used, free = diskUsage(self.dir_path) result = self.used != used if result and update: print "[AdvancedMovieSelection] update disc usage:", total, self.used, used, free self.used = used return result
def update(self): try: total, used, free = diskUsage(self.path) if self.type == self.FREE: self.setText(("%s " + _("free diskspace")) % (realSize(free))) if self.type == self.USED: self.setText(("%s " + _("used diskspace")) % (realSize(used))) if self.type == self.SIZE: self.setText(("%s " + _("total diskspace")) % (realSize(total))) except OSError: return -1
def getFullUsed(self): full_used = 0 for p in config.AdvancedMovieSelection.videodirs.value: total, used, free = diskUsage(p) full_used += used return full_used