2021-02-06 00:46:04 +09:00
|
|
|
import os
|
|
|
|
|
|
|
|
from yandex_music import Client
|
|
|
|
|
|
|
|
|
|
|
|
TOKEN = os.environ.get('TOKEN')
|
|
|
|
|
2022-02-20 02:59:53 +09:00
|
|
|
client = Client(TOKEN).init()
|
2021-02-06 00:46:04 +09:00
|
|
|
|
|
|
|
queues = client.queues_list()
|
|
|
|
# Последняя проигрываемая очередь всегда в начале списка
|
|
|
|
last_queue = client.queue(queues[0].id)
|
|
|
|
|
2021-02-06 01:39:57 +09:00
|
|
|
last_track_id = last_queue.get_current_track()
|
|
|
|
last_track = last_track_id.fetch_track()
|
2021-02-06 00:46:04 +09:00
|
|
|
|
2021-02-06 01:39:57 +09:00
|
|
|
artists = ', '.join(last_track.artists_name())
|
2021-02-06 00:46:04 +09:00
|
|
|
title = last_track.title
|
|
|
|
print(f'Сейчас играет: {artists} - {title}')
|
|
|
|
|
|
|
|
supplement = last_track.get_supplement()
|
|
|
|
if supplement.lyrics:
|
|
|
|
print(supplement.lyrics.full_lyrics)
|
|
|
|
else:
|
|
|
|
print('Текст песни отсутствует')
|