dave-p / TVHadmin-JS

A javascript front-end for Tvheadend, inspired by VDRadmin
GNU General Public License v3.0
31 stars 8 forks source link

Installation instructions for LibreElec missing #15

Closed arcasys closed 1 month ago

arcasys commented 2 months ago

For the beginning of the story please see [(https://github.com/dave-p/TVHadmin/issues/19)].

It looks like integration must be done in the v4.2.8 tag and the following to cover Tvheadend 4.2 and 4.3. The latter is still listed as experimental in LibreElec 11.0.6. For a first check I did

git clone https://github.com/LibreELEC/LibreELEC.tv.git
git checkout 11.0.6
cd LibreELEC.tv/packages/addons/service/tvheadend43

Unsurprisingly, in this folder we have a file package.mk. Looking into package.mk there is a line

PKG_URL="https://github.com/tvheadend/tvheadend/archive/${PKG_VERSION}.tar.gz"

which is a dead link because https://github.com/tvheadend/tvheadend/ doesn't have a folder archive. I'm not familiar with the LibreElec build system but I think building a LibreElec version includes building all addons and other dependencies. Obviously the starting point would be https://github.com/tvheadend/tvheadend where we find a Makefile.webui with

WEBDIR ?= src/webui
LANGUAGES ?= $(LANGUAGES_ALL)
ROOTPATH = static

ifneq ($(WEBUI),)

TOPDIR=$(dir $(IAM))
include $(TOPDIR)/.config.mk
EXTJSPATH = $(ROOTPATH)/extjs

Here we have the paths we were looking for.

And now? I'll open a thread in the LibreElec forum asking to intergrate TVHadmin-JS into the LibreElec addon repository. Then we'll see what happens.

dave-p commented 2 months ago

I tried installing LibreElec and Tvheadend on a Pi4 and had the same problem as you finding the Tvheadend static files. The build script for the Tvheadend addon doesn't give the install process. So it looks as though the Javascript version is not going to work.

The PHP version of TVHadmin can be hosted on a web server anywhere it can connect to the Tvheadend server port 9981, it doesn't have to be on the same server and Tvheadend can continue to live on the LibreElec box. It could even run on your workstation. I originally wrote it to avoid making Tvheadend accessible from the internet, these days we have VPNs so there is less of a need.

Incidentally I would suggest that you switch to Tvheadend version 4.3 at some point. The project is likely soon to switch to a 'rolling update' mode, so there will never be another 'stable' release. The project has been revitalised by some of the folks involved with LibreElec so maybe closer integration between the two might happen.

There is acceptance within the project that the present UI is outdated and hard to use for day-to-day tasks, but no-one seems interested in taking on the job of writing a replacement - the UI code is integrated into the core of Tvheadend and it would be hard to unpick the two. A partial alternative is to integrate TVHadmin into Tvheadend. The main thing missing from TVHadmin at present is i18n, and though I've briefly looked at the possibility I haven't made any progress.

arcasys commented 2 months ago

So it looks as though the Javascript version is not going to work.

I think it's not impossible and would be more clever.

The PHP version of TVHadmin can be hosted on a web server anywhere it can connect to the Tvheadend server port 9981, it doesn't have to be on the same server and Tvheadend can continue to live on the LibreElec box.

OK, I had to read this twice: I thought I'll loose the LibreElec/Kodi integration which is important for me, but i missed the point that tvheadend stays on the LibreElec system (which is a Pi B3+ btw) and TVHadmin does not need a tuner but connects to the Tvheadend instance on the Pi. I'll give this a try and report back - this will take some time because I'll be on holiday until Oct 10.

Incidentally I would suggest that you switch to Tvheadend version 4.3 at some point.

I'll try that eventually - still, I wonder why 4.3 is marked as experimental. I have good reasons to stay with LE11.0.6 and not upgrade to 12.

There is acceptance within the project that the present UI is outdated and hard to use for day-to-day tasks, but no-one seems interested in taking on the job of writing a replacement - the UI code is integrated into the core of Tvheadend and it would be hard to unpick the two.

No need to remove the current UI code. The 'old' UI can still be used for configuration and admin tasks. It's not too bad for that once you're over the learning curve (I'd only missed a possibility to select/deselect a field in a long list)

A partial good alternative is to integrate TVHadmin into Tvheadend. The main thing missing from TVHadmin at present is i18n, and though I've briefly looked at the possibility I haven't made any progress.

I wouldn't care to much about I18n in the first place. Once there is a good solution in the world there will be people to support this.

arcasys commented 2 months ago

I'll give this a try and report back - this will take some time because I'll be on holiday until Oct 10.

A quick feedback: It works! Installing and configuring apache, php and dependencies on a server I had set up recently for test purposes and pulling master.zip from git into my web root took less than half an hour. I had to fix the timezone in /etc/php/8.3/apache2/php.ini. I have three Tvh accounts and the admin account allowed configuring TVHadmin. A logout would be nice. Streaming does not yet work - I'll check that when I'm back from holiday. Channel list is OK and matches the list in kodi, channel groups are as in Tvh but that's a different issue (while channel synchronization works in both directions group synchronization does not). Thank you for the hint. Great work!

chewitt commented 2 months ago

The existing GitHub instructions should work but LE packages Tvheadend server (4.2 on older LE releases, 4.3 on current ones) as a Kodi binary add-on so the install location is something like /storage/.kodi/addons/service.tvheadend/ and not the normal /usr/share/tvheadend location. Find the webserver root folder, copy the master.zip file over, unpack and rename. The one challenge you'll have with our add-on packaging approach is that any updates LE push for the Tvheadend server addon will result in the binary addon folder being removed and replaced with the updated version, which nukes your changes. That doesn't happen often though, and would be fairly easy to write a boot time script for: test for the folder, if not present copy the required files from somewhere else on /storage etc.

dave-p commented 2 months ago

What's stumped both of us is finding the webserver root. On a normal installation the /user/share/tvheadend/src/webui/static directory contains

drwxr-xr-x 2 root root   4096 Feb 25  2024 app
drwxr-xr-x 2 root root   4096 Oct 23  2021 checkcolumn
drwxr-xr-x 5 root root   4096 Oct 23  2021 extjs
drwxr-xr-x 3 root root   4096 Apr 25 13:49 icons
drwxr-xr-x 3 root root   4096 Feb 25  2024 img
drwxr-xr-x 2 root root   4096 Oct 23  2021 intl
drwxr-xr-x 3 root root   4096 Oct 23  2021 livegrid
drwxr-xr-x 3 root root   4096 Oct 23  2021 lovcombo
drwxr-xr-x 3 root root   4096 Oct 23  2021 multiselect
-rw-r--r-- 1 root root  26312 Apr 25 13:49 smoothie.js
-rw-r--r-- 1 root root   3466 Apr 25 13:49 tv.css
-rw-r--r-- 1 root root  18397 Apr 25 13:49 tv.js
-rw-r--r-- 1 root root    834 Apr 25 13:49 tvh-tv.css.gz
-rw-r--r-- 1 root root 206260 Apr 25 13:49 tvh-tv.js.gz
-rw-r--r-- 1 root root  22846 Apr 25 13:49 tvh.access.css.gz
-rw-r--r-- 1 root root  22208 Apr 25 13:49 tvh.blue.css.gz
-rw-r--r-- 1 root root  22215 Apr 25 13:49 tvh.gray.css.gz
-rw-r--r-- 1 root root 291492 Apr 25 13:49 tvh.js.gz
drwxr-xr-x 2 root root   4096 Oct 23  2021 xcheckbox

None of these files appear anywhere in the LibreElec filesystem, however they can all be fetched from the Tvheadend webserver. Have they been packed into the tvheadend binary? Using curl to fish for nonexistent files in the /static/ directory always produces a 500 server error while any other nonexistent path results in 404, suggesting that the /static/ path is being treated differently.

arcasys commented 2 months ago

Please have a look at https://github.com/dave-p/TVHadmin/issues/19 where it becomes obvious that webserver and webroot are built into the Tvh binary and are not accessible from the filesystem. There simply is no webserver root folder on the file system and the installation as suggested by @chewitt cannot work This thread and the quoted thread provide a lot of information on the nature of the problem.

dave-p commented 2 months ago

I got it working eventually, though the process is far from trivial. It involves creating a fork of Tvheadend with the TVHadmin code included at src/webui/static/, then using the LibreElec build process to make a new Tvheadend addon.

polojoe commented 2 months ago

Could you provide the addon to test?

dave-p commented 2 months ago

Could you provide the addon to test?

What's your platform? See https://wiki.libreelec.tv/development/build-commands/build-commands-le-12.0.x for the choices.

polojoe commented 2 months ago

Rpi4 aarch64

dave-p commented 2 months ago

Try this: https://github.com/dave-p/TVHadmin-JS/releases

polojoe commented 2 months ago

Works, thank you!

arcasys commented 1 month ago

For me, the issue is resolved. A logout would still be nice as well as having the LibreElec/Kodi folks include it in their repository

dave-p commented 3 weeks ago

Having spent a good deal of time creating a new LibreElec add-on for Tvheadend including TVHadmin, it was annoying to find instructions for adding TVHadmin to the stock Tvheadend add-on in, of all things, a Youtube video!

https://www.youtube.com/watch?v=vlcYkYyRZaU

The secret is to manually add the directories src/webui/static to the existing config at /storage/.kodi/addons/service.tvheadend43/ and then install TVHadmin there.

I've updated the installation instructions.