feat(schedule): update view

This commit is contained in:
2026-04-16 23:05:41 +03:00
parent 29fa6435ce
commit a0e6f30e3b
11 changed files with 84 additions and 39 deletions

View File

@@ -1,3 +1,4 @@
import asyncio
import datetime
from ..api import Api
@@ -5,6 +6,8 @@ from .model import ChannelId, Schedule
class ScheduleApi(Api):
INTERVAL: float = 0.5
async def get_channels(self) -> list[ChannelId]:
raise NotImplementedError
@@ -12,3 +15,14 @@ class ScheduleApi(Api):
self, channel_id: ChannelId, date: datetime.date
) -> Schedule:
raise NotImplementedError
async def get_all_schedules(self, date: datetime.date) -> list[Schedule]:
channels = await self.get_channels()
results = []
for channel in channels:
results.append(
await self.get_channel_schedule(channel_id=channel, date=date)
)
if self.INTERVAL > 0:
await asyncio.sleep(self.INTERVAL)
return results