Ejemplo n.º 1
0
def exec_main(parser, function, localdir):
	(options, args) = parser.parse_args()
	title = False
	if hasattr(options, 'title'):
		title = True

	if not options.output:
		sys.stderr.write("-o/--output required")
		sys.exit(1)
	if not os.path.exists(options.output):
		sys.stderr.write("-o/--output points to a directory that does not exist")
		sys.exit(1)
	if not os.path.isdir(options.output):
		sys.stderr.write("-o/--output points to a file, it must point to a directory")
		sys.exit(1)
	if not options.book:
		sys.stderr.write("-b/--book required")
		sys.exit(1)
	if title:
		if not options.title:
			sys.stderr.write("-t/--title required")
			sys.exit(1)
	makedirs(options.output, options.book, localdir)
	for arg in args:
		if title:
			function(arg, options.output, options.book, options.title)
		else:
			function(arg, options.output, options.book)
Ejemplo n.º 2
0
def dump_type(output, conn, book, section_type):
    curs = conn.cursor()
    makedirs(output, book, section_type)
    try:
        if section_type == 'animal_companion':
            find_section(curs, type=section_type, subtype='base')
        else:
            find_section(curs, type=section_type)
        for section in curs.fetchall():
            section = dump_section(conn, section)
            write_type_section(output, book, section)
    finally:
        curs.close()
Ejemplo n.º 3
0
def dump_type(output, conn, book, section_type):
    curs = conn.cursor()
    makedirs(output, book, section_type)
    try:
        if section_type == "animal_companion":
            find_section(curs, type=section_type, subtype="base")
        else:
            find_section(curs, type=section_type)
        for section in curs.fetchall():
            section = dump_section(conn, section)
            write_type_section(output, book, section)
    finally:
        curs.close()