generated from vivid-lapin/ts
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpresence.ts
63 lines (54 loc) · 1.85 KB
/
presence.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { Service } from "../@types/plugin"
// Reference: https://github.com/SlashNephy/TvTestRPC
export const PresenceRegisteredGRLogos = [
1040, 1048, 1056, 1064, 1072, 17424, 17432, 17440, 17448, 2064, 2072, 2080,
2088, 23608, 23672, 24632, 24680, 34840, 37904, 37912, 37920, 38008, 41008,
43056, 46128, 47528,
]
export const PresenceRegisteredBSLogos = [
101, 103, 141, 151, 161, 171, 181, 191, 200, 211, 222, 231, 234, 236, 241,
242, 251, 252, 255, 256, 260, 263, 265,
]
export const PresenceRegisteredCSLogos = [
161, 218, 219, 223, 227, 240, 250, 254, 257, 262, 290, 292, 293, 294, 295,
296, 297, 298, 299, 300, 301, 305, 307, 308, 309, 310, 311, 312, 314, 316,
317, 318, 321, 322, 323, 324, 325, 329, 330, 331, 333, 339, 340, 341, 342,
343, 349, 351, 353, 354, 363, 55, 800, 801,
]
export const PresenceAliases: { [key: number]: number } = {
24696: 24680, // イッツコムch11 (CATV)
531: 231, // 放送大学ラジオ
}
const CSNetworkIds = [6, 7]
export const getServiceLogoForPresence = (service: Service) => {
if (service.name.includes("NHK総合") || service.name.includes("NHK総合")) {
return "gr_nhkg"
}
if (
service.name.includes("NHKEテレ") ||
service.name.includes("NHKEテレ")
) {
return "gr_nhke"
}
for (const sub of [...Array(4).keys()]) {
// +4までサブチャンネルとする
const serviceId =
PresenceAliases[service.serviceId - sub] ?? service.serviceId - sub
if (
service.networkId === 4 &&
PresenceRegisteredBSLogos.includes(serviceId)
) {
return `bs_${serviceId}`
}
if (
CSNetworkIds.includes(service.networkId) &&
PresenceRegisteredCSLogos.includes(serviceId)
) {
return `cs_${serviceId}`
}
if (PresenceRegisteredGRLogos.includes(serviceId)) {
return `gr_${serviceId}`
}
}
return false
}