whisper-swedish / list_songs.py
sharner
Make song list output sorted
0b42d7c
import json
class ListSongs:
@staticmethod
def get_song_list():
list_output = ""
with open("./swedish_christmas_songs.json", "r", encoding='utf-8') as f:
songs = json.load(f)
sorted_songs = sorted(songs, key=lambda k: k['name'])
for song in sorted_songs:
list_output += "- " + song['name'] + "\n"
return list_output.strip()