1
0
mirror of https://github.com/fHDHR/fHDHR_NextPVR.git synced 2025-12-06 08:26:57 -05:00

Create seperate Channels Editor page

This commit is contained in:
deathbybandaid 2020-12-01 08:55:33 -05:00
parent 30986a6d3f
commit 85d3099f96
5 changed files with 144 additions and 62 deletions

View File

@ -22,69 +22,53 @@
</tr>
{% endfor %}
<table class="center" style="width:100%">
<tr>
<th>Play</th>
<th>Channel Name</th>
<th>Channel CallSign</th>
<th>Channel Number</th>
<th>Channel Thumbnail</th>
<th>Enabled</th>
<th>Favorite</th>
<th>Update</th>
<th>Reset</th>
</tr>
<div style="text-align: center;">
<button onclick="OpenLink('/channels_editor')">Edit Channels</a></button>
</div>
<br>
{% for chan_dict in channelslist %}
<tr>
<td>
{% if chan_dict["enabled"] %}
<a href="{{ chan_dict["play_url"] }}">Play</a>
{% endif %}
</td>
<table class="center" style="width:100%">
<tr>
<th>Play</th>
<th>Channel Name</th>
<th>Channel CallSign</th>
<th>Channel Number</th>
<th>Channel Thumbnail</th>
<th>Enabled</th>
<th>Favorite</th>
</tr>
<form method="post" action="/api/channels?method=update&redirect=%2Fchannels">
<input type="hidden" name="id" value={{ chan_dict["id"] }}>
<td data-th="Channel Name"><input type="text" name="name" value={{ chan_dict["name"] }}></td>
<td data-th="Channel Calsign"><input type="text" name="callsign" value={{ chan_dict["callsign"] }}></td>
<td data-th="Channel Number"><input type="text" name="number" value={{ chan_dict["number"] }}></td>
<td data-th="Channel Thumbnail"><input type="text" name="number" value={{ chan_dict["thumbnail"] }}></td>
<td>
<select name="enabled">
{% if chan_dict["enabled"] %}
<option value=True selected>Enabled</option>
<option value=False>Disabled</option>
{% else %}
<option value=True>Enabled</option>
<option value=False selected>Disabled</option>
{% endif %}
</select>
</td>
<td>
<select name="favorite">
{% if chan_dict["favorite"] %}
<option value=1 selected>Yes</option>
<option value=0>No</option>
{% else %}
<option value=1>Yes</option>
<option value=0 selected>No</option>
{% endif %}
</select>
</td>
<td data-th="Update"><input type="submit" value="Update"></td>
</form>
{% for chan_dict in channelslist %}
<tr>
<td>
{% if chan_dict["enabled"] %}
<a href="{{ chan_dict["play_url"] }}">Play</a>
{% endif %}
<form method="post" action="/api/channels?method=update&redirect=%2Fchannels">
<input type="hidden" name="id" value={{ chan_dict["id"] }}>
<input type="hidden" name="name" value={{ chan_dict["origin_name"] }}>
<input type="hidden" name="callsign" value={{ chan_dict["origin_callsign"] }}>
<input type="hidden" name="number" value={{ chan_dict["origin_number"] }}>
<input type="hidden" name="thumbnail" value={{ chan_dict["origin_thumbnail"] }}>
<input type="hidden" name="enabled" value=True>
<td data-th="Reset"><input type="submit" value="Reset"></td>
</form>
</td>
</tr>
{% endfor %}
<td>{{ chan_dict["name"] }}</td>
<td>{{ chan_dict["callsign"] }}</td>
<td>{{ chan_dict["number"] }}</td>
{% if chan_dict["thumbnail"] %}
<td><img src="{{ chan_dict["thumbnail"] }}" alt="{{ chan_dict["name"] }}" width="100" height="100"></td>
{% else %}
<td>No Image Available</td>
{% endif %}
{% if chan_dict["enabled"] %}
<td>Enabled</td>
{% else %}
<td>Disabled</td>
{% endif %}
{% if chan_dict["favorite"] %}
<td>Yes</td>
{% else %}
<td>No</td>
{% endif %}
{% endfor %}
{% endblock %}

