OSDN Git Service

change markup.py's options: md5file isn't require.
[otptools/otptools.git] / markup.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3  
4 import sys
5 import os
6 import codecs
7
8 rootpath = r"C:\Users\hirom\bin\otptools"
9 sys.path.insert(0, rootpath)
10
11 import markupper
12
13
14 str_usage = "markup.pl hashfile targetfile\n"
15 path_to_index = "./_markup_index"
16
17 # sys.stdin = codecs.getreader('utf_8')(sys.stdin)
18 # sys.stdout = codecs.getwriter('utf_8')(sys.stdout)
19
20 try:
21 #    path_img_hash = sys.argv[1]
22     path_target = sys.argv[1]
23 except IndexError:
24     sys.exit(str_usage)
25
26 markupper = markupper.Markupper()
27 #markupper.make_hashlist(path_img_hash)
28 markupper.load_index(path_to_index)
29
30 file_target = codecs.open(path_target, "r", "utf_8" )
31 # file_target = open(path_target, "r")
32
33 markupper.index_add("file", path_target)
34 markupper.index_add("anchors", [])
35
36 markupper.markup(file_target, 0)
37
38 markupper.save_index(path_to_index)
39