import sys, os
+blog_filename = sys.argv[1]
+blog_root = sys.argv[2]
+
try:
import cPickle as pickle
except ImportError:
# Load old blog
-blog_filename = sys.argv[1]
try:
blog_file = open(blog_filename, "rb")
except IOError:
years = {}
# Walk the directory recursively
-for dirpath, dirs, files in os.walk(os.curdir):
+for dirpath, dirs, files in os.walk(blog_root):
d = os.path.basename(dirpath)
if not d.startswith("20") and not d.isdigit():
continue
tags = (tags,)
if title:
- key = year, month, day = tuple(dirpath.split(os.sep)[1:])
+ key = year, month, day = tuple(dirpath[len(blog_root):].split(os.sep)[1:])
if key in blog:
days = blog[key]
else:
def write_template(level, year, month, day, titles, tags=None):
- path = []
+ path = [blog_root]
if level >= 1:
path.append(year)
if level >= 2:
#end def
$phd_pp_ru.respond(self)
""")
- write_if_changed(os.path.join("tags", tag+".tmpl"), ''.join(tag_text))
+ write_if_changed(os.path.join(blog_root, "tags", tag+".tmpl"), ''.join(tag_text))
new_text.append("""\
</dl>
#end def
$phd_pp_ru.respond(self)
""")
-write_if_changed(os.path.join("tags", "index.tmpl"), ''.join(new_text))
+write_if_changed(os.path.join(blog_root, "tags", "index.tmpl"), ''.join(new_text))
LC_TIME=ru_RU.KOI8-R
export LC_TIME
-cd ../htdocs/phd.pp.ru/Russian/blog && \
-exec ../../../../phd.pp.ru/reindex_blog.py ../../../../phd.pp.ru/blog_ru "$@"
+cd ../htdocs/phd.pp.ru && \
+exec ../../phd.pp.ru/reindex_blog.py ../../phd.pp.ru/blog_ru Russian/blog