[tumblr] rename 'offset' to 'num and adjust formats
Trying to somehow emulate Tumblr filenames is a bad idea ...
This commit is contained in:
@@ -52,8 +52,8 @@ class TumblrExtractor(Extractor):
|
|||||||
"""Base class for tumblr extractors"""
|
"""Base class for tumblr extractors"""
|
||||||
category = "tumblr"
|
category = "tumblr"
|
||||||
directory_fmt = ["{category}", "{name}"]
|
directory_fmt = ["{category}", "{name}"]
|
||||||
filename_fmt = "{category}_{blog_name}_{id}o{offset}.{extension}"
|
filename_fmt = "{category}_{blog_name}_{id}_{num:>02}.{extension}"
|
||||||
archive_fmt = "{id}_{offset}"
|
archive_fmt = "{id}_{num}"
|
||||||
|
|
||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
Extractor.__init__(self)
|
Extractor.__init__(self)
|
||||||
@@ -87,7 +87,7 @@ class TumblrExtractor(Extractor):
|
|||||||
post["reblogged"] = reblog
|
post["reblogged"] = reblog
|
||||||
|
|
||||||
post["blog"] = blog
|
post["blog"] = blog
|
||||||
post["offset"] = 0
|
post["num"] = 0
|
||||||
|
|
||||||
if "trail" in post:
|
if "trail" in post:
|
||||||
del post["trail"]
|
del post["trail"]
|
||||||
@@ -148,14 +148,14 @@ class TumblrExtractor(Extractor):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _prepare(url, post):
|
def _prepare(url, post):
|
||||||
text.nameext_from_url(url, post)
|
text.nameext_from_url(url, post)
|
||||||
post["offset"] += 1
|
post["num"] += 1
|
||||||
post["hash"] = post["name"].partition("_")[2]
|
post["hash"] = post["name"].partition("_")[2]
|
||||||
return Message.Url, url, post
|
return Message.Url, url, post
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _prepare_image(url, post):
|
def _prepare_image(url, post):
|
||||||
text.nameext_from_url(url, post)
|
text.nameext_from_url(url, post)
|
||||||
post["offset"] += 1
|
post["num"] += 1
|
||||||
|
|
||||||
parts = post["name"].split("_")
|
parts = post["name"].split("_")
|
||||||
post["hash"] = parts[1] if parts[1] != "inline" else parts[2]
|
post["hash"] = parts[1] if parts[1] != "inline" else parts[2]
|
||||||
@@ -237,7 +237,7 @@ class TumblrLikesExtractor(TumblrExtractor):
|
|||||||
"""Extractor for images from a tumblr-user by tag"""
|
"""Extractor for images from a tumblr-user by tag"""
|
||||||
subcategory = "likes"
|
subcategory = "likes"
|
||||||
directory_fmt = ["{category}", "{name}", "likes"]
|
directory_fmt = ["{category}", "{name}", "likes"]
|
||||||
archive_fmt = "f_{blog[name]}_{id}_{offset}"
|
archive_fmt = "f_{blog[name]}_{id}_{num}"
|
||||||
pattern = [BASE_PATTERN + r"/likes"]
|
pattern = [BASE_PATTERN + r"/likes"]
|
||||||
test = [("http://mikf123.tumblr.com/likes", {
|
test = [("http://mikf123.tumblr.com/likes", {
|
||||||
"count": 1,
|
"count": 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user