import time import json import sys sys.path.insert(0, '/rpclib/') from rpclib import rpc from time import mktime from yandex_music import Client with open('config.json') as f: y = json.load(f) print(y) client = Client.from_credentials(y["email"], y["password"]) print("Starting") client_id = '877154344124960809' rpc_obj = rpc.DiscordIpcClient.for_platform(client_id) print("RPC connection successful.") lastTrack = "none" time.sleep(5) start_time = mktime(time.localtime()) 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 print(f'AListening to: {artists} - {title}') if (title != lastTrack): print("CHANGED") activity = { "state": title, # anything you like "details": f'Listening to {artists} -', # anything you like "assets": { "small_text": "Adobe", # anything you like "small_image": "og-image", # must match the image key "large_text": "ADOBE", # anything you like "large_image": "pongnew" # must match the image key } } rpc_obj.set_activity(activity) lastTrack = title time.sleep(50)