diff --git a/main.py b/main.py index 87f4219..7105976 100644 --- a/main.py +++ b/main.py @@ -62,7 +62,31 @@ async def echo(_, message: filters.Message): os.remove(artwork_file) elif content_type =='albums': - await message.reply("downloading from albums does not support yet") + album = songbox.music.get_album(content_id) + artwork_file = f"{album['name']}_artwork.jpg" + await download_file(album['artwork_url'], artwork_file) + await message.reply_photo( + photo=artwork_file, + caption=( + f"**Album:** {album['name']} ({album['released_date']})\n" + f"**Artist:** {album['artist_name']}\n" + f"**Tracks:** {len(album['songs'])}\n" + f"**Share:** https://on.lavafoshi.mv/albums/{album['id']}" + ) + ) + for song in album['songs']: + audio_file = songbox.music.download_song(song['url_original']) + await message.reply_audio( + audio=audio_file, + performer=song['artist_name'], + title=song['name'], + thumb=artwork_file, + ) + if os.path.exists(audio_file): + os.remove(audio_file) + if os.path.exists(artwork_file): + os.remove(artwork_file) + elif content_type =='artists': await message.reply("downloading from artists does not support yet") new_token = songbox.auth.refresh_token()