From 6c0cbacb9d37ca35d8a697dfed1b0e79c3f7c1a0 Mon Sep 17 00:00:00 2001 From: ci7lus <7887955+ci7lus@users.noreply.github.com> Date: Thu, 25 Aug 2022 16:15:44 +0900 Subject: [PATCH] =?UTF-8?q?:sparkles:=20[epgs]=20=E3=82=B5=E3=83=BC?= =?UTF-8?q?=E3=83=93=E3=82=B9=E4=B8=8A=E6=9B=B8=E3=81=8D=E6=A9=9F=E8=83=BD?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/miraktest-epgs/EpgsRenderer.tsx | 4 +- .../components/RecordDetail.tsx | 95 ++++++++++++++++++- src/miraktest-epgs/components/Records.tsx | 9 +- 3 files changed, 99 insertions(+), 9 deletions(-) diff --git a/src/miraktest-epgs/EpgsRenderer.tsx b/src/miraktest-epgs/EpgsRenderer.tsx index 0f9599d..b2f52f0 100644 --- a/src/miraktest-epgs/EpgsRenderer.tsx +++ b/src/miraktest-epgs/EpgsRenderer.tsx @@ -173,6 +173,7 @@ export const EpgsRenderer: InitPlugin["renderer"] = ({ useEffect(() => { rpc.setWindowTitle(`EPGStation 録画一覧 - ${appInfo.name}`) }, []) + const services = useRecoilValue(atoms.mirakurunServicesSelector) return ( <> @@ -188,7 +189,7 @@ export const EpgsRenderer: InitPlugin["renderer"] = ({ "leading-loose" )} > - {api && channels !== null ? ( + {api && channels !== null && services ? ( ) : (
> openContentPlayer: (_: ContentPlayerPlayingContent) => Promise -}> = ({ api, record, channels, setPlayingContent, openContentPlayer }) => { + services: Service[] +}> = ({ + api, + record, + channels, + setPlayingContent, + openContentPlayer, + services, +}) => { const thumbnail = [...record.thumbnails].shift() const [thumbnailUrl, setThunbnailUrl] = useRecoilState( thumbnailFamily(thumbnail || 0) @@ -47,6 +55,8 @@ export const RecordDetail: React.VFC<{ const [startAtOver, setStartAtOver] = useState( dayjs(record.startAt).format("YYYY-MM-DDTHH:mm") ) + const [isServiceOverride, setIsServiceOverride] = useState(false) + const [serviceIdOver, setServiceIdOver] = useState(-1) const [durationOver, setDurationOver] = useState(duration / 60) useEffect(() => { @@ -66,7 +76,11 @@ export const RecordDetail: React.VFC<{ (videoId: number, isNewWindow: boolean) => { const url = api.getVideoUrl({ videoId }) const program = convertProgramRecordToProgram(record, channel) - const service = channel ? convertChannelToService(channel) : undefined + const service = + isServiceOverride && 0 < serviceIdOver + ? services.find((service) => service.serviceId === serviceIdOver) + : undefined || + (channel ? convertChannelToService(channel) : undefined) if (isStartAtOverride) { program.startAt = dayjs(startAtOver).unix() * 1000 program.duration = durationOver * 1000 * 60 @@ -84,7 +98,15 @@ export const RecordDetail: React.VFC<{ setPlayingContent(payload) } }, - [record, isStartAtOverride, startAtOver, durationOver] + [ + record, + isStartAtOverride, + startAtOver, + durationOver, + isServiceOverride, + serviceIdOver, + services, + ] ) return ( @@ -249,6 +271,69 @@ export const RecordDetail: React.VFC<{
)} + +
+ + + + サービスを上書きする +
+
+ {isServiceOverride && ( +
+ +
+ )}
{record.videoFiles.map((videoFile) => (
) : (