From 85d3099f96c6d3af818876aa13ccc4a2ac06fe36 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Tue, 1 Dec 2020 08:55:33 -0500 Subject: [PATCH] Create seperate Channels Editor page --- data/www/templates/channels.html | 104 ++++++++++-------------- data/www/templates/channels_editor.html | 73 +++++++++++++++++ data/www/templates/guide.html | 4 +- fHDHR/http/pages/__init__.py | 2 + fHDHR/http/pages/channels_editor.py | 23 ++++++ 5 files changed, 144 insertions(+), 62 deletions(-) create mode 100644 data/www/templates/channels_editor.html create mode 100644 fHDHR/http/pages/channels_editor.py diff --git a/data/www/templates/channels.html b/data/www/templates/channels.html index 77a0ff7..1a0f806 100644 --- a/data/www/templates/channels.html +++ b/data/www/templates/channels.html @@ -22,69 +22,53 @@ {% endfor %} - - - - - - - - - - - - +
+ +
+
- {% for chan_dict in channelslist %} - - +
PlayChannel NameChannel CallSignChannel NumberChannel ThumbnailEnabledFavoriteUpdateReset
- {% if chan_dict["enabled"] %} - Play - {% endif %} -
+ + + + + + + + + - - - - - - - - - - + {% for chan_dict in channelslist %} + + - + - - {% endfor %} + + + + + {% if chan_dict["thumbnail"] %} + + {% else %} + + {% endif %} + + {% if chan_dict["enabled"] %} + + {% else %} + + {% endif %} + + {% if chan_dict["favorite"] %} + + {% else %} + + {% endif %} + + {% endfor %} {% endblock %} diff --git a/data/www/templates/channels_editor.html b/data/www/templates/channels_editor.html new file mode 100644 index 0000000..81d054b --- /dev/null +++ b/data/www/templates/channels_editor.html @@ -0,0 +1,73 @@ +{% extends "base.html" %} + +{% block content %} + +

{{ fhdhr.config.dict["fhdhr"]["friendlyname"] }} Channels Editor

+ +
PlayChannel NameChannel CallSignChannel NumberChannel ThumbnailEnabledFavorite
- - - -
+ {% if chan_dict["enabled"] %} + Play + {% endif %} -
- - - - - - -
{{ chan_dict["name"] }}{{ chan_dict["callsign"] }}{{ chan_dict["number"] }}{{ chan_dict[No Image AvailableEnabledDisabledYesNo
+ + + + + + + + + + + + + {% for chan_dict in channelslist %} + + + + + + + + + + + + + + + + + + + + + + + + + + + {% endfor %} + +{% endblock %} diff --git a/data/www/templates/guide.html b/data/www/templates/guide.html index e61d514..f42eb5c 100644 --- a/data/www/templates/guide.html +++ b/data/www/templates/guide.html @@ -25,9 +25,9 @@ - - diff --git a/fHDHR/http/pages/__init__.py b/fHDHR/http/pages/__init__.py index 96c4a86..1f65ac8 100644 --- a/fHDHR/http/pages/__init__.py +++ b/fHDHR/http/pages/__init__.py @@ -10,6 +10,7 @@ from .xmltv_html import xmlTV_HTML from .version_html import Version_HTML from .diagnostics_html import Diagnostics_HTML from .settings_html import Settings_HTML +from .channels_editor import Channels_Editor_HTML class fHDHR_Pages(): @@ -20,6 +21,7 @@ class fHDHR_Pages(): self.index_html = Index_HTML(fhdhr) self.origin_html = Origin_HTML(fhdhr) self.channels_html = Channels_HTML(fhdhr) + self.channels_editor = Channels_Editor_HTML(fhdhr) self.guide_html = Guide_HTML(fhdhr) self.cluster_html = Cluster_HTML(fhdhr) self.streams_html = Streams_HTML(fhdhr) diff --git a/fHDHR/http/pages/channels_editor.py b/fHDHR/http/pages/channels_editor.py new file mode 100644 index 0000000..f766127 --- /dev/null +++ b/fHDHR/http/pages/channels_editor.py @@ -0,0 +1,23 @@ +from flask import request, render_template + + +class Channels_Editor_HTML(): + endpoints = ["/channels_editor", "/channels_editor.html"] + endpoint_name = "page_channels_editor_html" + + def __init__(self, fhdhr): + self.fhdhr = fhdhr + + def __call__(self, *args): + return self.get(*args) + + def get(self, *args): + + channelslist = [] + for fhdhr_id in list(self.fhdhr.device.channels.list.keys()): + channel_obj = self.fhdhr.device.channels.list[fhdhr_id] + channel_dict = channel_obj.dict.copy() + channel_dict["play_url"] = channel_obj.play_url() + channelslist.append(channel_dict) + + return render_template('channels_editor.html', request=request, fhdhr=self.fhdhr, channelslist=channelslist)
PlayChannel NameChannel CallSignChannel NumberChannel ThumbnailEnabledFavoriteUpdateReset
+ {% if chan_dict["enabled"] %} + Play + {% endif %} +
+ + + +
{{ chan_dict["name"] }} {{ chan_dict["number"] }}{{ chan_dict[ + {{ chan_dict[ {{ chan_dict["listing_title"] }}{{ chan_dict[ + {{ chan_dict[ {{ chan_dict["listing_description"] }} {{ chan_dict["remaining_time"] }}