Cache thumbnail as well

main
Micke Nordin 2 years ago
parent 10e3f21f26
commit d37c323691
Signed by: micke
GPG Key ID: 0DA0A7A5708FE257

@ -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)

Loading…
Cancel
Save