I have written a better EPG
Added by Paul M about 6 years ago
I'm sorry but I know this has been covered in various ways when discussing apps, but I don't think it's been specifically discussed about the web interface that you access from laptop or desktop.
The default EPG in TVH is useful if you want to look for a specific channel, or search for a specific program. However, unlike most DVRs, there doesn't appear to be a grid view with channels listed vertically and "now and next" listed horizontally.
Replies (66)
RE: I have written a better EPG - Added by Paul M almost 4 years ago
I had a look the dave-p/TVHadmin interface and it's pretty good, the timeline view is close to what I want to achieve.
things I would add to it in configuration:- persistent auth token setting
- separate URL for connection to service for internal use vs the URL that is given to streaming players
- persistent auth token for streaming
- when you click, set the downloaded file to be "tvheadend.m3u" so you can open it from the browser in chosen app, e.g. vlc
- in timeline, hover the mouse for more information, the 2nd title and exact start and end times
- add chromecast support
- add a button to record the show
- filter channels by name or tag
- when you click, set the downloaded file to be "tvheadend.m3u" so you can open it from the browser in chosen app, e.g. vlc
- set the URL to contain username/password for the streaming player
- filter by name or channel or something
RE: I have written a better EPG - Added by Dave Pickles almost 4 years ago
It seems a few of us have been using our "lockdown" time to write Tvheadend interfaces...
I've created a Javascript version of TVHadmin - https://github.com/dave-p/TVHadmin-JS
It's pure Javascript with no external dependencies and loads from the Tvheadend server - no external web server needed. It uses the same authentication as the native web interface. The only requirement is a reasonably up-to-date browser on the client - IE definitely will not work.
RE: I have written a better EPG - Added by Paul M almost 4 years ago
I saw that, Dave and I am impressed. Please feel free to steal any of my code if you think it will benefit your EPG.
RE: I have written a better EPG - Added by Dave H almost 4 years ago
I just tried to install and run TVHadmin-JS but I'm obviously doing something wrong.
I went to https://github.com/dave-p/TVHadmin-JS and am trying to follow the instructions there.
My TVH has a /usr/share/tvheadend/src/webui/static/ directory (created by my distro) so that's where I created a tvhadmin directory. The instructions say to copy the repository there and I'm not sure what that means. So I did
$ git clone https://github.com/dave-p/TVHadmin-JS.git
I then went to http://localhost:9981/static/tvhadmin/TVHadmin.html
and got a server error message and the TVH log said
2020-11-26 17:37:45.301 webui: failed to open src/webui/static/tvhadmin/TVHadmin.html
2020-11-26 17:37:45.301 http: 127.0.0.1: HTTP/1.1 GET /static/tvhadmin/TVHadmin.html -- 500
Now I believe that's because the file is actually a directory lower and a request for
http://localhost:9981/static/tvhadmin/TVHadmin-JS/config.html
does work, so I don't know whether the instructions are wrong or just unclear and I did something wrong.
RE: I have written a better EPG - Added by Dave Pickles almost 4 years ago
The intention was that you would create a new directory 'tvhadmin' under /usr/share/tvheadend/src/webui/static/ and then manually move the files into there. However it is much simpler to just do a git clone into /usr/share/tvheadend/src/webui/static/ so I'll change the instructions. The URL should then be http://your.ip:9981/static/TVHadmin-JS/TVHadmin.html
Thanks for the bug report!
RE: I have written a better EPG - Added by Dave H almost 4 years ago
So I'm enjoying having a look at this interface. Thanks!
One suggestion. On the timeline, the strap with the date and times should be part of the fixed header, not part of the vertically scrolling frame. And yes it should also be part of the horizontally scrolling frame, so I suppose that means nested frames are required.
PS dunno if 'frame' is the correct word here.
RE: I have written a better EPG - Added by Dave H almost 4 years ago
Dave Pickles wrote:
The intention was that you would create a new directory 'tvhadmin' under /usr/share/tvheadend/src/webui/static/ and then manually move the files into there. However it is much simpler to just do a git clone into /usr/share/tvheadend/src/webui/static/ so I'll change the instructions. The URL should then be http://your.ip:9981/static/TVHadmin-JS/TVHadmin.html
Apart from that I was I thought following the instructions, the reason I created the initial tvhadmin directory was so I could change ownership to my own user before I did anything else.
/usr/share/tvheadend/src/webui/static/ belongs to my distro, and anything I do in there is 'naughty' and will get wiped out or complained about whenever I do an upgrade, so I wanted to be very sure I could easily recognize anything I had put in there.
Dunno if there's anywhere else in the user-controlled part of the tree where I could put stuff and have TVH find it?
RE: I have written a better EPG - Added by David G almost 4 years ago
Umm, I just tried to update to the latest tvh_epg.py file but it produces the attached error for me?
EDIT: Sorted, after updating you need to go to the settings tab, check "Maximum Number Of Channels", then submit. I just left it set at 500.
tmp00rvbjzv.html (9.1 KB) tmp00rvbjzv.html | error file |
RE: I have written a better EPG - Added by Paul M almost 4 years ago
thanks David G, I will address that bug.
I have to set my channel max to 1700 for freesat, but I have a config error and a lot of duplicated channels.
RE: I have written a better EPG - Added by Paul M almost 4 years ago
David P, maybe hack in an install.sh script which simply rsync's the files to the required directory and sets the appropriate ownership?
RE: I have written a better EPG - Added by Paul M over 3 years ago
I squashed a few bugs and added a few features, thanks to dgilbert2 on guthub for his help and patience.
RE: I have written a better EPG - Added by Paul M over 3 years ago
if I add some new settings then yes, it should advice that you need to go to the settings page to update things.
RE: I have written a better EPG - Added by John White about 3 years ago
Hello, I must be failing somewhere but followed instructions to install this (Ubuntu 18.04 with Apache2; cgi mod enabled) but cannot get this to work. Apache error log spits out (see below) I have a .cgi and a .py test page which work - but are very simple As an aside, I do have David P's js version working; so I CAN manage something...
[Fri Sep 24 14:11:04.731995 2021] [core:notice] [pid 43595:tid 140394749135808] AH00094: Command line: '/usr/sbin/apache2' Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3.6/tempfile.py", line 401, in _mkstemp_inner fd = _os.open(file, flags, 0o600) FileNotFoundError: [Errno 2] No such file or directory: '/var/www/html/python_errors/tmpdc207m2w.html' Original exception was: Traceback (most recent call last): File "/usr/lib/cgi-bin/tvh_epg.py", line 1615, in <module> web_interface() File "/usr/lib/cgi-bin/tvh_epg.py", line 1550, in web_interface html_page_header() File "/usr/lib/cgi-bin/tvh_epg.py", line 1334, in html_page_header if BG_COL_PAGE in MY_SETTINGS[SETTINGS_SECTION] and MY_SETTINGS.get(SETTINGS_SECTION, BG_COL_PAGE) != '': File "/usr/lib/python3.6/configparser.py", line 959, in __getitem__ raise KeyError(key) KeyError: 'user' [Fri Sep 24 14:11:23.088810 2021] [http:error] [pid 43599:tid 140394536879872] [client 192.xxx.x.xx:58886] AH02429: Response header name '<!--' contains invalid characters, aborting request
RE: I have written a better EPG - Added by Paul M about 3 years ago
Hi John White
I have set my default web docs directory to /var/www/html and if the python goes wrong it expects to write to the directory /var/www/html/python_errors
if that is your web root, try making that directory and changing the group perms to writable, and the group ownership to www-data (or httpd, or whatever your daemon runs as).
if your web root is different, you'll have to tweak the python slightly to suit, and make the directory in the appropriate place and set the perms.
hope this helps,
Paul
RE: I have written a better EPG - Added by John White about 3 years ago
Thanks for reply, have had time to do as suggested...
now have this:
/usr/lib/cgi-bin/tvh_epg.py in <module>()
1613 cgitb.enable(display=0, logdir=DOCROOT + '/python_errors', format='html')
1614
=> 1615 web_interface()
1616
1617 else:
web_interface = <function web_interface>
/usr/lib/cgi-bin/tvh_epg.py in web_interface()
1548 html_page_footer()
1549 elif p_page == 'error':
=> 1550 html_page_header()
1551 page_error(error_text)
1552 html_page_footer()
global html_page_header = <function html_page_header>
/usr/lib/cgi-bin/tvh_epg.py in html_page_header()
1332
1333 bg_col_page = BG_COL_DEF_PAGE
=> 1334 if BG_COL_PAGE in MY_SETTINGS[SETTINGS_SECTION] and MY_SETTINGS.get(SETTINGS_SECTION, BG_COL_PAGE) != '':
1335 bg_col_page = MY_SETTINGS.get(SETTINGS_SECTION, BG_COL_PAGE)
1336
global BG_COL_PAGE = 'bg_col_page', global MY_SETTINGS = <configparser.ConfigParser object>, global SETTINGS_SECTION = 'user', MY_SETTINGS.get = <bound method RawConfigParser.get of <configparser.ConfigParser object>>
/usr/lib/python3.6/configparser.py in getitem(self=<configparser.ConfigParser object>, key='user')
957 def getitem(self, key):
958 if key != self.default_section and not self.has_section(key):
=> 959 raise KeyError(key)
960 return self._proxies[key]
961
builtin KeyError = <class 'KeyError'>, key = 'user'
I don't have any initiation of setting up a "settings file"; when I tried to create a user with persistent authentication in the TVH "users" page; there is no "persistent authentication token" read only field. Perhaps my TVH version is too old/outdated (v HTS Tvheadend 4.2.8-36~g5bdcfd8ac) ??
Regards John
RE: I have written a better EPG - Added by Paul M about 3 years ago
Hi,
did you make the directory /var/lib/tvh_epg/
and make it group www-data and group writable? (or whatever httpd runs as)
that should allow you to go into the settings menu and set the values to your local services. the EPG cgi-bin doesn't need to run on the same server as TVH, which might be a good thing if you're running TVH on a low powered device like a Pi.
RE: I have written a better EPG - Added by Paul M over 2 years ago
with the help of "dgilbert2" on github, I have made some big improvements to my tvh_epg.py program.
- CSS fixes so the layout works better across platforms
- tooltips work, showing additional program detail if available
- code to avoid broken picons
for those stumbling across this discussion, the repository is here: https://github.com/speculatrix/tvh_epg
RE: I have written a better EPG - Added by David G over 2 years ago
Last nights latest w3c updates have broken a couple of my TV logos, screenshot below;
https://i.postimg.cc/ZncgR9gV/Broken-TV-Logos.png
Its looking for picon That's%20Music.png but the file itself is That's Music.png. What should the file name actually be?
RE: I have written a better EPG - Added by Paul M over 2 years ago
Hi,
I'll take a look. I haven't updated my picon set for a while, so I'll do that and test it.
RE: I have written a better EPG - Added by David G over 2 years ago
I've done some digging and the issue seems to be the coding for the ' character used in "That's".
The picon URL name in tvh_epg therefore needs to be changed to;
That%27s%20Music.png
Hope that helps?
RE: I have written a better EPG - Added by David G over 2 years ago
I may have just found a fix?
Around line 89 I did this (&rsquo #'d out and added the %27 line);
INPUT_FORM_ESCAPE_TABLE = { '"': """, ####"'": "’", "&": "&", } URL_ESCAPE_TABLE = { " ": "%20", "'": "%27", }
RE: I have written a better EPG - Added by Dave H over 2 years ago
Something's not quite right there. ' doesn't need to be escaped in a URL, and neither ' nor space need to be escaped in a filename, at least on linux and friends. So whilst it might make things work, it doesn't smell right.
RE: I have written a better EPG - Added by David G over 2 years ago
I see what you mean, the %27 and %20 lines aren't needed for it to work. Its the &rsquo line that just needs to be #'d. One for Paul to look at ;-)
RE: I have written a better EPG - Added by Paul M over 2 years ago
I updated my picons from git but for freesat in the UK, I don't get a "That's Music.png" file.
I don't have any logo files with a single or double quote, so I only got to test with an ampersand, but I will look at how I am using the URL_ESCAPE_TABLE to make sure I am doing it right. The code needs tidying up as there's too much identical code between page_epg and page_channels anyway.
RE: I have written a better EPG - Added by Paul M over 2 years ago
p.s. I am happy to accept pull requests or diff/patches.