diff --git a/gallery/easel/route/view/schedule/__init__.py b/gallery/easel/route/view/schedule/__init__.py index 16e8c38..83f671b 100644 --- a/gallery/easel/route/view/schedule/__init__.py +++ b/gallery/easel/route/view/schedule/__init__.py @@ -32,12 +32,35 @@ def mount(app: FastAPI): }, ) + @app.get("/schedule/tag/{tag}", response_class=HTMLResponse) + async def get_schedule_tag(request: Request, tag: str, live: bool = False): + tag_value = TagUtil.parse_tag(tag) + schedule_api: ScheduleApi = request.app.state.schedule_api + channels = await schedule_api.get_channels() + responses = [ + await schedule_api.get_channel_schedule(channel, tag_value.date) + for channel in channels + ] + return templates.TemplateResponse( + request=request, + name="schedule.html", + context={ + "version": __version__, + "tag_util": TagUtil, + "datetime": datetime, + "channels": channels, + "response": responses[0], + "responses": responses, + "live": live, + }, + ) + @app.get("/schedule/{channel}", response_class=RedirectResponse) - async def get_schedule_default(channel: str): + async def get_channel_default(channel: str): return RedirectResponse(f"{channel}/tag/today") @app.get("/schedule/{channel}/tag/{tag}", response_class=HTMLResponse) - async def get_schedule_tag(request: Request, channel: str, tag: str): + async def get_channel_tag(request: Request, channel: str, tag: str): tag_value = TagUtil.parse_tag(tag) schedule_api: ScheduleApi = request.app.state.schedule_api if tag_value.type == TagType.DAY: @@ -46,7 +69,7 @@ def mount(app: FastAPI): raise ValueError(tag) return templates.TemplateResponse( request=request, - name="schedule.html", + name="channel.html", context={ "version": __version__, "tag_util": TagUtil, diff --git a/gallery/easel/route/view/schedule/static/style.css b/gallery/easel/route/view/schedule/static/style.css index 7dff605..3c7ecdf 100644 --- a/gallery/easel/route/view/schedule/static/style.css +++ b/gallery/easel/route/view/schedule/static/style.css @@ -5,3 +5,10 @@ td { tr.live { font-weight: bold; } + +.title { + margin-top: 0.5rem; + font-style: italic; + font-weight: bold; + font-size: 120%; +} diff --git a/gallery/easel/route/view/schedule/templates/channel.html b/gallery/easel/route/view/schedule/templates/channel.html new file mode 100644 index 0000000..11d53c1 --- /dev/null +++ b/gallery/easel/route/view/schedule/templates/channel.html @@ -0,0 +1,51 @@ + + + + + + + + Программа | {{response.channel.name}} | {{response.date.strftime('%a, %d %B %Y')}} + + + + + + +

+ ⬅️ + ⬆️ + {{response.channel.name}} | {{response.date.strftime('%a, %d %B %Y')}} + ➡️ +

+ + + + + + + + + + + {% for value in response.values %} + + + + + + {% endfor %} + +
{{value.start.strftime('%H:%M')}}{{(value.end - value.start) | timedelta_format}}{{value.label}}
+ + + \ No newline at end of file diff --git a/gallery/easel/route/view/schedule/templates/schedule.html b/gallery/easel/route/view/schedule/templates/schedule.html index 11d53c1..40d74aa 100644 --- a/gallery/easel/route/view/schedule/templates/schedule.html +++ b/gallery/easel/route/view/schedule/templates/schedule.html @@ -7,7 +7,7 @@ content="width=device-width, initial-scale=1.0"> - Программа | {{response.channel.name}} | {{response.date.strftime('%a, %d %B %Y')}} + ТВ ⬅️ ⬆️ - {{response.channel.name}} | {{response.date.strftime('%a, %d %B %Y')}} + Прямые трансляции | {{response.date.strftime('%a, %d %B %Y')}} ➡️ - +
@@ -37,13 +37,25 @@ - {% for value in response.values %} - + {% for response in responses %} + {% set values = (response.values|selectattr('live') if live else response.values)|list %} + {% if values|length > 0 %} + + + + + + {% for value in values %} + {% endfor %} + {% endif %} + {% endfor %}
+
{{response.channel.name}}
+
{{value.start.strftime('%H:%M')}} {{(value.end - value.start) | timedelta_format}} {{value.label}}
diff --git a/gallery/painting/matchtv/api.py b/gallery/painting/matchtv/api.py index 96d5d48..0209fe3 100644 --- a/gallery/painting/matchtv/api.py +++ b/gallery/painting/matchtv/api.py @@ -17,9 +17,9 @@ CHANNEL_LIST = [ "arena", "futbol-1", "futbol-2", - "futbol-2", + "futbol-3", "strana", - "planeta", + # "planeta", ]