music-kraken-core/src/metal_archives.py

42 lines
1.2 KiB
Python
Raw Normal View History

2023-03-02 15:23:02 +00:00
from music_kraken import objects
2023-03-27 15:48:06 +00:00
from music_kraken.pages import EncyclopaediaMetallum
2023-01-30 22:54:21 +00:00
2023-03-02 06:59:53 +00:00
2023-03-27 15:48:06 +00:00
def search():
results = EncyclopaediaMetallum.search_by_query("#a Ghost Bath")
print(results)
2023-03-27 16:41:50 +00:00
print(results[0].source_collection)
2022-11-24 13:13:55 +00:00
2023-03-13 13:47:49 +00:00
2023-03-27 15:48:06 +00:00
def fetch_artist():
artist = objects.Artist(
2023-03-27 16:41:50 +00:00
source_list=[
objects.Source(objects.SourcePages.MUSIFY, "https://musify.club/artist/psychonaut-4-83193"),
objects.Source(objects.SourcePages.ENCYCLOPAEDIA_METALLUM, "https://www.metal-archives.com/bands/Ghost_Bath/3540372489")
]
2023-03-27 15:48:06 +00:00
)
2023-03-10 17:38:32 +00:00
2023-03-27 15:48:06 +00:00
artist = EncyclopaediaMetallum.fetch_details(artist)
print(artist.options)
2023-03-14 11:02:58 +00:00
2023-03-27 15:48:06 +00:00
def fetch_album():
album = objects.Album(
source_list=[objects.Source(objects.SourcePages.MUSIFY,
"https://musify.club/release/linkin-park-hybrid-theory-2000-188")]
)
album: objects.Album = EncyclopaediaMetallum.fetch_details(album)
print(album.options)
song: objects.Song
for artist in album.artist_collection:
print(artist.id, artist.name)
for song in album.song_collection:
for artist in song.main_artist_collection:
print(artist.id, artist.name)
if __name__ == "__main__":
2023-03-27 16:41:50 +00:00
fetch_artist()