fallback if thumbnail not present
This commit is contained in:
parent
0d8cbf6755
commit
6dc0c2c367
1 changed files with 8 additions and 3 deletions
|
@ -502,9 +502,14 @@ class PostItem(Gtk.ListBoxRow):
|
||||||
return scaled_img
|
return scaled_img
|
||||||
|
|
||||||
def get_oembed_thumb(self, oembed):
|
def get_oembed_thumb(self, oembed):
|
||||||
url = oembed.thumbnail_url
|
if 'thumbnail_url' in oembed:
|
||||||
old_width = oembed.thumbnail_width
|
url = oembed.thumbnail_url
|
||||||
old_height = oembed.thumbnail_height
|
old_width = oembed.thumbnail_width
|
||||||
|
old_height = oembed.thumbnail_height
|
||||||
|
else:
|
||||||
|
url = oembed.url
|
||||||
|
old_width = oembed.width
|
||||||
|
old_height = oembed.height
|
||||||
ratio = old_width / old_height
|
ratio = old_width / old_height
|
||||||
new_height = 256 / ratio
|
new_height = 256 / ratio
|
||||||
r = requests.get(url)
|
r = requests.get(url)
|
||||||
|
|
Loading…
Reference in a new issue