diff --git a/src/frames/pomodoro_frame.py b/src/frames/pomodoro_frame.py index 3416c01..8c25fc8 100644 --- a/src/frames/pomodoro_frame.py +++ b/src/frames/pomodoro_frame.py @@ -115,7 +115,7 @@ def update_rpc(self): elif self.paused: self.rpc.paused_state(self.start_time_timestamp) else: - self.rpc.idling_state() + self.rpc.idling_state(self.seconds_studied) else: if self.discord_button.cget("state") == 'normal': self.discord_button.configure(text=DISCONNECTED_TEXT, text_color=DISCONNECTED_COLOR) diff --git a/src/logic/richpresence.py b/src/logic/richpresence.py index 6130483..7d63834 100644 --- a/src/logic/richpresence.py +++ b/src/logic/richpresence.py @@ -1,5 +1,6 @@ import pypresence from datetime import datetime +from src.utils import load_data CLIENT_ID = '1215345125002059836' @@ -11,6 +12,7 @@ def __init__(self): # Can only update every 15 seconds self.connected = False self.connect() + self.total_seconds_studied = load_data().get('total_seconds_studied', 0) self.idling_state() def _handle_exceptions(func): @@ -53,9 +55,9 @@ def format_time(self, seconds_studied): return f"{round(total_hours, 1) if total_hours % 1 != 0 else int(total_hours)} hours" @_handle_exceptions - def idling_state(self): - self.update(state="Idling", details=None, start=self.launch_time, large_image="graytomato", - large_text="github.com/freeram/pomodoro-discord") + def idling_state(self, seconds_studied=0): + self.update(state=f"Total time studied: {self.format_time(self.total_seconds_studied + seconds_studied)}", + details="Idling", start=self.launch_time, large_image="graytomato", large_text="github.com/freeram/pomodoro-discord") @_handle_exceptions def running_state(self, session, start_time, end_time):