Skip to content

Commit 763ba7e

Browse files
committed
๐ŸŽจ [epgs] ่ฟฝใฃใ‹ใ‘ๅ†็”Ÿๆ™‚ใซใฏ็ต‚ไบ†ๆ™‚้–“ใ‚’ๅ†็”Ÿ้–‹ๅง‹ๆ™‚้–“ใจใ™ใ‚‹ (#8)
1 parent 99851bf commit 763ba7e

File tree

3 files changed

+59
-2
lines changed

3 files changed

+59
-2
lines changed

โ€Žsrc/miraktest-epgs/EpgsRenderer.tsx

+52
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,58 @@ export const EpgsRenderer: InitPlugin["renderer"] = ({
4646
return
4747
},
4848
components: [
49+
/*{
50+
id: `${EPGS_PREFIX}.okkake`,
51+
position: "onPlayer",
52+
component: () => {
53+
const playingContent = useRecoilValue(
54+
atoms.contentPlayerPlayingContentAtom
55+
)
56+
const position = useRecoilValue(
57+
atoms.contentPlayerPlayingPositionSelector
58+
)
59+
const positionRef = useRefFromState(position)
60+
const setPosition = useSetRecoilState(
61+
atoms.contentPlayerPositionUpdateTriggerAtom
62+
)
63+
useEffect(() => {
64+
if (
65+
!playingContent ||
66+
playingContent.contentType !== "EPGStation" ||
67+
!playingContent.program ||
68+
dayjs().isAfter(
69+
playingContent.program.startAt + playingContent.program.duration
70+
)
71+
) {
72+
return
73+
}
74+
const endAt =
75+
playingContent.program.startAt + playingContent.program.duration
76+
console.info("[epgs] ่ฟฝใฃใ‹ใ‘ๅ†็”Ÿใƒขใƒผใƒ‰ใ‚’้–‹ๅง‹ใ—ใพใ™")
77+
let isSeeked = false
78+
const timer = setInterval(() => {
79+
const position = positionRef.current
80+
console.log("position", position)
81+
if (dayjs().isAfter(endAt)) {
82+
console.info(
83+
"[epgs] ๆ”พ้€ใŒ็ต‚ไบ†ใ—ใพใ—ใŸใ€่ฟฝใฃใ‹ใ‘ๅ†็”Ÿใƒขใƒผใƒ‰ใ‚’็ต‚ไบ†ใ—ใพใ™"
84+
)
85+
clearInterval(timer)
86+
return
87+
}
88+
if (!isSeeked && 0.99 < position) {
89+
console.info("[epgs] ็ฏ„ๅ›ฒใ‚’ๅ†ๅ–ๅพ—ใ—ใพใ™:")
90+
setPosition(0.8)
91+
isSeeked = true
92+
}
93+
}, 5000)
94+
return () => {
95+
clearInterval(timer)
96+
}
97+
}, [playingContent])
98+
return <></>
99+
},
100+
},*/
49101
{
50102
id: `${EPGS_PREFIX}.settings`,
51103
position: "onSetting",

โ€Žsrc/miraktest-epgs/components/RecordDetail.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ export const RecordDetail: React.VFC<{
5757
const play = useCallback(
5858
(videoId: number, isNewWindow: boolean) => {
5959
const url = api.getVideoUrl({ videoId })
60-
const program = convertProgramRecordToProgram(record, service)
60+
const now = dayjs()
61+
const endAt = now.isAfter(record.endAt) ? record.endAt : now.unix() * 1000
62+
const program = convertProgramRecordToProgram(
63+
{ ...record, endAt },
64+
service
65+
)
6166
const payload = {
6267
contentType: "EPGStation",
6368
url,

โ€Žsrc/miraktest-epgs/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ export const EPGS_META = {
401401
id: EPGS_ID,
402402
name: "EPGStation",
403403
author: "ci7lus",
404-
version: "0.1.4",
404+
version: "0.1.5",
405405
description: "EPGStationใฎ้Œฒ็”ปใ‚’ๅ†็”Ÿใ™ใ‚‹ใŸใ‚ใฎใƒ—ใƒฉใ‚ฐใ‚คใƒณใงใ™ใ€‚",
406406
authorUrl: "https://github.com/ci7lus",
407407
url: "https://github.com/ci7lus/miraktest-plugins/tree/master/src/miraktest-epgs",

0 commit comments

Comments
ย (0)