Dolda2000 GitWeb
/
automanga.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
66efacb
)
Fixed some getmanga pattern expansion bugs.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Mon, 15 May 2017 03:21:32 +0000
(
05:21
+0200)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Mon, 15 May 2017 03:21:32 +0000
(
05:21
+0200)
getmanga
patch
|
blob
|
blame
|
history
diff --git
a/getmanga
b/getmanga
index
a2d3eca
..
e6a9c96
100755
(executable)
--- a/
getmanga
+++ b/
getmanga
@@
-37,33
+37,35
@@
def expand(pattern, page):
ret = ""
si = 0
fp = 0
ret = ""
si = 0
fp = 0
+ stack = list(zip([t for t, i in page.stack], [t for t, i in page.stack[1:]] + [page], [i for t, i in page.stack]))
while True:
p = pattern.find('%', fp)
if p < 0:
while True:
p = pattern.find('%', fp)
if p < 0:
- if si < len(
page.
stack):
+ if si < len(stack):
sys.stderr.write("getmanga: pattern %s did not match page %s\n" %
sys.stderr.write("getmanga: pattern %s did not match page %s\n" %
- (pattern, "/".join(
t.name for t, i in page.
stack)))
+ (pattern, "/".join(
c.name for t, c, i in
stack)))
sys.exit(1)
return ret + pattern[fp:]
ret += pattern[fp:p]
sys.exit(1)
return ret + pattern[fp:]
ret += pattern[fp:p]
- m = pattern[p:p + 1]
+ m = pattern[p + 1:p + 2]
+ fp = p + 2
if m == "%":
ret += "%"
else:
if m == "%":
ret += "%"
else:
- if si >= len(
page.
stack):
+ if si >= len(stack):
sys.stderr.write("getmanga: pattern %s did not match page %s\n" %
sys.stderr.write("getmanga: pattern %s did not match page %s\n" %
- (pattern, "/".join(
t.name for t, i in page.
stack)))
+ (pattern, "/".join(
c.name for t, c, i in
stack)))
sys.exit(1)
sys.exit(1)
- t,
ti = page.
stack[si]
+ t,
ct, ti =
stack[si]
si += 1
if m == "i":
ret += "%0*i" % (digits(len(t) + 1), ti + 1)
elif m == "n":
si += 1
if m == "i":
ret += "%0*i" % (digits(len(t) + 1), ti + 1)
elif m == "n":
- ret += t.name
+ ret +=
c
t.name
elif m == "d":
elif m == "d":
- ret += t.id
+ ret +=
c
t.id
else:
else:
- sys.stderr.write("getmanga: %s: unknown specifie
d `%s'\n" % (
m))
+ sys.stderr.write("getmanga: %s: unknown specifie
r `%s'\n" % (pattern,
m))
sys.exit(1)
def download(mng, tdir, pattern):
sys.exit(1)
def download(mng, tdir, pattern):