Revert "[tumblr] add option to sort photosets by upload order"
This reverts commit 4a26ae32df.
This commit is contained in:
@@ -587,18 +587,6 @@ Description Extract images from reblogged posts.
|
|||||||
=========== =====
|
=========== =====
|
||||||
|
|
||||||
|
|
||||||
extractor.tumblr.sort
|
|
||||||
---------------------
|
|
||||||
=========== =====
|
|
||||||
Type ``bool``
|
|
||||||
Default ``false``
|
|
||||||
Description Sort photos of a Photoset according to their original upload order.
|
|
||||||
|
|
||||||
Otherwise these photos will be returned in the order the blog owner
|
|
||||||
arranged them in.
|
|
||||||
=========== =====
|
|
||||||
|
|
||||||
|
|
||||||
extractor.tumblr.posts
|
extractor.tumblr.posts
|
||||||
----------------------
|
----------------------
|
||||||
=========== =====
|
=========== =====
|
||||||
|
|||||||
@@ -102,8 +102,7 @@
|
|||||||
"external": false,
|
"external": false,
|
||||||
"inline": false,
|
"inline": false,
|
||||||
"posts": "photo",
|
"posts": "photo",
|
||||||
"reblogs": true,
|
"reblogs": true
|
||||||
"sort": false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ class TumblrExtractor(Extractor):
|
|||||||
self.inline = self.config("inline", False)
|
self.inline = self.config("inline", False)
|
||||||
self.reblogs = self.config("reblogs", True)
|
self.reblogs = self.config("reblogs", True)
|
||||||
self.external = self.config("external", False)
|
self.external = self.config("external", False)
|
||||||
self.sort_photos = self.config("sort", False)
|
|
||||||
|
|
||||||
if len(self.types) == 1:
|
if len(self.types) == 1:
|
||||||
self.api.posts_type = next(iter(self.types))
|
self.api.posts_type = next(iter(self.types))
|
||||||
@@ -96,9 +95,6 @@ class TumblrExtractor(Extractor):
|
|||||||
photos = post["photos"]
|
photos = post["photos"]
|
||||||
del post["photos"]
|
del post["photos"]
|
||||||
|
|
||||||
if self.sort_photos and len(photos) > 1:
|
|
||||||
photos.sort(key=self._get_tumblr_offset)
|
|
||||||
|
|
||||||
for photo in photos:
|
for photo in photos:
|
||||||
post["photo"] = photo
|
post["photo"] = photo
|
||||||
photo.update(photo["original_size"])
|
photo.update(photo["original_size"])
|
||||||
@@ -165,15 +161,6 @@ class TumblrExtractor(Extractor):
|
|||||||
|
|
||||||
return Message.Urllist, _original_image(url), post
|
return Message.Urllist, _original_image(url), post
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _get_tumblr_offset(photo):
|
|
||||||
"""Return the offset embedded in a photo's URL"""
|
|
||||||
return util.safe_int(
|
|
||||||
photo["original_size"]["url"]
|
|
||||||
.rpartition("_")[0]
|
|
||||||
.rpartition("o")[2]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class TumblrUserExtractor(TumblrExtractor):
|
class TumblrUserExtractor(TumblrExtractor):
|
||||||
"""Extractor for all images from a tumblr-user"""
|
"""Extractor for all images from a tumblr-user"""
|
||||||
|
|||||||
Reference in New Issue
Block a user