Ejemplo n.º 1
0
	def __getattr__(self, name):
		if not self.__wrappee:
			# fetch wrappee
			br = newBrowser(self.__url)
			br.select_form("watch_form")
			url = br.submit().geturl()
			self.__wrappee = handlers.wrap(url)

		return getattr(self.__wrappee, name)
Ejemplo n.º 2
0
def md(path, file, outdir, args):
  with open(os.path.join(path, file)) as f:
    html = markdown.markdown(f.read())
  outfile = os.path.join(outdir, file.rsplit('.', 1)[0] + '.html')
  if args.md_template:
    html = wrap(args.md_template, content=html)
  with open(outfile, 'w') as f:
    f.write(html)
  return True
Ejemplo n.º 3
0
import handlers

drwho = handlers.wrap("http://www.btvguide.com/Doctor-Who")

print drwho.title()

for season in drwho:
	print "    " + season.title()

	for episode in season:
		print "        " + episode.title()

Ejemplo n.º 4
0
def get_tree(obj):
	global head_title 
	head_title = obj.title()
	res = {"name": obj.title(), "obj-data": obj}
	if hasattr(obj, "__getitem__"):
		res["children"] = []
		for item in obj:
			con = {"name": item.title(), "obj-data": item}
			if(hasattr(item, "__getitem__")):
				con["children"] = []
			res["children"].append(con)
	return res


import handlers
import sys
if len(sys.argv) > 1:
	drwho = handlers.wrap("http://www.btvguide.com/%s" % " ".join(sys.argv[1:]).replace(" ", "-"))
else:
	drwho = handlers.wrap("http://www.btvguide.com/Doctor-Who")


def starts_expanded(val):
	if val == head_title:
		return True
	return False


sample = get_tree(drwho)
ExampleTreeBrowser(sample, title=head_title).main()