+ if si < len(stack):
+ inames.append((ct, ret))
+
+checkednames = None
+def checknames(tdir, names):
+ global checkednames
+ nmpath = os.path.join(tdir, "names")
+ if checkednames is None:
+ checkednames = {}
+ if os.path.exists(nmpath):
+ with open(nmpath) as fp:
+ for line in fp:
+ line = line.strip()
+ p = line.find(' ')
+ if p < 0: continue
+ checkednames[line[:p]] = line[p + 1:]
+ for t, prefix in names:
+ if not prefix: continue
+ if ' ' not in prefix and prefix not in checkednames:
+ with manga.profile.txfile(nmpath, "w") as fp:
+ if '\n' not in t.name:
+ checkednames[prefix] = t.name
+ msg(1, "adding name %s for %s" % (t.name, prefix))
+ else:
+ checkednames[prefix] = ""
+ sys.stderr.write("getmanga: warning: node names contains newlines: %r\n" % (t.name,))
+ for prefix, name in checkednames.items():
+ if not name: continue
+ fp.write("%s %s\n" % (prefix, name))