use exported event logos instead of upload
This commit is contained in:
parent
d325eab760
commit
7bb702f532
@ -19,12 +19,16 @@ def main():
|
|||||||
card_dir = target_dir / 'cards'
|
card_dir = target_dir / 'cards'
|
||||||
card_icon_dir = card_dir / 'icons'
|
card_icon_dir = card_dir / 'icons'
|
||||||
card_art_dir = card_dir / 'art'
|
card_art_dir = card_dir / 'art'
|
||||||
|
event_dir = target_dir / 'events'
|
||||||
|
event_logo_dir = event_dir / 'logos'
|
||||||
|
|
||||||
music_dir.mkdir(exist_ok=True)
|
music_dir.mkdir(exist_ok=True)
|
||||||
chart_dir.mkdir(exist_ok=True)
|
chart_dir.mkdir(exist_ok=True)
|
||||||
card_dir.mkdir(exist_ok=True)
|
card_dir.mkdir(exist_ok=True)
|
||||||
card_icon_dir.mkdir(exist_ok=True)
|
card_icon_dir.mkdir(exist_ok=True)
|
||||||
card_art_dir.mkdir(exist_ok=True)
|
card_art_dir.mkdir(exist_ok=True)
|
||||||
|
event_dir.mkdir(exist_ok=True)
|
||||||
|
event_logo_dir.mkdir(exist_ok=True)
|
||||||
|
|
||||||
for music in asset_manager.music_master.values():
|
for music in asset_manager.music_master.values():
|
||||||
for chart in music.charts.values():
|
for chart in music.charts.values():
|
||||||
@ -49,6 +53,15 @@ def main():
|
|||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
for event in asset_manager.event_master.values():
|
||||||
|
try:
|
||||||
|
event_hash = hash_master(event)
|
||||||
|
logo_path = event.logo_path
|
||||||
|
logo_target = event_logo_dir / f'{logo_path.stem}_{event_hash}{logo_path.suffix}'
|
||||||
|
shutil.copy(logo_path, logo_target)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
@ -16,7 +16,7 @@ from miyu_bot.commands.common.emoji import attribute_emoji_ids_by_attribute_id,
|
|||||||
event_point_emoji_id
|
event_point_emoji_id
|
||||||
from miyu_bot.commands.common.formatting import format_info
|
from miyu_bot.commands.common.formatting import format_info
|
||||||
from miyu_bot.commands.common.fuzzy_matching import romanize
|
from miyu_bot.commands.common.fuzzy_matching import romanize
|
||||||
from miyu_bot.commands.common.master_asset_manager import MasterFilter
|
from miyu_bot.commands.common.master_asset_manager import MasterFilter, hash_master
|
||||||
from miyu_bot.commands.common.reaction_message import run_paged_message
|
from miyu_bot.commands.common.reaction_message import run_paged_message
|
||||||
|
|
||||||
|
|
||||||
@ -53,14 +53,11 @@ class Event(commands.Cog):
|
|||||||
return
|
return
|
||||||
self.logger.info(f'Found event "{event}" ({romanize(event.name)}).')
|
self.logger.info(f'Found event "{event}" ({romanize(event.name)}).')
|
||||||
|
|
||||||
try:
|
|
||||||
logo = discord.File(event.logo_path, filename='logo.png')
|
|
||||||
except FileNotFoundError:
|
|
||||||
# Just a fallback
|
|
||||||
logo = discord.File(asset_manager.path / 'ondemand/stamp/stamp_10006.png', filename='logo.png')
|
|
||||||
|
|
||||||
embed = discord.Embed(title=event.name)
|
embed = discord.Embed(title=event.name)
|
||||||
embed.set_thumbnail(url=f'attachment://logo.png')
|
|
||||||
|
event_hash = hash_master(event)
|
||||||
|
event_logo_path = event.logo_path
|
||||||
|
embed.set_thumbnail(url=f'https://qwewqa.github.io/d4dj-dumps/events/logos/{event_logo_path.stem}_{event_hash}{event_logo_path.suffix}')
|
||||||
|
|
||||||
duration_hour_part = round((event.duration.seconds / 3600), 2)
|
duration_hour_part = round((event.duration.seconds / 3600), 2)
|
||||||
duration_hour_part = duration_hour_part if not duration_hour_part.is_integer() else int(duration_hour_part)
|
duration_hour_part = duration_hour_part if not duration_hour_part.is_integer() else int(duration_hour_part)
|
||||||
@ -109,7 +106,7 @@ class Event(commands.Cog):
|
|||||||
inline=True)
|
inline=True)
|
||||||
embed.set_footer(text=f'Event Id: {event.id}')
|
embed.set_footer(text=f'Event Id: {event.id}')
|
||||||
|
|
||||||
await ctx.send(files=[logo], embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
@commands.command(name='time',
|
@commands.command(name='time',
|
||||||
aliases=[],
|
aliases=[],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user