Skip to content

Commit

Permalink
naprawiono błąd z zamykaniem rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
TowarzyszFatCat committed Jun 13, 2024
1 parent c4c17c6 commit f13943e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
7 changes: 6 additions & 1 deletion discord_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ def update_rpc(first_line, second_line):
discord_data = [first_line, second_line]


def set_running(bool):
global running
running = bool


def start_rpc():
while True:
while running:
RPC.update(state=discord_data[1], details=discord_data[0], large_image='icon_1', large_text="Doccli - oglądaj anime bezpośrednio ze swojego terminalu!", buttons=[{"label": "GitHub", "url": "https://github.com/TowarzyszFatCat/doccli"}, {"label": "Discord Projektu", "url": "https://discord.gg/FgfSM7bSEK"}], start=start_time)
time.sleep(5)
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from termcolor import colored
import webbrowser
import threading
from discord_integration import start_rpc
from discord_integration import start_rpc, set_running

VERSION = "v2.6"

Expand All @@ -25,6 +25,7 @@ def check_update() -> None:

if __name__ == "__main__":
check_update()
set_running(True)
thread = threading.Thread(target=start_rpc)
thread.start()
m_welcome()
4 changes: 3 additions & 1 deletion menu_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from subprocess import Popen, DEVNULL
from termcolor import colored
import webbrowser
from discord_integration import discord_data, update_rpc
from discord_integration import update_rpc, set_running


def clear():
Expand Down Expand Up @@ -75,6 +75,7 @@ def m_welcome():
elif ans == choices[4]:
m_discord()
elif ans == choices[5]:
set_running(False)
sys.exit()

def m_settings():
Expand All @@ -101,6 +102,7 @@ def m_settings():
save()
m_welcome()
else:
settings[1] = 'Używa doccli!'
save()
m_welcome()

Expand Down

0 comments on commit f13943e

Please sign in to comment.