View File

@ -0,0 +1,73 @@
{% extends "base.html" %}
{% block content %}
<h4 style="text-align: center;">{{ fhdhr.config.dict["fhdhr"]["friendlyname"] }} Channels Editor</h4>
<table class="center" style="width:100%">
<tr>
<th>Play</th>
<th>Channel Name</th>
<th>Channel CallSign</th>
<th>Channel Number</th>
<th>Channel Thumbnail</th>
<th>Enabled</th>
<th>Favorite</th>
<th>Update</th>
<th>Reset</th>
</tr>
{% for chan_dict in channelslist %}
<tr>
<td>
{% if chan_dict["enabled"] %}
<a href="{{ chan_dict["play_url"] }}">Play</a>
{% endif %}
</td>
<form method="post" action="/api/channels?method=update&redirect=%2Fchannels_editor">
<input type="hidden" name="id" value={{ chan_dict["id"] }}>
<td data-th="Channel Name"><input type="text" name="name" value={{ chan_dict["name"] }}></td>
<td data-th="Channel Calsign"><input type="text" name="callsign" value={{ chan_dict["callsign"] }}></td>
<td data-th="Channel Number"><input type="text" name="number" value={{ chan_dict["number"] }}></td>
<td data-th="Channel Thumbnail"><input type="text" name="number" value={{ chan_dict["thumbnail"] }}></td>
<td>
<select name="enabled">
{% if chan_dict["enabled"] %}
<option value=True selected>Enabled</option>
<option value=False>Disabled</option>
{% else %}
<option value=True>Enabled</option>
<option value=False selected>Disabled</option>
{% endif %}
</select>
</td>
<td>
<select name="favorite">
{% if chan_dict["favorite"] %}
<option value=1 selected>Yes</option>
<option value=0>No</option>
{% else %}
<option value=1>Yes</option>
<option value=0 selected>No</option>
{% endif %}
</select>
</td>
<td data-th="Update"><input type="submit" value="Update"></td>
</form>
<form method="post" action="/api/channels?method=update&redirect=%2Fchannels_editor">
<input type="hidden" name="id" value={{ chan_dict["id"] }}>
<input type="hidden" name="name" value={{ chan_dict["origin_name"] }}>
<input type="hidden" name="callsign" value={{ chan_dict["origin_callsign"] }}>
<input type="hidden" name="number" value={{ chan_dict["origin_number"] }}>
<input type="hidden" name="thumbnail" value={{ chan_dict["origin_thumbnail"] }}>
<input type="hidden" name="enabled" value=True>
<td data-th="Reset"><input type="submit" value="Reset"></td>
</form>
</tr>
{% endfor %}
{% endblock %}

View File

@ -25,9 +25,9 @@
<tr>
<td>{{ chan_dict["name"] }}</td>
<td>{{ chan_dict["number"] }}</td>
<td><img src="{{ chan_dict["chan_thumbnail"] }}" alt="{{ chan_dict["name"] }}" width="100" height="100">
<td><img src="{{ chan_dict["chan_thumbnail"] }}" alt="{{ chan_dict["name"] }}" width="100" height="100"></td>
<td>{{ chan_dict["listing_title"] }}</td>
<td><img src="{{ chan_dict["listing_thumbnail"] }}" alt="{{ chan_dict["listing_title"] }}" width="100" height="100">
<td><img src="{{ chan_dict["listing_thumbnail"] }}" alt="{{ chan_dict["listing_title"] }}" width="100" height="100"></td>
<td>{{ chan_dict["listing_description"] }}</td>
<td>{{ chan_dict["remaining_time"] }}</td>
</tr>

View File

@ -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)

View File

@ -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)