handle paused state
This commit is contained in:
@@ -5,3 +5,4 @@
|
|||||||
- 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
|
- Removed caching of last fetched items to ensure the most up-to-date information is always displayed in Discord Rich Presence
|
||||||
|
- Handle paused state correctly by checking the `PlayState` property from Jellyfin and updating Discord Rich Presence accordingly
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ class DiscordRPCUpdatePayload(BaseModel):
|
|||||||
subtitle: str
|
subtitle: str
|
||||||
image_url: str
|
image_url: str
|
||||||
details: str
|
details: str
|
||||||
start: int
|
start: int | None
|
||||||
end: int
|
end: int | None
|
||||||
activity_type: ActivityType
|
activity_type: ActivityType
|
||||||
|
|||||||
@@ -75,6 +75,10 @@ class JellyfinApiClient:
|
|||||||
|
|
||||||
def get_playback_info(self, media: dict) -> tuple[int, int]:
|
def get_playback_info(self, media: dict) -> tuple[int, int]:
|
||||||
play_state = media.get('PlayState')
|
play_state = media.get('PlayState')
|
||||||
|
is_paused = play_state.get('IsPaused')
|
||||||
|
|
||||||
|
if is_paused:
|
||||||
|
return (None, None)
|
||||||
|
|
||||||
runtime_ticks = media.get('RunTimeTicks')
|
runtime_ticks = media.get('RunTimeTicks')
|
||||||
total_runtime_seconds = runtime_ticks // 10_000_000
|
total_runtime_seconds = runtime_ticks // 10_000_000
|
||||||
|
|||||||
@@ -13,6 +13,6 @@ class JellyfinMediaItem(BaseModel):
|
|||||||
name: str
|
name: str
|
||||||
type: JellyfinMediaType
|
type: JellyfinMediaType
|
||||||
image_url: str
|
image_url: str
|
||||||
start: int
|
start: int | None
|
||||||
end: int
|
end: int | None
|
||||||
metadata: dict
|
metadata: dict
|
||||||
|
|||||||
Reference in New Issue
Block a user