enable tiny news logos

This commit is contained in:
Justin 2022-06-12 17:59:51 +08:00 committed by GitHub
parent d04f217c24
commit cd244cd9fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1553,19 +1553,19 @@ class StockTicker():
try: try:
logo_name = source.lower().replace(' ', '-') logo_name = source.lower().replace(' ', '-')
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'news_logos') logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'tiny_news')
logo = Image.open(os.path.join(logos_path, logo_name + '.png')) logo = Image.open(os.path.join(logos_path, logo_name + '.png'))
except Exception as e: except Exception as e:
logo_name = 'default' logo_name = 'default'
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'news_logos') logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'tiny_news')
logo = Image.open(os.path.join(logos_path, logo_name + '.png')) logo = Image.open(os.path.join(logos_path, logo_name + '.png'))
width, height = logo.size width, height = logo.size
logo = logo.resize((int(width/2), int(height/2))) #logo = logo.resize((int(width/2), int(height/2)))
img = Image.new('RGB', (headline_img.size[0]+ source_img.size[0] + logo.size[0] +5, 32)) img = Image.new('RGB', (headline_img.size[0]+ source_img.size[0] + logo.size[0] +5, 32))
img.paste(headline_img, (source_img.size[0]+ logo.size[0] -5, 3)) img.paste(headline_img, (source_img.size[0]+ logo.size[0] -5, 3))