|
|
@@ -19,22 +19,35 @@ rpc_obj = rpc.DiscordIpcClient.for_platform(client_id) |
|
|
|
print("RPC connection successful.") |
|
|
|
lastTrack = "none" |
|
|
|
time.sleep(5) |
|
|
|
start_time = mktime(time.localtime()) |
|
|
|
|
|
|
|
while True: |
|
|
|
print("CHECK") |
|
|
|
queues = client.queues_list() |
|
|
|
print("1") |
|
|
|
last_queue = client.queue(queues[0].id) |
|
|
|
print("2") |
|
|
|
last_track_id = last_queue.get_current_track() |
|
|
|
print("3") |
|
|
|
last_track = last_track_id.fetch_track() |
|
|
|
print("4") |
|
|
|
artists = ', '.join(last_track.artists_name()) |
|
|
|
print("5") |
|
|
|
title = last_track.title |
|
|
|
|
|
|
|
print(f'AListening to: {artists} - {title}') |
|
|
|
if (title != lastTrack): |
|
|
|
print("CHANGED") |
|
|
|
start_time = mktime(time.localtime()) |
|
|
|
print(start_time) |
|
|
|
print(start_time + (last_track.duration_ms/1000)) |
|
|
|
print(last_track.duration_ms/1000) |
|
|
|
activity = { |
|
|
|
|
|
|
|
"state": title, |
|
|
|
"details": f'Listening to {artists} -', |
|
|
|
|
|
|
|
"timestamps": { |
|
|
|
"start": round(start_time), |
|
|
|
"end": round(start_time + (last_track.duration_ms/1000)) |
|
|
|
}, |
|
|
|
"assets": { |
|
|
|
"small_text": "Yandex", |
|
|
|
"small_image": "og-image", |
|
|
@@ -44,5 +57,6 @@ while True: |
|
|
|
} |
|
|
|
rpc_obj.set_activity(activity) |
|
|
|
lastTrack = title |
|
|
|
time.sleep(50) |
|
|
|
time.sleep(5) |
|
|
|
print("CHECK2") |
|
|
|
|