From c2b073e1003f13eb1e24081c56e07acf41d8ab22 Mon Sep 17 00:00:00 2001 From: ci7lus <7887955+ci7lus@users.noreply.github.com> Date: Wed, 17 May 2023 21:19:57 +0900 Subject: [PATCH] =?UTF-8?q?:pencil2:=20[drpc]=20nid=20=E3=82=92=E8=A6=8B?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=A6=E3=83=81?= =?UTF-8?q?=E3=83=A3=E3=83=B3=E3=83=8D=E3=83=AB=E5=88=A4=E5=AE=9A=E3=82=92?= =?UTF-8?q?=E5=8E=B3=E5=AF=86=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/miraktest-drpc/constants.ts | 2 +- src/miraktest-drpc/presence.ts | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/miraktest-drpc/constants.ts b/src/miraktest-drpc/constants.ts index 4c9dd54..c6c3b91 100644 --- a/src/miraktest-drpc/constants.ts +++ b/src/miraktest-drpc/constants.ts @@ -4,7 +4,7 @@ export const DRPC_META = { id: DRPC_ID, name: "Discord RPC", author: "ci7lus", - version: "0.2.3", + version: "0.2.4", description: "表示中の番組を Discord に共有します", authorUrl: "https://github.com/ci7lus", url: "https://github.com/ci7lus/miraktest-plugins/tree/master/src/miraktest-drpc", diff --git a/src/miraktest-drpc/presence.ts b/src/miraktest-drpc/presence.ts index 7111d46..cb10f30 100644 --- a/src/miraktest-drpc/presence.ts +++ b/src/miraktest-drpc/presence.ts @@ -25,6 +25,8 @@ export const PresenceAliases: { [key: number]: number } = { 531: 231, // 放送大学ラジオ } +const CSNetworkIds = [6, 7] + export const getServiceLogoForPresence = (service: Service) => { if (service.name.includes("NHK総合") || service.name.includes("NHK総合")) { return "gr_nhkg" @@ -40,15 +42,22 @@ export const getServiceLogoForPresence = (service: Service) => { // +4までサブチャンネルとする const serviceId = PresenceAliases[service.serviceId - sub] ?? service.serviceId - sub - if (PresenceRegisteredGRLogos.includes(serviceId)) { - return `gr_${serviceId}` - } - if (PresenceRegisteredBSLogos.includes(serviceId)) { + + if ( + service.networkId === 4 && + PresenceRegisteredBSLogos.includes(serviceId) + ) { return `bs_${serviceId}` } - if (PresenceRegisteredCSLogos.includes(serviceId)) { + if ( + CSNetworkIds.includes(service.networkId) && + PresenceRegisteredCSLogos.includes(serviceId) + ) { return `cs_${serviceId}` } + if (PresenceRegisteredGRLogos.includes(serviceId)) { + return `gr_${serviceId}` + } } return false }