Dolda2000 GitWeb
/
utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ann.py: Improved list matching.
[utils.git]
/
ann.py
diff --git
a/ann.py
b/ann.py
index
ee3d472
..
0b583ff
100644
(file)
--- a/
ann.py
+++ b/
ann.py
@@
-157,7
+157,7
@@
class anime(object):
linkpat = re.compile("^/encyclopedia/anime\\.php\\?id=(\d+)$")
def getlist(name):
linkpat = re.compile("^/encyclopedia/anime\\.php\\?id=(\d+)$")
def getlist(name):
- name = s(name, "^
the
\s+", "")
+ name = s(name, "^
(the|a)
\s+", "")
if len(name) < 1:
raise error("list() needs a prefix of at least one character")
fc = name[0]
if len(name) < 1:
raise error("list() needs a prefix of at least one character")
fc = name[0]
@@
-169,15
+169,19
@@
def getlist(name):
ret = []
ldiv = afind(afind(d, "div", id="maincontent"), "div", "lst")
for link in ldiv("a", "HOVERLINE"):
ret = []
ldiv = afind(afind(d, "div", id="maincontent"), "div", "lst")
for link in ldiv("a", "HOVERLINE"):
-
mn
= ""
+
rawname
= ""
for el in link.font:
if isinstance(el, str):
for el in link.font:
if isinstance(el, str):
- mn += el.strip()
+ rawname += el.strip()
+ mn = rawname.lower()
+ mn = s(mn, "^a\s+", "")
+ mn = mn.replace("\u014d", "ou")
+ mn = mn.replace("\u016b", "uu")
if mn.lower().startswith(name.lower()):
m = linkpat.match(link["href"])
if not m:
raise incompatible()
found = anime.byid(int(m.groups()[0]))
if mn.lower().startswith(name.lower()):
m = linkpat.match(link["href"])
if not m:
raise incompatible()
found = anime.byid(int(m.groups()[0]))
- found.rawname =
mn
+ found.rawname =
rawname
ret.append(found)
return ret
ret.append(found)
return ret