feat: add catalog

This commit is contained in:
2024-08-16 00:59:56 +03:00
parent aae8bc8649
commit b3043c3c8c
11 changed files with 91 additions and 22 deletions

View File

@@ -6,23 +6,12 @@ from aiocache import cached
from bs4 import BeautifulSoup
from gallery.sketch.schedule.api import ScheduleApi
from gallery.sketch.schedule.catalog import ChannelId
from gallery.sketch.schedule.model import Channel, Schedule, ScheduleValue
logger = logging.getLogger("matchtv")
CHANNEL_LIST = [
"matchtv",
"igra",
"arena",
"futbol-1",
"futbol-2",
"futbol-3",
"strana",
# "planeta",
]
class MatchTvApi(ScheduleApi):
BASE_URL = "https://matchtv.ru"
CACHE_TTL = 30 * 60
@@ -46,7 +35,15 @@ class MatchTvApi(ScheduleApi):
return await response.text()
async def get_channels(self) -> list[str]:
return CHANNEL_LIST
return [
ChannelId.MATCH_TV,
ChannelId.MATCH_IGRA,
ChannelId.MATCH_ARENA,
ChannelId.MATCH_FUTBOL_1,
ChannelId.MATCH_FUTBOL_2,
ChannelId.MATCH_FUTBOL_3,
ChannelId.MATCH_STRANA,
]
@cached(ttl=CACHE_TTL)
async def get_channel_schedule(