PVR Setup Quick Start Idea

  • It's not TVH, LE now downloads the harder to update repo.

    Hopefully you dynamically create or cache the files the LE plugin downloads for the user. Odd TVH specific key given the relative file is dtv/dvb-t/au-Sutherland

    It's the users getting stuck part that make wizards tough.

    Martin

  • emveepee - I’m a little confused. I get my scan tables via the TVH JSON API.

    http://<TVH>:9981/api/dvb/scanfile/list?type=dvb-t

    I’m not sure where TVH gets that data from.

    Are you saying that in the process of building the LE TVH addon, that LE download and insert the updated scan tables into their build of the TVH server somehow?

    On my LE Dev box, I can see the scan files in:

    Code
    /storage/.kodi/addons/service.tvheadend42/dvb-scan/dvb-t/au-Sydney
    /usr/share/dvbv5/dvb-t/au-Sydney
    Code
    LEDev:~/.kodi/addons/service.tvheadend42/dvb-scan # ls -laF
    total 108
    drwxr-xr-x    7 root     root          4096 Dec 17 07:40 ./
    drwxr-xr-x    9 root     root          4096 Dec 17 07:41 ../
    drwxr-xr-x    2 root     root          4096 Dec 17 07:40 atsc/
    drwxr-xr-x    2 root     root          4096 Dec 17 07:40 dvb-c/
    drwxr-xr-x    2 root     root          4096 Dec 17 07:40 dvb-s/
    drwxr-xr-x    2 root     root         36864 Dec 17 07:40 dvb-t/
    drwxr-xr-x    2 root     root         53248 Dec 17 07:41 isdb-t/

    I assume that TVH parses the file name to extract the ISO 3166-1 alpha-2 value and then converts that to the country name for presentation via the API. Alternately, TVH may parse the content of the scan files because there are some location descriptions within the comments. I have not looked into it.


    Looking at how the scan table ‘vals’ are composed via the TVH API:

    DVB-T = Country:Region

    DVB-C = Country:Cable Provider

    DVB-S = Longitude:Satellite name

    Code
    }, {
        "key": "dvb-s/geo/dvb-s_> 76.5E:Telstar10_C",
        "val": "> 76.5E:Telstar10_C"
    }, {
        "key": "dvb-s/geo/dvb-s_> 75.0E:ABS1",
        "val": "> 75.0E:ABS1"
    }, {
        "key": "dvb-s/geo/dvb-s_> 72.0E:Intel4",
        "val": "> 72.0E:Intel4"
    }, {

    ATSC-T = Country:Region or Protocol

    Code
           }, {
               "key": "atsc-t/ca/atsc-t_ca-ON-Toronto",
               "val": "Canada: ca-ON-Toronto"
           }, {
               "key": "atsc-t/us/atsc-t_us-ATSC-center-frequencies-8VSB",
               "val": "United States: us-ATSC-center-frequencies-8VSB"
           }, {

    ATSC-C = Country:Protocol

    Harmonic Related Carrier (HRC)
    Incremental Related Carrier (IRC)

    ISDB-T = Country:Region

    Code
           }, {
               "key": "isdb-t/ar/isdb-t_ar-Argentina",
               "val": "Argentina: ar-Argentina"
           }, {
               "key": "isdb-t/br/isdb-t_br-Brazil",
               "val": "Brazil: br-Brazil"
           }, {
               "key": "isdb-t/br/isdb-t_br-ac-Bujari",
               "val": "Brazil: br-ac-Bujari"
           }, {

    I will make the Wizard split into the same categories provided by the TVH API and label the buttons/steps accordingly.

    With respect to users 'getting stuck': Perhaps an extensive 'try every combination' approach would be required. Unfortunately, that could take hours to do a scan. Every mux has a frequency, then several possible bandwidths for that frequency, then several possible encoding parameter variations.

    Edited once, last by DeltaMikeCharlie: Merged a post created by DeltaMikeCharlie into this post. (December 23, 2023 at 6:55 AM).

  • LE bundles the upstream dtv-scan-tables, see: https://github.com/LibreELEC/Libr…package.mk#L132 and https://github.com/LibreELEC/Libr…s/package.mk#L8

    Motivation for the change is here: https://github.com/LibreELEC/LibreELEC.tv/pull/8311

    I'd be keen to encourage Tvheadend and other PVR back-ends to adopt the upstream scan-table repo too. If there's an effort from multiple projects to use and improve the upstream tables we all collectively benefit, and sending a patch to a mailing list isn't really any harder for users than sending a pull-request; it's just a new skill to learn (one that's easily coached with a good wiki article) and requires a little discipline from project maintainers to politely refuse/redirect user contributions.

  • The Makefile bundles the tables for its own .deb/.rpm packaging which the LE build-system ignores since we're picking the binary blob and some .so bits needed and ignoring everything else. This patch is applied at build-time: https://github.com/LibreELEC/Libr…scan-path.patch and we ship the upstream tables (as stated before).

    Making the inclusion of scan tables and the path to expect them under build-time --configurable would be a nice-to-have change so LE can drop the patch. I have a large to-do list, but I'll add that somewhere.

  • Making the inclusion of scan tables and the path to expect them under build-time --configurable would be a nice-to-have change so LE can drop the patch. I have a large to-do list, but I'll add that somewhere.

    This is off-topic, but I have often thought that a command line option for the location of the config/data files would also be useful.

  • This is off-topic, but I have often thought that a command line option for the location of the config/data files would also be useful.

    Why would that be needed on LE especially if you are trying to simplify things? For the dtv-scanning-table I didn't use the same approach with the NextPVR server package because I don't think it needs to always part of the package and it doesn't need to download the huge isdb-t folder (we've not had one user) so it is custom. However if there was a separate add-on and it was an optional install I would probably use it and the location wouldn't really manner. Plus the add-on itself would get updates, although I am not as optimistic that users will sub updates to the Linux mailing list. One location for all backend would make it easier to document adding custom conf files.

  • This is an interesting and, I think, a good idea -- as a someone who uses LibreElec with TVHeadend exclusively as a PVR.

    Having just updated to 11.04 and installed a larger SSD I logged in to scan the forum for ideas to improve my PVR setup. I'm potentially interested in new hardware too as as my PVR box is old and I am sure I could exchange it for something using a fraction of power, but I haven't researched this yet. First, I'd like to optimise my software setup and then look at new hardware.

    Software

    I live in Ireland and have access to Irish and UK terrestrial and satellite TV, and potentially to IPTV (haven't used so far). First requirement is integrating EPG data from different sources. This works fine but it is tedious to set up in an attractive way -- principally by filtering out all the channels one doesn't care to have included (approximately 90% of over 1,000 in my case).

    My other PVR, a ZGemma HS7 box in the bedroom, running OpenVix software -- essentially an updated Enigma2 box -- provides many more bouquets than simply Terrestrial and Satellite. I use this mainly to be able to make more simultaneous recordings (a very occasional need).

    I tried, briefly, to make the EPG be in sync, presentationally, with that on my LibreElec HTPC. It wasn't worth the trouble and I gave up. Software updates tended to mess things up. One thing that the ZGemma does seem to do, however, is handle channels moving to different frequencies with a bit less effort than TVHeadend. Occasionally there are odd minor discrepancies between what the TV, the HTPC and the ZGemma can decode from the same inputs (dish and UVHF aerial), but... if it was possible I would like to be able, going beyond the steps outlined envisaged in the setup wizard to import selected bouquets from the ZGemma or, more realistically, some other source

    • Movies
    • News
    • Entertainment
    • Children's programmes
    • All Satellite
    • etc

    Perhaps an impossible idea in some places, but I'd like to think it ought to be doable for the UK and Ireland's FTA channels.

    I'm not using it at the moment but I have used TVHadmin in the past to manage recordings on LibreElec and will likely reinstate it (running on raspberry pi) and use Tailscale to access it when away from home (I have an exit node on my Pfsense router).

    The ZGemma web UI is less attractive than LibreElec/Kodi's. I use

    • A raspberry pi running LibreElec as an HTPC client in the bedroom alongside the ZGemma
    • A flatpak version of Kodi with the Enigma2 plugin on my laptop for managing ZGemma recording/s via a better UI

    A way of flipping between the Enigma2 plugin and HTPC client mode would be ideal.

    Hardware

    Things that have kept me using my old HTPC:

    • I have a 450W silent power supply in it
    • It has an internal Hauppauge DVB-S2 tuner card (also a USB DVB-T externally)
    • I am happy with 1080p video output

    The hardware works fine and my only real issues with the box have been

    • power consumption is higher than I'd like (40W appx) as I leave the PC on 24x7. My efforts to save energy by getting the box to sleep at times when not in use tended to result in outdated / incomplete EPG data. I just never found time to fiddle with this further.
    • the PC isn't on a UPS and needs to be manually switched back on after a power outage or glitch. This has been forgotten on occasion, resulting impact on outdated EPG, sometimes discovered when attempting to cue a recording on the way out the door.

    I believe there are a good number of mini PCs for sale online on places like AliExpress which i could use as a more energy efficient PVR and I will be interested to see if any are popular for this, and which would justify retiring the old HTPC and internal tuner (I can reuse the SSD and DVB-T tuner).

    Finally

    I might consider other ideas besides updating my existing STB arrangements, such as putting a larger mini PC with multiple tuners in the attic and using raspberry pi clients in the rooms with TVs (2) and scrapping the existing PVR boxes (and making the coax cables to them redundant; I have Ethernet wiring in place). Happy to have any suggestions for improvement to my current setup.

    In any case, I'd like to thank the developers and all who have contributed to LibreElec for enabling me to run a fine PVR at very little cost over the years, and wish you all a Merry Christmas and all the best for 2024.

    Update 29 December

    Found the time over Christmas to get my PVR box to sleep when not in use and to wake up in order to record, backup, and update the EPG. Turns out it had a somewhat hidden BIOS setting for enabling RTC wake (from S4). Finding that sooner would have saved me some money /sigh. At least I can forget buying a new box and tuner for at least another year if not more.

    Leaves some interesting TVHeadend / channel updates / bouquets challenges. One small suggestion if LE is to function as a front end for some TVH tasks: it would be good to automatically back up existing configuration info before updating it to facilitate comparing old and new versions.

    Edited once, last by PJO4 (December 29, 2023 at 11:37 AM).

  • Why would that be needed on LE especially if you are trying to simplify things?

    I was referring to a change to TVH. The default location for TVH’s data files is something like ‘/home/<user>/config/.hts’ and for the LE addon, it is changed to something like ‘/storage/.kodi/addons/service.tvheadend42’.

    Having a command line switch in the TVH executable to change the default data location would allow for easier configuration for LE as well as allowing for multiple configurations on a system while testing.

  • I have decided to name it a "PVR Quick Start" rather than a "Wizard" because I think that it will translate with a clearer meaning and a "Quick Start" is a more modest claim than a 'Wizard".

    I’ve made most of the transition from my prototype stand-alone script to a Kodi-aware script addon.

    The green items are complete and the red items are outstanding.

    Once a red item is complete, it turns green and the next item is requested.

    One thing that I noticed during my initial development and also with the Kodi addon is that when TVH scans for services, it does not always capture the LCN (logical channel number) on the first attempt. Sometimes it can take up to 3 attempts to successfully scan services with their LCNs.

    The result that I get is that every service on a mux will be missing their LCNs. As tuning progresses, I check for the presence of LCNs on the scanned services and schedule a mux to be re-scanned if LCNs are not found for that mux. If a mux has no services, it is skipped for all future scans. I do this up to 3 times for each mux before abandoning the process.

    I also time-limit this exercise. I take the number of muxes, multiply by 3 and then allow 15 seconds per mux. If this calculated time exceeds 2 minutes, then I cap the process at 2 minutes.

    This works fine for my DVB-T system with 6 muxes (5 active) yielding 57 services. However, my previous experience with Topfield PVRs, suggests that DVB-C and DVB-S users may have many dozens of muxes providing hundreds, if not thousands of services.

    Some questions for DVB-C and DVB-S users:

    • Do you think that 15 seconds per mux is sufficient?
    • How long does a standard TVH scan take if you were to use the existing TVH wizard?
    • Do your broadcasters supply LCNs?
    • Are LCNs important to you?
    • Does anyone have multiple cable or satellite providers connected to their system.
  • On Astra 28.2 DVBS with 69 active muxes a scan taxes approximately 30 minutes. This is purely a back of the hand calculation.

    Maybe supply a user defined field option where the user can supply a variable in seconds between 1 and 60 and let the user decide how long the muxes are scanned for. Not every tuner performs the same when it comes to scanning.

  • petediscrete - Thanks for the feedback.

    Based on your figures, you are averaging 26 seconds per mux. This is almost twice the time that I am allowing before taking my arbitrary limit into account. I definitely need to reconsider my approach!

    I think that I will still calculate the maximum time that a scan can last for, but remove the cap. In addition to this, I will give the user the option to abort the scan and then either exit completely or just map the services that have already been discovered to channels.

    For your particular setup, a scan could last for close to 2 hours with multiple passes to catch LCNs.

    Whilst I am sure that the time that it takes the adapter hardware to retune for each mux may play a role in the duration of a scan, I also think that the frequency with which the provider broadcasts the DVB table that contains the service information also plays a big role.

    I just with the "Generic - Australia" set of DVB-T muxes. This contains about 100 mux definitions and I was able to scan them all, including LCNs, in around 5 minutes. When I review my log file, I can see that the first scan of a mux did not always finds LCNs and that some muxes were scanned multiple times.

    With respect to LCNs: Do you use them? Does your broadcaster supply them?

    I may add an option “Extra scans for missing LCNs” and allows the user to set between 0 to 3 additional scans for muxes with services but no LCNs.

  • As I mentioned above my figures were not science and vary with different tuners, Sat/IP and PCIe tuner in my case

    I imagine a more sensitive tuner may take longer to tune a mux, not sure, and the signal quality on the network would also play a part in it too.

    You may have to put it out there and invite others to participate in these tests to get a broader picture of what’s going on here.

    I’ll certainly try a full scan on both tuners I have and supply you with feedback when I get an opportunity to do so.

  • I hope that I am ready for the first public test of my addon so I am seeking volunteers who may be interested in testing this addon.

    Be warned: This addon is intended to be run on a pristine, newly installed system so it will do some significant damage if run on a running system. Testers should be prepared to backup/restore their live system or use a test/development system instead.

    Here are the steps that the addon takes:

    • Check to see that Kodi addons ‘service.tvheadend42’ and ‘pvr.hts’ are installed and enabled. If they are not installed, install them automatically answering user prompts. If they are installed but not enabled, enable them (You never know!).
    • If installation of the above addons fails, abort after presenting an error message to the user.
    • Check if parental rating labels are supported. Suppress the option if not.
    • Get the local IP address to display in the window sub-heading.
    • Check that there are adapters connected. If not, notify user and loop until the user connects adapters or exits.
    • Get the Kodi language and convert that into the closest TVH UI language.
    • Get the LibreELEC host name.
    • Automatically prompt the user to select a tuner type only showing the tuner types for the detected adapters.
    • Depending on the tuner type selected, automatically prompt the user for the first location category. This could be country or satellite longitude, etc.
    • Automatically prompt the user for the next location category. This could be geographical region, cable TV provider or satellite name.
    • If this version of TVH supports the feature, automatically prompt the user to enable parental rating labels, otherwise, skip this step.
    • Highlight the ‘Configure’ button.
    • Ask if the user really wants to proceed.
    • Perform configuration:
      • Set TVH UI language.
      • Set TVH server name.
      • Create a new TVH ‘Network’ of the appropriate type automatically associating the muxes from the selected location categories with that network.
      • Attached the new network to the adapters matching the selected adapter type.
      • Initiate a service scan time-limited according to the number of muxes.
      • Provide the user with a scan progress.
      • For successfully scanned services, rescan the source mux if no LCNs are present. Scanning a maximum of 3 scans.
      • If no services are found, display a message then exit.
      • If the user selected Australia as the country, set the OTA genre translations. If the TVH version does not support this feature, this request will be ignored by TVH.
      • If parental rating labels are supported and enabled by the user, enable the feature. Also search for pre-defined rating labels for the selected country and load those if found.
      • Automatically map every service to a channel.
      • Automatically create a channel tag for each mux that has services.
    • Notify the user that the setup is complete.
    • Change to the EPG grid view.

    To install the addon, copy the zip file to your system and install it using the ‘Install from zip file’ option. You may be prompted to allow addons from unknown sources.

    Once installed, you into Add-ons/My add-ons/Program add-ons, run ‘TVHeadEnd PVR Quick Start’ and follow the prompts.

    Both English and German should work. I plan to add French, Spanish and Czech.

    The addon is currently too large to attach here. I need to shrink some images. Instead, it can be downloaded from my GitHub repository: https://github.com/DeltaMikeCharl…pt.quicktvh.zip

  • Check to see that Kodi addons ‘service.tvheadend42’ and ‘pvr.hts’ are installed and enabled

    Just be advised that the moment there's upstream movement on a TVH 4.4 release we will be dropping the TVH 4.2 add-on (as 4.2 will no longer be the 'stable' TVH release). It would be better to develop against the 4.3 add-on.

  • Just be advised that the moment there's upstream movement on a TVH 4.4 release we will be dropping the TVH 4.2 add-on (as 4.2 will no longer be the 'stable' TVH release). It would be better to develop against the 4.3 add-on.

    Thanks, I have already planned for that. The addon names are held in an external python file that only sets a few default values and can be easily created/edited via a script and basic tools. This file could be easily created/updated by a build script as version numbers progress if the addon is one day shipped as part of LE.

    The external file will also be useful if the addon is used as the basis for a NextPVR Quick Start guide.

  • Just be advised that the moment there's upstream movement on a TVH 4.4 release we will be dropping the TVH 4.2 add-on (as 4.2 will no longer be the 'stable' TVH release). It would be better to develop against the 4.3 add-on.

    That’s interesting. Could you elaborate a little more on that. I didn’t notice any mention of that on either the TVH forum or Github.