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