Ejemplo n.º 1
0
	def default(self):
		"""
		Default action fetches all the stats and renders a template using them
		"""
		stats = {}

		# get all the thumbnails
		stats["Database stats"] = [
			("Number of marked files", Photo.get_num_marked_photos(), "raw"),
			("Number of DB files", Photo.get_count_by_date(), "raw")
		]

		stats["File System stats"] = []
		for s in [Photo.SMALL_THUMB_SIZE, Photo.MEDIUM_THUMB_SIZE]:
			stats["File System stats"].extend(self._thumb_info(s))
			
		num_images = 0
		total_size = 0
		for root, dirs, files in os.walk(S.BASE_FS_PATH):
			for f in files:
				if util.is_image_file(f):
					num_images += 1
					total_size += os.path.getsize(os.path.join(root, f))
		stats["File System stats"].extend([
			("Number of source images", num_images, "raw"),
			("Disk space", total_size, "bytes")
		])

		return self.construct_response(Template.render("stats.html", {"stats": stats}))
Ejemplo n.º 2
0
    def default(self):
        """
		Default action fetches all the stats and renders a template using them
		"""
        stats = {}

        # get all the thumbnails
        stats["Database stats"] = [
            ("Number of marked files", Photo.get_num_marked_photos(), "raw"),
            ("Number of DB files", Photo.get_count_by_date(), "raw")
        ]

        stats["File System stats"] = []
        for s in [Photo.SMALL_THUMB_SIZE, Photo.MEDIUM_THUMB_SIZE]:
            stats["File System stats"].extend(self._thumb_info(s))

        num_images = 0
        total_size = 0
        for root, dirs, files in os.walk(S.BASE_FS_PATH):
            for f in files:
                if util.is_image_file(f):
                    num_images += 1
                    total_size += os.path.getsize(os.path.join(root, f))
        stats["File System stats"].extend([
            ("Number of source images", num_images, "raw"),
            ("Disk space", total_size, "bytes")
        ])

        return self.construct_response(
            Template.render("stats.html", {"stats": stats}))