From dd6920d20a1ecf1ed837502ea971c86c152e2382 Mon Sep 17 00:00:00 2001 From: h4rl <98224660+h4rldev@users.noreply.github.com> Date: Wed, 11 Jun 2025 22:41:13 +0200 Subject: [PATCH] feat(jellyfinRichPresence): Add Dynamic ActivityType & Override (#288) * feat(jellyfinRichPresence): add dynamic ActivityType, aswell as an override * Update pnpm-lock.yaml * Fixes * Fix Default --------- Co-authored-by: thororen <78185467+thororen1234@users.noreply.github.com> --- .../jellyfinRichPresence/index.tsx | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/equicordplugins/jellyfinRichPresence/index.tsx b/src/equicordplugins/jellyfinRichPresence/index.tsx index aa27bedf..758f14df 100644 --- a/src/equicordplugins/jellyfinRichPresence/index.tsx +++ b/src/equicordplugins/jellyfinRichPresence/index.tsx @@ -65,6 +65,33 @@ const settings = definePluginSettings({ description: "Jellyfin user ID obtained from your user profile URL", type: OptionType.STRING, }, + overrideRichPresenceType: { + description: "Override the rich presence type", + type: OptionType.SELECT, + options: [ + { + label: "Off", + value: false, + default: true, + }, + { + label: "Listening", + value: 2, + }, + { + label: "Playing", + value: 0, + }, + { + label: "Streaming", + value: 1, + }, + { + label: "Watching", + value: 3 + }, + ], + }, }); const applicationId = "1381368130164625469"; @@ -169,9 +196,24 @@ export default definePlugin({ }, async getActivity(): Promise { + let richPresenceType; + const mediaData = await this.fetchMediaData(); if (!mediaData) return null; + if (settings.store.overrideRichPresenceType) { + richPresenceType = settings.store.overrideRichPresenceType; + } else { + switch (mediaData.type) { + case "Audio": + richPresenceType = 2; + break; + default: + richPresenceType = 3; + break; + } + } + const largeImage = mediaData.imageUrl; const assets: ActivityAssets = { large_image: largeImage ? await getApplicationAsset(largeImage) : await getApplicationAsset("jellyfin"), @@ -208,7 +250,7 @@ export default definePlugin({ assets, timestamps, - type: 3, + type: richPresenceType, flags: 1, }; }