add id to music search display and sort

pull/1/head
qwewqa 4 years ago
parent eb88a52bb5
commit 3850820794
  1. 1
      miyu_bot/commands/cogs/event.py
  2. 4
      miyu_bot/commands/cogs/music.py

@ -34,6 +34,7 @@ class Event(commands.Cog):
event: EventMaster event: EventMaster
if arg: if arg:
# Allows relative id searches like `!event +1` for next event or `!event -2` for the event before last event
if arg[0] in ['-', '+']: if arg[0] in ['-', '+']:
try: try:
latest = self.get_latest_event(ctx) latest = self.get_latest_event(ctx)

@ -321,6 +321,7 @@ class Music(commands.Cog):
class MusicAttribute(enum.Enum): class MusicAttribute(enum.Enum):
DefaultOrder = enum.auto() DefaultOrder = enum.auto()
Name = enum.auto() Name = enum.auto()
Id = enum.auto()
Unit = enum.auto() Unit = enum.auto()
Level = enum.auto() Level = enum.auto()
Duration = enum.auto() Duration = enum.auto()
@ -330,6 +331,7 @@ class MusicAttribute(enum.Enum):
return { return {
self.DefaultOrder: -music.default_order, self.DefaultOrder: -music.default_order,
self.Name: music.name, self.Name: music.name,
self.Id: music.id,
self.Unit: music.unit.name if not music.special_unit_name else f'{music.unit.name} ({music.special_unit_name})', self.Unit: music.unit.name if not music.special_unit_name else f'{music.unit.name} ({music.special_unit_name})',
self.Level: music.charts[4].display_level, self.Level: music.charts[4].display_level,
self.Duration: Music.get_music_duration(music), self.Duration: Music.get_music_duration(music),
@ -340,6 +342,7 @@ class MusicAttribute(enum.Enum):
return { return {
self.DefaultOrder: None, self.DefaultOrder: None,
self.Name: None, self.Name: None,
self.Id: str(music.id).zfill(7),
self.Unit: music.unit.name if not music.special_unit_name else f'{music.unit.name} ({music.special_unit_name})', self.Unit: music.unit.name if not music.special_unit_name else f'{music.unit.name} ({music.special_unit_name})',
self.Level: music.charts[4].display_level, self.Level: music.charts[4].display_level,
self.Duration: Music.format_duration(Music.get_music_duration(music)), self.Duration: Music.format_duration(Music.get_music_duration(music)),
@ -350,6 +353,7 @@ class MusicAttribute(enum.Enum):
music_attribute_names = { music_attribute_names = {
'default': MusicAttribute.DefaultOrder, 'default': MusicAttribute.DefaultOrder,
'name': MusicAttribute.Name, 'name': MusicAttribute.Name,
'id': MusicAttribute.Id,
'relevance': MusicAttribute.Name, 'relevance': MusicAttribute.Name,
'unit': MusicAttribute.Unit, 'unit': MusicAttribute.Unit,
'level': MusicAttribute.Level, 'level': MusicAttribute.Level,

Loading…
Cancel
Save