validate jellyfin image url
This commit is contained in:
@@ -8,3 +8,4 @@
|
||||
- Handle paused state correctly by checking the `PlayState` property from Jellyfin and updating Discord Rich Presence accordingly
|
||||
- Set the `auth.ssl` configuration option in Jellyfin Client dynamically based on the `jellyfin_server_url`
|
||||
- Removed `to_rpc_payload` function in favor of a class method within the `JellyfinMediaItem` class for better encapsulation and organization of code
|
||||
- Added major improvements to typing and type hints throughout the codebase for better code clarity and maintainability
|
||||
|
||||
@@ -28,6 +28,7 @@ class DiscordRPC:
|
||||
payload (DiscordRPCUpdatePayload): The payload containing presence information.
|
||||
"""
|
||||
self.logger.info("Updating Discord RPC presence...")
|
||||
|
||||
self.rpc.update(
|
||||
activity_type=payload.activity_type,
|
||||
details=payload.title,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, HttpUrl
|
||||
from enum import StrEnum
|
||||
from typing import Optional, Union
|
||||
from discord.models import DiscordRPCUpdatePayload
|
||||
@@ -28,7 +28,7 @@ class JellyfinMediaItem(BaseModel):
|
||||
id: str
|
||||
name: str
|
||||
type: JellyfinMediaType
|
||||
image_url: str
|
||||
image_url: HttpUrl
|
||||
start: Optional[int]
|
||||
end: Optional[int]
|
||||
metadata: Union[JellyfinMusicMediaMetadata,
|
||||
@@ -49,7 +49,7 @@ class JellyfinMediaItem(BaseModel):
|
||||
self.name}",
|
||||
subtitle=f"by {
|
||||
self.metadata.artist}",
|
||||
image_url=self.image_url,
|
||||
image_url=str(self.image_url),
|
||||
details=self.metadata.album,
|
||||
activity_type=ActivityType.LISTENING,
|
||||
start=self.start,
|
||||
@@ -59,7 +59,7 @@ class JellyfinMediaItem(BaseModel):
|
||||
id=self.id,
|
||||
title=f"Watching {self.name}",
|
||||
subtitle=self.metadata.date,
|
||||
image_url=self.image_url,
|
||||
image_url=str(self.image_url),
|
||||
details=self.name,
|
||||
activity_type=ActivityType.WATCHING,
|
||||
start=self.start,
|
||||
@@ -70,7 +70,7 @@ class JellyfinMediaItem(BaseModel):
|
||||
id=self.id,
|
||||
title=f"Watching {self.name}",
|
||||
subtitle=self.metadata.subtitle,
|
||||
image_url=self.image_url,
|
||||
image_url=str(self.image_url),
|
||||
details=self.name,
|
||||
activity_type=ActivityType.WATCHING,
|
||||
start=self.start,
|
||||
|
||||
Reference in New Issue
Block a user