def update_loop(): try: while True: rpc_data = handler.get_rpc_update() rich_presence.update(state=rpc_data['state'], small_image=rpc_data['small_image'], large_image=rpc_data['large_image'], large_text=rpc_data['large_text'], small_text=rpc_data['small_text'], details=rpc_data['details'], start=rpc_data['create_time']) time.sleep(15) except: rich_presence.clear() print("Run Adobe/Discord app") time.sleep(5) update_loop()
def update_loop(): start_time = int(time.time()) try: while True: rpc_data = handler.get_rpc_update() rich_presence.update(state=rpc_data['state'], small_image=rpc_data['small_image'], large_image=rpc_data['large_image'], large_text=rpc_data['large_text'], small_text=rpc_data['small_text'], details=rpc_data['details'], start=start_time) time.sleep(15) except: rich_presence.clear() print("No Adobe APP Detected") time.sleep(15) update_loop()
def update_loop(): # Updates Discord of current activity start_time = int(time.time()) # Sets startup time for the application try: while True: # Creates rpc_data dictionary to parse data to handle rpc_data = handler.get_rpc_update() # 'handler.py' data is imported into here rich_presence.update(state=rpc_data['state'], small_image=rpc_data['small_image'], large_image=rpc_data['large_image'], large_text=rpc_data['large_text'], small_text=rpc_data['small_text'], details=rpc_data['details'], start=start_time) logging.info("Updated Discord RPC Data:") logging.info("Large Text: " + str(rpc_data['large_text'])) logging.info("Small Text: " + str(rpc_data['small_text'])) logging.info("State: " + str(rpc_data['state'])) logging.debug("Raw input into Discord RPC: " + str(rpc_data)) time.sleep(10) except InvalidID: # When script has a bad Client ID logging.error( "Unable to connect to Discord! Is your Client ID correct?") raise SystemExit(1) except: # When either Discord or a supported Adobe product is not detected... # Clear rpc_data rich_presence.clear() logging.exception( "Not detecting Adobe applications! Are you sure your running a compatible application?") # Update Discord time.sleep(1) update_loop()
def connect(): rich_presence.connect() try: connect() except (InvalidID, InvalidPipe): print("Discord is not running...") sys.exit(0) start_time = int(time.time()) print("Started Photoshop Rich Presence ✓") try: while True: rpc_data = handler.get_rpc_update() rich_presence.update(state=rpc_data['state'], small_image=rpc_data['small_image'], large_image=rpc_data['large_image'], large_text=rpc_data['large_text'], small_text=rpc_data['small_text'], details=rpc_data['details'], start=start_time) time.sleep(15) except KeyboardInterrupt: print("Stopped Photoshop Rich Presence ✘")