remove rich presence caching
This commit is contained in:
@@ -4,3 +4,4 @@
|
|||||||
- Updated Jellyfin image fetching logic to use `ParentId` for episodes and music tracks to ensure correct artwork is displayed in Discord Rich Presence
|
- Updated Jellyfin image fetching logic to use `ParentId` for episodes and music tracks to ensure correct artwork is displayed in Discord Rich Presence
|
||||||
- Added `coloredlogs` dependency for improved logging output
|
- Added `coloredlogs` dependency for improved logging output
|
||||||
- Added a formatting script (`scripts/format.sh`) that uses `autopep8` to automatically format the codebase for better readability and consistency
|
- Added a formatting script (`scripts/format.sh`) that uses `autopep8` to automatically format the codebase for better readability and consistency
|
||||||
|
- Removed caching of last fetched items to ensure the most up-to-date information is always displayed in Discord Rich Presence
|
||||||
|
|||||||
@@ -9,16 +9,11 @@ class DiscordRPC:
|
|||||||
self.logger = logging.getLogger('DiscordRPC')
|
self.logger = logging.getLogger('DiscordRPC')
|
||||||
|
|
||||||
self.logger.info("Connecting to Discord RPC...")
|
self.logger.info("Connecting to Discord RPC...")
|
||||||
self.last_update_id = None
|
|
||||||
self.rpc = Presence(settings.discord_app_id)
|
self.rpc = Presence(settings.discord_app_id)
|
||||||
self.rpc.connect()
|
self.rpc.connect()
|
||||||
self.logger.info("Connected to Discord RPC.")
|
self.logger.info("Connected to Discord RPC.")
|
||||||
|
|
||||||
def update(self, payload: DiscordRPCUpdatePayload):
|
def update(self, payload: DiscordRPCUpdatePayload):
|
||||||
if self.last_update_id == payload.id:
|
|
||||||
self.logger.debug("No update needed for Discord RPC presence.")
|
|
||||||
return
|
|
||||||
|
|
||||||
self.logger.info("Updating Discord RPC presence...")
|
self.logger.info("Updating Discord RPC presence...")
|
||||||
self.rpc.update(
|
self.rpc.update(
|
||||||
activity_type=payload.activity_type,
|
activity_type=payload.activity_type,
|
||||||
@@ -29,7 +24,6 @@ class DiscordRPC:
|
|||||||
start=payload.start,
|
start=payload.start,
|
||||||
end=payload.end
|
end=payload.end
|
||||||
)
|
)
|
||||||
self.last_update_id = payload.id
|
|
||||||
self.logger.info("Discord RPC presence updated.")
|
self.logger.info("Discord RPC presence updated.")
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user