Skip to content

Commit

Permalink
Merge pull request #23 from ci7lus/fix/drpc-nid
Browse files Browse the repository at this point in the history
✏️ [drpc] nid を見るようにしてチャンネル判定を厳密化
  • Loading branch information
ci7lus authored May 17, 2023
2 parents 58a4560 + c2b073e commit cabde97
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/miraktest-drpc/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
19 changes: 14 additions & 5 deletions src/miraktest-drpc/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}

0 comments on commit cabde97

Please sign in to comment.