From 4a7e9912c086f5ee0181c722db0e2ed6457ff28c Mon Sep 17 00:00:00 2001 From: oddluck <39967334+oddluck@users.noreply.github.com> Date: Sat, 13 Jun 2020 00:18:05 +0000 Subject: [PATCH] SpiffyTites: add description to imgur.albumTemplate --- SpiffyTitles/README.md | 2 +- SpiffyTitles/config.py | 6 +++--- SpiffyTitles/plugin.py | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/SpiffyTitles/README.md b/SpiffyTitles/README.md index eef3331..2e4fd37 100644 --- a/SpiffyTitles/README.md +++ b/SpiffyTitles/README.md @@ -218,7 +218,7 @@ Example output: Default value -`^ {%if section %}[{{section}}] {% endif -%}{%- if title -%}{{title}} :: {% endif %}{{image_count}} images :: {{view_count}} views :: {%if nsfw == None %}not sure if safe for work{% elif nsfw == True %}not safe for work!{% else %}safe for work{% endif %}` +`^ {%if section %}[{{section}}] {% endif -%}{%- if title -%}{{title}} :: {% endif %}{%- if description -%}{{description}} :: {% endif %}{{image_count}} images :: {{view_count}} views :: {%if nsfw == None %}not sure if safe for work{% elif nsfw == True %}not safe for work!{% else %}safe for work{% endif %}` Example output: diff --git a/SpiffyTitles/config.py b/SpiffyTitles/config.py index ca8f964..d000609 100644 --- a/SpiffyTitles/config.py +++ b/SpiffyTitles/config.py @@ -463,9 +463,9 @@ conf.registerChannelValue( "albumTemplate", registry.String( "^ {%if section %}[{{section}}] {% endif %}{% if title %}{{title}} :: {% endif" - " %}{{image_count}} images :: {{view_count}} views :: {%if nsfw == None %}not" - " sure if safe for work{% elif nsfw == True %}not safe for work!{% else %}safe" - " for work{% endif %}", + " %}{%- if description -%}{{description}} :: {% endif %}{{image_count}} images" + " :: {{view_count}} views :: {%if nsfw == None %}not sure if safe for work{%" + " elif nsfw == True %}not safe for work!{% else %}safe for work{% endif %}", _("""imgur album template"""), ), ) diff --git a/SpiffyTitles/plugin.py b/SpiffyTitles/plugin.py index bde422b..ad0461b 100644 --- a/SpiffyTitles/plugin.py +++ b/SpiffyTitles/plugin.py @@ -408,7 +408,10 @@ class SpiffyTitles(callbacks.Plugin): log.debug("SpiffyTitles: attempt #%s for %s" % (retries, url)) is_redirect = False try: - headers = self.get_headers(channel) + if retries > 1: + headers = self.get_headers(channel) + else: + headers = {} log.debug("SpiffyTitles: requesting %s" % (url)) with requests.get( url, @@ -1587,6 +1590,7 @@ class SpiffyTitles(callbacks.Plugin): "view_count": "{:,}".format(album["views"]), "image_count": "{:,}".format(album["images_count"]), "nsfw": album.get("nsfw"), + "description": album.get("description"), } ) return compiled_template