def do_cache(self, args): """Display current cache entries, or turn cache on/off. Usage: \tDisplay: cache \tTurn on: cache on \tTurn off: cache off """ args = args.strip().lower() if args == 'on': self.pc.cache_control(True) elif args == 'off': self.pc.cache_control(False) else: if self.pc.cache_state(): cache_info = self.pc.cache_info() t = list(cache_info.keys()) t.sort() print() for s in t: print("sector %d (%d hits)" % (s, cache_info[s])) print( log.bold("Total cache usage: %s (%s maximum)" % (utils.format_bytes(len(t) * 512), utils.format_bytes(photocard.MAX_CACHE * 512)))) print( log.bold("Total cache sectors: %s of %s" % (utils.commafy( len(t)), utils.commafy(photocard.MAX_CACHE)))) else: print("Cache is off.")
def do_cache(self, args): """Display current cache entries, or turn cache on/off. Usage: \tDisplay: cache \tTurn on: cache on \tTurn off: cache off """ args = args.strip().lower() if args == 'on': self.pc.cache_control(True) elif args == 'off': self.pc.cache_control(False) else: if self.pc.cache_state(): cache_info = self.pc.cache_info() t = cache_info.keys() t.sort() print for s in t: print "sector %d (%d hits)" % (s, cache_info[s]) print log.bold("Total cache usage: %s (%s maximum)" % (utils.format_bytes(len(t)*512), utils.format_bytes(photocard.MAX_CACHE * 512))) print log.bold("Total cache sectors: %s of %s" % (utils.commafy(len(t)), utils.commafy(photocard.MAX_CACHE))) else: print "Cache is off."
def do_df(self, args): """Display free space on photo card. Options: -h\tDisplay in human readable format """ freespace = self.pc.df() if args.strip().lower() == '-h': fs = utils.format_bytes(freespace) else: fs = utils.commafy(freespace) print("Freespace = %s Bytes" % fs)
def do_df(self, args): """Display free space on photo card. Options: -h\tDisplay in human readable format """ freespace = self.pc.df() if args.strip().lower() == '-h': fs = utils.format_bytes(freespace) else: fs = utils.commafy(freespace) print "Freespace = %s Bytes" % fs
def do_card(self, args): """Print info about photocard.""" print() print("Device URI = %s" % self.pc.device.device_uri) print("Model = %s" % self.pc.device.model_ui) print("Working dir = %s" % self.pc.pwd()) disk_info = self.pc.info() print("OEM ID = %s" % disk_info[0]) print("Bytes/sector = %d" % disk_info[1]) print("Sectors/cluster = %d" % disk_info[2]) print("Reserved sectors = %d" % disk_info[3]) print("Root entries = %d" % disk_info[4]) print("Sectors/FAT = %d" % disk_info[5]) print("Volume label = %s" % disk_info[6]) print("System ID = %s" % disk_info[7]) print("Write protected = %d" % disk_info[8]) print("Cached sectors = %s" % utils.commafy(len(self.pc.cache_info())))
def do_card(self, args): """Print info about photocard.""" print print "Device URI = %s" % self.pc.device.device_uri print "Model = %s" % self.pc.device.model_ui print "Working dir = %s" % self.pc.pwd() disk_info = self.pc.info() print "OEM ID = %s" % disk_info[0] print "Bytes/sector = %d" % disk_info[1] print "Sectors/cluster = %d" % disk_info[2] print "Reserved sectors = %d" % disk_info[3] print "Root entries = %d" % disk_info[4] print "Sectors/FAT = %d" % disk_info[5] print "Volume label = %s" % disk_info[6] print "System ID = %s" % disk_info[7] print "Write protected = %d" % disk_info[8] print "Cached sectors = %s" % utils.commafy(len(self.pc.cache_info()))