diff options
author | DemonKingSwarn <rockingswarn@gmail.com> | 2024-02-21 22:27:16 +0530 |
---|---|---|
committer | DemonKingSwarn <rockingswarn@gmail.com> | 2024-02-21 22:27:16 +0530 |
commit | 1d4c1a2aebe40775bc046f0aca94980ec7f5e466 (patch) | |
tree | 8080224d1b2c782c5c2a2fe54e367473d66bbd4c /yt_music/__yt_music__.py | |
parent | 1a0ce5cf17e0f5acd2e94d40ec2b7de8af387e60 (diff) | |
download | yt-music-1d4c1a2aebe40775bc046f0aca94980ec7f5e466.zip yt-music-1d4c1a2aebe40775bc046f0aca94980ec7f5e466.tar.gz |
feat: discord rpc
Diffstat (limited to 'yt_music/__yt_music__.py')
-rw-r--r-- | yt_music/__yt_music__.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/yt_music/__yt_music__.py b/yt_music/__yt_music__.py index 5e19c2d..9d8c0a3 100644 --- a/yt_music/__yt_music__.py +++ b/yt_music/__yt_music__.py @@ -3,7 +3,9 @@ import re import subprocess import platform import os +import time +from pypresence import Presence import httpx import fzf @@ -12,6 +14,11 @@ headers = { } +start = int(time.time()) +client_id = "1075791459409723472" +RPC = Presence(client_id) +RPC.connect() + client = httpx.Client(headers=headers, timeout=None) base_url = "https://vid.puffyan.us" @@ -72,6 +79,15 @@ def download(video_id, video_title): def play_loop(video_id, video_title): + RPC.update( + large_image = f"http://img.youtube.com/vi/{video_id}/0.jpg", + large_text = "haha checkmate spotify plebs", + small_image = "youtube_music_icon_svg", + small_text = "yt-music", + start = start, + details = f"{video_title} - loop", + ) + args = [ MPV_EXECUTABLE, f"https://music.youtube.com/watch?v={video_id}", @@ -87,6 +103,15 @@ def play_loop(video_id, video_title): def play(video_id, video_title): + RPC.update( + large_image = f"http://img.youtube.com/vi/{video_id}/0.jpg", + large_text = "haha checkmate spotify plebs", + small_image = "youtube_music_icon_svg", + small_text = "yt-music", + start = start, + details = video_title, + ) + args = [ MPV_EXECUTABLE, f"https://music.youtube.com/watch?v={video_id}", |