From bb2149611ddbd9d40ac5398707a246c90c91ca56 Mon Sep 17 00:00:00 2001 From: BarsTiger Date: Sun, 10 Oct 2021 11:32:03 +0300 Subject: [PATCH] Dev 1010211131: Added Discord Rich Presence --- MultiMate_Player.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/MultiMate_Player.py b/MultiMate_Player.py index 27ddbd6..1f8b9c3 100644 --- a/MultiMate_Player.py +++ b/MultiMate_Player.py @@ -38,6 +38,12 @@ except: subprocess.check_call([sys.executable, "-m", "pip", "install", 'psycopg2']) import psycopg2 +try: + from pypresence import Presence +except: + subprocess.check_call([sys.executable, "-m", "pip", "install", 'pypresence']) + from pypresence import Presence + def cls(): os.system('cls' if os.name == 'nt' else 'clear') @@ -50,6 +56,10 @@ timeToSleep = 0 playnext = True newindex = 0 +rpc = Presence("896669007342633000") +rpc.connect() +rpc.update(details="Just started app", state="Nothing is beeing listened...", large_image="multimate", start=time.time()) + class Ui_MainWindow(QtWidgets.QMainWindow): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") @@ -629,6 +639,8 @@ def playmusic(url, name, author): timeToSleep = mediaplayer.get_length() / 1000 cls() ui.nowPlaying.setText(author + " - " + name) + rpc.update(details="Listening " + author, state=name, large_image="multimate", + start=time.time()) print("Playing " + author + " - " + name) app = QtWidgets.QApplication(sys.argv) @@ -748,6 +760,7 @@ def updateAppPy(): exit() MainWindow.show() + cls() ui.openPlaylistButton.clicked.connect(getplaylist)