| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | #======================================================================= | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | __version__ = '''0.0.01''' | 
					
						
							| 
									
										
										
										
											2013-05-21 23:25:55 +04:00
										 |  |  | __sub_version__ = '''20130521225013''' | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | __copyright__ = '''(c) Alex A. Naanou 2012''' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #----------------------------------------------------------------------- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import os | 
					
						
							|  |  |  | import Image | 
					
						
							|  |  |  | import json | 
					
						
							| 
									
										
										
										
											2012-09-23 16:53:44 +04:00
										 |  |  | import sha | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | import urllib2 | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | from pli.logictypes import OR | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-21 23:25:55 +04:00
										 |  |  | import gid | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | #----------------------------------------------------------------------- | 
					
						
							| 
									
										
										
										
											2012-09-22 03:55:11 +04:00
										 |  |  | # XXX fanatically cleanup and normalise paths... | 
					
						
							|  |  |  | # XXX use real uuid's... | 
					
						
							|  |  |  | # | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | # TODO: | 
					
						
							|  |  |  | # 	- load config from file... | 
					
						
							|  |  |  | # 	- accept a path on command-line | 
					
						
							|  |  |  | # 	- default path is cwd | 
					
						
							| 
									
										
										
										
											2012-09-22 03:23:53 +04:00
										 |  |  | # 	- support nested fav's for ribbons | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Long Term TODO: | 
					
						
							|  |  |  | # 	- support processed images | 
					
						
							|  |  |  | # | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | # | 
					
						
							|  |  |  | #----------------------------------------------------------------------- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | config = { | 
					
						
							| 
									
										
										
										
											2013-05-21 23:25:55 +04:00
										 |  |  | 	'format-version': '2.0', | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 	'cache-structure': { | 
					
						
							|  |  |  | 		# XXX make these as close to standard as possible and keep | 
					
						
							|  |  |  | 		# 	  sane distances... | 
					
						
							|  |  |  | 		'150px': '.ImageGridCache/150px/', | 
					
						
							|  |  |  | 		'350px': '.ImageGridCache/350px/', | 
					
						
							|  |  |  | 		'900px': '.ImageGridCache/900px/', | 
					
						
							|  |  |  | 		'1080px': '.ImageGridCache/1080px/', | 
					
						
							|  |  |  | 		'1920px': '.ImageGridCache/1920px/', | 
					
						
							|  |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2013-05-21 23:25:55 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	# gen1 format... | 
					
						
							| 
									
										
										
										
											2012-09-22 03:55:11 +04:00
										 |  |  | 	'json': '.ImageGridCache/all.json', | 
					
						
							| 
									
										
										
										
											2013-05-21 23:25:55 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	# gen3 format... | 
					
						
							|  |  |  | 	'images': '.ImageGridCache/images.json', | 
					
						
							|  |  |  | 	'data': '.ImageGridCache/data.json', | 
					
						
							|  |  |  | 	'marked': '.ImageGridCache/marked.json', | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-22 03:55:11 +04:00
										 |  |  | 	'error': '.ImageGridCache/error.log', | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 	'sizes': { | 
					
						
							|  |  |  | 		'150px': 150, | 
					
						
							|  |  |  | 		'350px': 350, | 
					
						
							|  |  |  | 		'900px': 900, | 
					
						
							|  |  |  | 		'1080px': 1080, | 
					
						
							|  |  |  | 		'1920px': 1920, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | images = { | 
					
						
							|  |  |  | 	'position': 0, | 
					
						
							|  |  |  | 	'ribbons':[ | 
					
						
							|  |  |  | 		{} | 
					
						
							|  |  |  | 	] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | IMAGE_EXT = OR(*( | 
					
						
							|  |  |  | 		'.jpg', '.jpeg', '.JPG', '.JPEG', | 
					
						
							|  |  |  | )) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-22 03:55:11 +04:00
										 |  |  | ERR_LOG = '''\
 | 
					
						
							|  |  |  | ERROR: %(error)s | 
					
						
							|  |  |  | SOURCE: %(source-file)s | 
					
						
							|  |  |  | TARGET: %(target-file)s | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | '''
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-23 16:53:44 +04:00
										 |  |  | CACHE_FILE_NAME = '%(guid)s - %(name)s' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | #----------------------------------------------------------------------- | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | def pathjoin(*p): | 
					
						
							|  |  |  | 	'''
 | 
					
						
							|  |  |  | 	'''
 | 
					
						
							|  |  |  | 	return ('/'.join(p)).replace('//', '/') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-23 16:53:44 +04:00
										 |  |  | def log_err(path, e, source_file, target_file): | 
					
						
							|  |  |  | 	'''
 | 
					
						
							|  |  |  | 	'''
 | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | 	err_file = pathjoin(path, config['error']) | 
					
						
							| 
									
										
										
										
											2012-09-23 16:53:44 +04:00
										 |  |  | 	if not os.path.exists(err_file): | 
					
						
							|  |  |  | 		err = open(err_file, 'w') | 
					
						
							|  |  |  | 	else: | 
					
						
							|  |  |  | 		err = open(err_file, 'a') | 
					
						
							|  |  |  | 	with err: | 
					
						
							|  |  |  | 		err.write(ERR_LOG % { | 
					
						
							|  |  |  | 				'source-file': source_file, | 
					
						
							|  |  |  | 				'target-file': target_file, | 
					
						
							|  |  |  | 				'error': e, | 
					
						
							|  |  |  | 		}) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # this should: | 
					
						
							|  |  |  | # 	1) see if image is cached, if yes return the cached guid (if dates match)... | 
					
						
							|  |  |  | # 	2) read the image file and get its guid  | 
					
						
							|  |  |  | ##!!! | 
					
						
							|  |  |  | def get_image_guid(path, force=False): | 
					
						
							|  |  |  | 	'''
 | 
					
						
							|  |  |  | 	'''
 | 
					
						
							|  |  |  | 	im = Image.open(path) | 
					
						
							|  |  |  | 	return sha.sha(im.tostring()).hexdigest() | 
					
						
							|  |  |  | ##	return sha.sha(open(path, 'r').read()) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | # return list of paths ending in a pattern... | 
					
						
							|  |  |  | def build_cache_dirs(path, config=config): | 
					
						
							|  |  |  | 	'''
 | 
					
						
							|  |  |  | 	'''
 | 
					
						
							|  |  |  | 	dirs = config['cache-structure'] | 
					
						
							|  |  |  | 	for _, k in dirs.items(): | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | 		p = pathjoin(path, k) | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 		if not os.path.exists(p): | 
					
						
							|  |  |  | 			os.makedirs(p) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-19 15:00:29 +04:00
										 |  |  | # image format: | 
					
						
							|  |  |  | # 	{ | 
					
						
							|  |  |  | # 		'id': <image-id>, | 
					
						
							|  |  |  | # 		'preview': { | 
					
						
							|  |  |  | # 			<resolution>: <cache-path>, | 
					
						
							|  |  |  | # 			... | 
					
						
							|  |  |  | # 		}, | 
					
						
							|  |  |  | # 		'path': <image-path> | 
					
						
							|  |  |  | # 	} | 
					
						
							|  |  |  | # | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | def build_index(path, images=None, count=None): | 
					
						
							|  |  |  | 	'''
 | 
					
						
							|  |  |  | 	'''
 | 
					
						
							|  |  |  | 	dirs = config['cache-structure'] | 
					
						
							|  |  |  | 	sizes = config['sizes']  | 
					
						
							|  |  |  | 	n = -1 | 
					
						
							|  |  |  | 	if images == None: | 
					
						
							|  |  |  | 		images = { | 
					
						
							|  |  |  | 			'position': 0, | 
					
						
							|  |  |  | 			'ribbons': [{}], | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for name in os.listdir(path): | 
					
						
							|  |  |  | 		# skip non-images... | 
					
						
							|  |  |  | 		iid, ext = os.path.splitext(name) | 
					
						
							|  |  |  | 		if ext != IMAGE_EXT: | 
					
						
							|  |  |  | 			continue | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		##!!! this is here for debuging... | 
					
						
							|  |  |  | 		n += 1 | 
					
						
							|  |  |  | 		if count != None and n >= count: | 
					
						
							|  |  |  | 			break | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		i =  { | 
					
						
							|  |  |  | 			'id': iid, | 
					
						
							|  |  |  | 			'preview': {}, | 
					
						
							|  |  |  | 			##!!! absolute paths??? | 
					
						
							|  |  |  | 			'path': 'file:///' + urllib2.quote(pathjoin(path, name), safe='/:'), | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		img = Image.open(pathjoin(path, name), 'r') | 
					
						
							|  |  |  | 		try: | 
					
						
							|  |  |  | 			iid = sha.sha(img.tostring()).hexdigest() | 
					
						
							|  |  |  | 		except IOError, e: | 
					
						
							|  |  |  | 			print 'x', | 
					
						
							|  |  |  | 			log_err(path, e, name, '-') | 
					
						
							|  |  |  | 			continue | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if iid in images['ribbons'][0]: | 
					
						
							|  |  |  | 			print '_', | 
					
						
							|  |  |  | 			continue | 
					
						
							|  |  |  | 		i['id'] = iid | 
					
						
							|  |  |  | 		images['ribbons'][0][iid] = i | 
					
						
							|  |  |  | 		print '.', | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return images | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | # XXX this will not overwrite existing files... | 
					
						
							| 
									
										
										
										
											2012-09-24 01:19:51 +04:00
										 |  |  | # XXX make this destingwish absolute and relative paths... | 
					
						
							| 
									
										
										
										
											2013-05-21 23:25:55 +04:00
										 |  |  | def make_cache_images(path, images, config=config): | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 	'''
 | 
					
						
							|  |  |  | 	'''
 | 
					
						
							|  |  |  | 	dirs = config['cache-structure'] | 
					
						
							|  |  |  | 	sizes = config['sizes']  | 
					
						
							|  |  |  | 	n = 0 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for name in os.listdir(path): | 
					
						
							|  |  |  | 		# skip non-images... | 
					
						
							|  |  |  | 		iid, ext = os.path.splitext(name) | 
					
						
							| 
									
										
										
										
											2012-09-24 00:44:52 +04:00
										 |  |  | 		source_path = pathjoin(path, name) | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 		if ext != IMAGE_EXT: | 
					
						
							|  |  |  | 			continue | 
					
						
							|  |  |  | 		n += 1 | 
					
						
							| 
									
										
										
										
											2012-09-23 16:53:44 +04:00
										 |  |  | 		i =  { | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 			'id': iid, | 
					
						
							|  |  |  | 			'preview': {}, | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | ##			'path': pathjoin(path, name), | 
					
						
							|  |  |  | 			##!!! absolute paths??? | 
					
						
							|  |  |  | 			'path': 'file:///' + urllib2.quote(pathjoin(path, name), safe='/:'), | 
					
						
							| 
									
										
										
										
											2012-09-24 00:44:52 +04:00
										 |  |  | 			'ctime': os.path.getctime(source_path), | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2012-09-24 00:44:52 +04:00
										 |  |  | 		img = Image.open(source_path, 'r') | 
					
						
							| 
									
										
										
										
											2012-09-23 16:53:44 +04:00
										 |  |  | 		try: | 
					
						
							| 
									
										
										
										
											2013-05-21 23:25:55 +04:00
										 |  |  | 			##!!! use a real gid -- gid.image_gid(path, ...) | 
					
						
							| 
									
										
										
										
											2012-09-23 16:53:44 +04:00
										 |  |  | 			iid = sha.sha(img.tostring()).hexdigest() | 
					
						
							|  |  |  | 		except IOError, e: | 
					
						
							|  |  |  | 			print 'x', | 
					
						
							|  |  |  | 			log_err(path, e, name, '-') | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | 			i['error'] = 'IOError: ' + str(e) | 
					
						
							| 
									
										
										
										
											2012-09-23 16:53:44 +04:00
										 |  |  | 			continue | 
					
						
							|  |  |  | 		finally: | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | 			# we need to know which images are dead... | 
					
						
							| 
									
										
										
										
											2012-09-23 16:53:44 +04:00
										 |  |  | 			images['ribbons'][0][iid] = i | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | 		i['id'] = iid | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 		# add original image to struct... | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | ##		i['preview'][str(max(*img.size)) + 'px'] = pathjoin(path, name) | 
					
						
							|  |  |  | 		i['preview'][str(max(*img.size)) + 'px'] = 'file:///' + urllib2.quote(pathjoin(path, name), safe='/:') | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 		# previews... | 
					
						
							|  |  |  | 		for k, spec in sizes.items(): | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | 			p = pathjoin(path, dirs[k], CACHE_FILE_NAME % {'guid': iid, 'name': name}) | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 			# do not upscale images... | 
					
						
							|  |  |  | 			if max(*img.size) <= spec: | 
					
						
							|  |  |  | 				continue | 
					
						
							|  |  |  | 			# add image to index... | 
					
						
							|  |  |  | 			if not os.path.exists(p): | 
					
						
							|  |  |  | 				scale = spec/float(max(*img.size)) | 
					
						
							| 
									
										
										
										
											2012-09-23 16:53:44 +04:00
										 |  |  | 				preview = img.resize((int(img.size[0]*scale), int(img.size[1]*scale)), Image.ANTIALIAS) | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 				preview.save(p) | 
					
						
							|  |  |  | 				##!!! metadata??? | 
					
						
							|  |  |  | 				##!!! | 
					
						
							| 
									
										
										
										
											2012-09-23 16:53:44 +04:00
										 |  |  | 				print '.', | 
					
						
							|  |  |  | 			else: | 
					
						
							|  |  |  | 				# indicate an image skip... | 
					
						
							|  |  |  | 				print '_', | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | ##			i['preview'][str(spec) + 'px'] = p | 
					
						
							|  |  |  | 			##!!! absolute paths??? | 
					
						
							|  |  |  | 			i['preview'][str(spec) + 'px'] = 'file:///' + urllib2.quote(p, safe='/:') | 
					
						
							| 
									
										
										
										
											2012-09-23 16:53:44 +04:00
										 |  |  | 		# put original image in cache... | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | ##		i['preview'][str(spec) + 'px'] = p | 
					
						
							|  |  |  | 		i['preview'][str(spec) + 'px'] = 'file:///' + urllib2.quote(p, safe='/:') | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 	images['position'] = images['ribbons'][0].keys()[0] | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | 	with open(pathjoin(path, config['json']), 'w') as f: | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 		json.dump(images, f, indent=4) | 
					
						
							|  |  |  | 	##!!! STUB... | 
					
						
							|  |  |  | 	return n | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #----------------------------------------------------------------------- | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | def build_local_cache(path): | 
					
						
							|  |  |  | 	'''
 | 
					
						
							|  |  |  | 	'''
 | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 	import time | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	t0 = time.time() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | 	build_cache_dirs(path) | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-21 23:25:55 +04:00
										 |  |  | 	n = make_cache_images(path, images) | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	t1 = time.time() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	print | 
					
						
							|  |  |  | 	print 'Processed %s images in %s seconds.' % (n, t1-t0) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 01:19:51 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | #----------------------------------------------------------------------- | 
					
						
							|  |  |  | if __name__ == '__main__': | 
					
						
							| 
									
										
										
										
											2012-12-12 17:04:51 +04:00
										 |  |  | 	from optparse import OptionParser | 
					
						
							| 
									
										
										
										
											2012-12-12 17:16:31 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-12 17:04:51 +04:00
										 |  |  | 	parser = OptionParser() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	##!!! need to define the path so that it shoes up in -h | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-12 17:16:31 +04:00
										 |  |  | 	options, args = parser.parse_args() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-12 17:04:51 +04:00
										 |  |  | 	if len(args) != 1: | 
					
						
							|  |  |  | 		parser.print_usage() | 
					
						
							|  |  |  | 	else: | 
					
						
							| 
									
										
										
										
											2012-12-12 17:16:31 +04:00
										 |  |  | 		IN_PATH = args[0] | 
					
						
							|  |  |  | 		IN_PATH = IN_PATH.replace('\\', '/') | 
					
						
							|  |  |  | 		build_local_cache(IN_PATH) | 
					
						
							| 
									
										
										
										
											2012-12-12 17:04:51 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | ##	PATH = 'images/cache-test/' | 
					
						
							| 
									
										
										
										
											2012-12-12 17:04:51 +04:00
										 |  |  | ##	PATH = 'L:/incoming/UNSORTED/Images/fav' | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-12 17:04:51 +04:00
										 |  |  | ##	build_local_cache(PATH) | 
					
						
							| 
									
										
										
										
											2012-09-23 20:39:31 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | ##	index = build_index(PATH, count=10) | 
					
						
							|  |  |  | ## | 
					
						
							|  |  |  | ##	import IPython | 
					
						
							|  |  |  | ##	IPython.embed() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-22 03:21:55 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | #======================================================================= | 
					
						
							|  |  |  | #                                            vim:set ts=4 sw=4 nowrap : |