[shimmie2] small optimizations
- unroll/remove loop - avoid copy
This commit is contained in:
@@ -41,8 +41,9 @@ class Shimmie2Extractor(BaseExtractor):
|
|||||||
|
|
||||||
for post in self.posts():
|
for post in self.posts():
|
||||||
|
|
||||||
for key in ("id", "width", "height"):
|
post["id"] = text.parse_int(post["id"])
|
||||||
post[key] = text.parse_int(post[key])
|
post["width"] = text.parse_int(post["width"])
|
||||||
|
post["height"] = text.parse_int(post["height"])
|
||||||
post["tags"] = text.unquote(post["tags"])
|
post["tags"] = text.unquote(post["tags"])
|
||||||
post.update(data)
|
post.update(data)
|
||||||
|
|
||||||
@@ -147,8 +148,11 @@ class Shimmie2TagExtractor(Shimmie2Extractor):
|
|||||||
if not pid:
|
if not pid:
|
||||||
break
|
break
|
||||||
|
|
||||||
tags, dimensions, size = extr(
|
data = extr("title="+quote, quote).split(" // ")
|
||||||
"title="+quote, quote).split(" // ")[:3]
|
tags = data[0]
|
||||||
|
dimensions = data[1]
|
||||||
|
size = data[2]
|
||||||
|
|
||||||
width, _, height = dimensions.partition("x")
|
width, _, height = dimensions.partition("x")
|
||||||
md5 = extr("/_thumbs/", "/")
|
md5 = extr("/_thumbs/", "/")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user