Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTimoxaYT committed Sep 25, 2022
1 parent 53d1c3f commit 95a2ba0
Showing 1 changed file with 31 additions and 24 deletions.
55 changes: 31 additions & 24 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,36 @@

# Work until the program doesnt stoped
while True:
queues = client.queues_list()
last_queue = client.queue(queues[0].id)
last_track_id = last_queue.get_current_track()
last_track = last_track_id.fetch_track()
artists = ', '.join(last_track.artists_name())
title = last_track.title
track_link = f"https://music.yandex.ru/album/{last_track['albums'][0]['id']}/track/{last_track['id']}/"
image_link="https://" + last_track.cover_uri.replace("%%", "1000x1000")
btns = [
{
"label": "Слушать Трек",
"url": track_link
}
]
try:
queues = client.queues_list()
last_queue = client.queue(queues[0].id)
last_track_id = last_queue.get_current_track()
last_track = last_track_id.fetch_track()
artists = ', '.join(last_track.artists_name())
title = last_track.title
track_link = f"https://music.yandex.ru/album/{last_track['albums'][0]['id']}/track/{last_track['id']}/"
image_link="https://" + last_track.cover_uri.replace("%%", "1000x1000")
btns = [
{
"label": "Слушать Трек",
"url": track_link
}
]

RPC.update(
details="Слушает: " + title,
state="Исполнитель: " + artists,
large_image=image_link,
small_image="Link for small image if you want",
large_text="Your Text Here",
small_text="Your Text Here",
buttons=btns
)

RPC.update(
details="Слушает: " + title,
state="Исполнитель: " + artists,
large_image=image_link,
small_image="Link for small image if you want",
large_text="Your Text Here",
small_text="Your Text Here",
buttons=btns
)
except:
RPC.update(
details='Поддерживаются только треки из плейлистов 😥',
state='Попробуй включить трек из плейлистов 🙃',
large_image='https://c.tenor.com/ZuIbNWpIN5MAAAAC/rias-gremory-high-school-dxd.gif'
)

time.sleep(1) # update the rpc status (in seconds), default: 1

0 comments on commit 95a2ba0

Please sign in to comment.