From d37c32369159b71fff486ec2d56876adc5460786 Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Tue, 7 Dec 2021 22:39:14 +0100 Subject: [PATCH] Cache thumbnail as well --- ChannelProvider/SVT/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ChannelProvider/SVT/__init__.py b/ChannelProvider/SVT/__init__.py index 25f4eed..288dbd0 100644 --- a/ChannelProvider/SVT/__init__.py +++ b/ChannelProvider/SVT/__init__.py @@ -39,6 +39,7 @@ class SVT(ChannelProvider.ChannelProvider): if key in self.m_cache.keys(): thumbnail_link = self.m_cache[key]['thumbnail_link'] + content = self.m_cache[key]['content'] resolved_link = self.m_cache[key]['resolved_link'] description = self.m_cache[key]['description'] published_parsed = self.m_cache[key]['published_parsed'] @@ -72,14 +73,16 @@ class SVT(ChannelProvider.ChannelProvider): description = str(entry['description']) published_parsed = entry['published_parsed'] title = str(entry['title']) + res = requests.get(thumbnail_link) + content = res.content + content_bytes = io.BytesIO(content) self.m_cache[key] = {'thumbnail_link': thumbnail_link} + self.m_cache[key]['content'] = content self.m_cache[key]['resolved_link'] = resolved_link self.m_cache[key]['description'] = description self.m_cache[key]['published_parsed'] = published_parsed self.m_cache[key]['title'] = title - res = requests.get(thumbnail_link) - content_bytes = io.BytesIO(res.content) image = wx.Image(content_bytes, type=wx.BITMAP_TYPE_ANY, index=-1)