oe-alliance / AutoBouquetsMaker

Automatically build and update bouquets from the DVB stream.
GNU General Public License v3.0
22 stars 59 forks source link

Fix DVB-T frequency when 1 transponder found at the NIT table and that frequency is different from tune frequency. #244

Closed Azureit closed 2 years ago

Azureit commented 2 years ago

Fix DVB-T frequency when 1 transponder found at the NIT table and that frequency is different from tune frequency.

Let me try to explain this code:

Azureit commented 2 years ago

@Huevos Do you see anything wrong here?

Huevos commented 2 years ago

Please try TerrestrialScan plugin.

Azureit commented 2 years ago

Please try TerrestrialScan plugin.

@Huevos I tried TerrestrialScan and is working ok, but it could be improved:

There are differences in lamedb transponder line, when using different methods to do the terrestrial scan. Automatic Scan: t 594000000:0:5:5:3:2:4:4:2:0:0:0 TerrestrialScan: t 594000000:0:0:0:3:2:4:4:2:0:0:0 AutoBouquetsMaker: t 594000000:0:1:0:2:1:3:0:0:0:0:0

Huevos commented 2 years ago

Just to respond to your points:

Bandplan "UHF Europe" is the default because: 1) it is a fixed bandplan that covers the requirements in all European countries, 2) a terrestrial.xml file is not mandatory on the enigma system, 3) the plugin must run a full bandscan in order to create a custom terrestrial.xml for your location.

The LCN descriptor is specified because: 1) some transponders have multiple ones, 2) all are detected anyway but only the specified is used.

Ok is asked for and found channels shown because: 1) it is just a standard enigma scan, 2) that is the way an enigma scan works.

I'm not really interested in the lamedb parameters. The plugin just feeds the frequencies to enigma and enigma does the scan. So those parameters in lamedb are from enigma, not the plugin.

Huevos commented 2 years ago

By the way, if you like ABM also try SatScanLcn plugin. Allows to create or update just one bouquet at a time.

Azureit commented 2 years ago

@Huevos

Bandplan "UHF Europe" is the default because:

1. it is a fixed bandplan that covers the requirements in all European countries,

2. a terrestrial.xml file is not mandatory on the enigma system,

3. the plugin must run a full bandscan in order to create a custom terrestrial.xml for your location.
  • You could detect terrestrial.xml and default to "load xml" if exists and to "UHF Europe" if doesn't exists.
  • Nice option to narrow the terrestrial.xml so the next scan will be faster.


    The LCN descriptor is specified because:

    1. some transponders have multiple ones,

    2. all are detected anyway but only the specified is used.

  • Most users don't know what that option is and leave it default,
  • ABM deals with multiple lcn at same transponder, I know an example and it works.


    Ok is asked for and found channels shown because:

    1. it is just a standard enigma scan,

    2. that is the way an enigma scan works.

  • The experience of usage will be pleasant if didn't ask for OK, like the ABM do. That way it resembles the Automatic scan.
Azureit commented 2 years ago

ops I clicked the ready for review button and don't know how to undo it.

Huevos commented 2 years ago

ABM deals with multiple lcn at same transponder, I know an example and it works.

Tell me which one so I can respond. Which provider?

The OK is from enigma manual scan. It has been there almost 10 years. It is there so the user can select which channel to view after a scan.

In my opinion the LCN descriptor should always be verified. I don't like in (0x82, 0x83). In SatScan this gets checked properly depending on the provider. https://github.com/Huevos/SatScanLcn/blob/master/SatScanLcn/src/satscanlcn.py#L618

Azureit commented 2 years ago

ABM deals with multiple lcn at same transponder, I know an example and it works.

Tell me which one so I can respond. Which provider?

Hispasat 30W, Meo provider use 0x82 and 0x83 LCN at same time. My guess is they use both, because depending on the box manufacturer/model, the software use one or the other.

The OK is from enigma manual scan. It has been there almost 10 years. It is there so the user can select which channel to view after a scan.

ABM is different, it does the scan without using the enigma manual scan, couldn't you do it too, loop all the frequencies.

Huevos commented 2 years ago

Are you sure you don't mean NOS? Meo scans fine using 0x83.

Azureit commented 2 years ago

Are you sure you don't mean NOS? Meo scans fine using 0x83.

NOS uses 0x82 only, but MEO uses 0x82 and 0x83. I tested disabling 0x83 at ABM and the MEO provider is LCN ordered using 0x82 My guess is MEO uses both because depending on the box manufacturer/model, the software uses 0x82 or 0x83. This is one of NIT table packet with MEO LCN:

SECT-Packet: 00000001   PID: 16 (0x0010), Length: 365 (0x016d)
Time received: Tue 2022-09-20  22:02:00.353
------------------------------------------------------------
  0000:  41 f1 6a 00 52 d3 04 04  f0 00 f1 5d 00 68 00 53   A.j.R......].h.S
  0010:  f1 3e 41 63 00 f6 0c 00  f7 0c 00 f8 0c 01 91 01   .>Ac............
  0020:  01 92 01 01 93 01 01 95  01 01 96 01 01 98 01 01   ................
  0030:  99 01 01 bd 0c 01 be 01  01 bf 01 01 c0 01 01 c2   ................
  0040:  01 05 79 01 05 7a 01 05  7b 01 05 7c 01 05 7d 01   ..y..z..{..|..}.
  0050:  05 7e 01 05 7f 01 05 80  01 05 84 01 05 85 01 05   .~..............
  0060:  86 01 05 87 02 05 88 02  05 89 02 05 8a 02 05 8b   ................
  0070:  02 05 8c 02 05 8d 02 43  0b 01 22 45 34 03 00 16   .......C.."E4...
  0080:  02 75 00 03 83 64 01 91  fc ad 01 92 fc 32 01 93   .u...d.......2..
  0090:  fc 2f 01 95 fc 33 01 96  fc 0d 01 98 fc e4 01 99   ./...3..........
  00a0:  fc 10 05 79 fc 15 05 7a  fc 16 05 7b fc 17 05 7c   ...y...z...{...|
  00b0:  fc 5f 05 7d fc 4a 05 7e  fc 46 05 7f fc 20 05 80   ._.}.J.~.F... ..
  00c0:  fc 1e 05 84 fc 49 05 85  fc 24 05 86 fc 21 05 87   .....I...$...!..
  00d0:  fd f8 05 88 fe 04 05 89  fe 07 05 8a fe 06 05 8b   ................
  00e0:  fe 05 05 8c fd fa 05 8d  fd f9 82 64 01 91 00 ad   ...........d....
  00f0:  01 92 00 32 01 93 00 2f  01 95 00 33 01 96 00 0d   ...2.../...3....
  0100:  01 98 00 e4 01 99 00 10  05 79 00 15 05 7a 00 16   .........y...z..
  0110:  05 7b 00 17 05 7c 00 5f  05 7d 00 4a 05 7e 00 46   .{...|._.}.J.~.F
  0120:  05 7f 00 20 05 80 00 1e  05 84 00 49 05 85 00 24   ... .......I...$
  0130:  05 86 00 21 05 87 01 f8  05 88 02 04 05 89 02 07   ...!............
  0140:  05 8a 02 06 05 8b 02 05  05 8c 01 fa 05 8d 01 f9   ................
  0150:  00 69 00 53 f0 13 41 00  43 0b 01 22 83 70 03 00   .i.S..A.C..".p..
  0160:  16 02 75 00 03 83 00 82  00 2c 76 23 85            ..u......,v#.

PID:  16 (0x0010)  [= assigned for: DVB Network Information Table (NIT), Stuffing Table (ST)]

Guess table from table id...
NIT-decoding....
Table_ID: 65 (0x41)  [= Network Information Table (NIT) - other network]
section_syntax_indicator: 1 (0x01)
reserved_1: 1 (0x01)
reserved_2: 3 (0x03)
Section_length: 362 (0x016a)
Network_ID: 82 (0x0052)  [= PT comunicações | 905 | Satellite | PT Comunicações]
reserved_3: 3 (0x03)
Version_number: 9 (0x09)
current_next_indicator: 1 (0x01)  [= valid now]
Section_number: 4 (0x04)
Last_Section_number: 4 (0x04)
reserved_4: 15 (0x0f)
Network_descriptor_length: 0 (0x0000)

reserved_5: 15 (0x0f)
Transport_stream_loop_length: 349 (0x015d)

    Transport_stream_ID: 104 (0x0068)
    Original_network_ID: 83 (0x0053)  [= PT Comunicações | PT Comunicações]
    reserved_1: 15 (0x0f)
    Transport_descriptor_length: 318 (0x013e)

            DVB-DescriptorTag: 65 (0x41)  [= service_list_descriptor]
            descriptor_length: 99 (0x63)
               service_ID: 246 (0x00f6)[ --> refers to PMT program_number]
               service_type: 12 (0x0c)  [= data broadcast service]

               service_ID: 247 (0x00f7)[ --> refers to PMT program_number]
               service_type: 12 (0x0c)  [= data broadcast service]

               service_ID: 248 (0x00f8)[ --> refers to PMT program_number]
               service_type: 12 (0x0c)  [= data broadcast service]

               service_ID: 401 (0x0191)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 402 (0x0192)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 403 (0x0193)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 405 (0x0195)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 406 (0x0196)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 408 (0x0198)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 409 (0x0199)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 445 (0x01bd)[ --> refers to PMT program_number]
               service_type: 12 (0x0c)  [= data broadcast service]

               service_ID: 446 (0x01be)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 447 (0x01bf)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 448 (0x01c0)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 450 (0x01c2)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 1401 (0x0579)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 1402 (0x057a)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 1403 (0x057b)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 1404 (0x057c)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 1405 (0x057d)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 1406 (0x057e)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 1407 (0x057f)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 1408 (0x0580)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 1412 (0x0584)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 1413 (0x0585)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 1414 (0x0586)[ --> refers to PMT program_number]
               service_type: 1 (0x01)  [= digital television service]

               service_ID: 1415 (0x0587)[ --> refers to PMT program_number]
               service_type: 2 (0x02)  [= digital radio sound service]

               service_ID: 1416 (0x0588)[ --> refers to PMT program_number]
               service_type: 2 (0x02)  [= digital radio sound service]

               service_ID: 1417 (0x0589)[ --> refers to PMT program_number]
               service_type: 2 (0x02)  [= digital radio sound service]

               service_ID: 1418 (0x058a)[ --> refers to PMT program_number]
               service_type: 2 (0x02)  [= digital radio sound service]

               service_ID: 1419 (0x058b)[ --> refers to PMT program_number]
               service_type: 2 (0x02)  [= digital radio sound service]

               service_ID: 1420 (0x058c)[ --> refers to PMT program_number]
               service_type: 2 (0x02)  [= digital radio sound service]

               service_ID: 1421 (0x058d)[ --> refers to PMT program_number]
               service_type: 2 (0x02)  [= digital radio sound service]

            DVB-DescriptorTag: 67 (0x43)  [= satellite_delivery_system_descriptor]
            descriptor_length: 11 (0x0b)
            Frequency: 19023156 (=  12.24534 GHz)
            Orbital_position: 768 (=  30.0)
            West_East_flag: 0 (0x00)  [= WEST]
            Polarisation: 0 (0x00)  [= linear - horizontal]
            Kind: 1 (0x01)  [= DVB-S2]
            Roll Off Faktor: 2 (0x02)  [= Alpha 0.20]
            Modulation_type: 2 (0x02)  [= 8PSK]
            Symbol_rate: 2576384 (=  27.5000)
            FEC_inner: 3 (0x03)  [= 3/4 conv. code rate]

            DVB-DescriptorTag: 131 (0x83)  [= User defined/ATSC reserved]
            descriptor_length: 100 (0x64)
            Descriptor-data:
                 0000:  01 91 fc ad 01 92 fc 32  01 93 fc 2f 01 95 fc 33   .......2.../...3
                 0010:  01 96 fc 0d 01 98 fc e4  01 99 fc 10 05 79 fc 15   .............y..
                 0020:  05 7a fc 16 05 7b fc 17  05 7c fc 5f 05 7d fc 4a   .z...{...|._.}.J
                 0030:  05 7e fc 46 05 7f fc 20  05 80 fc 1e 05 84 fc 49   .~.F... .......I
                 0040:  05 85 fc 24 05 86 fc 21  05 87 fd f8 05 88 fe 04   ...$...!........
                 0050:  05 89 fe 07 05 8a fe 06  05 8b fe 05 05 8c fd fa   ................
                 0060:  05 8d fd f9                                        ....

            DVB-DescriptorTag: 130 (0x82)  [= User defined/ATSC reserved]
            descriptor_length: 100 (0x64)
            Descriptor-data:
                 0000:  01 91 00 ad 01 92 00 32  01 93 00 2f 01 95 00 33   .......2.../...3
                 0010:  01 96 00 0d 01 98 00 e4  01 99 00 10 05 79 00 15   .............y..
                 0020:  05 7a 00 16 05 7b 00 17  05 7c 00 5f 05 7d 00 4a   .z...{...|._.}.J
                 0030:  05 7e 00 46 05 7f 00 20  05 80 00 1e 05 84 00 49   .~.F... .......I
                 0040:  05 85 00 24 05 86 00 21  05 87 01 f8 05 88 02 04   ...$...!........
                 0050:  05 89 02 07 05 8a 02 06  05 8b 02 05 05 8c 01 fa   ................
                 0060:  05 8d 01 f9                                        ....

    Transport_stream_ID: 105 (0x0069)
    Original_network_ID: 83 (0x0053)  [= PT Comunicações | PT Comunicações]
    reserved_1: 15 (0x0f)
    Transport_descriptor_length: 19 (0x0013)

            DVB-DescriptorTag: 65 (0x41)  [= service_list_descriptor]
            descriptor_length: 0 (0x00)

            DVB-DescriptorTag: 67 (0x43)  [= satellite_delivery_system_descriptor]
            descriptor_length: 11 (0x0b)
            Frequency: 19039088 (=  12.28370 GHz)
            Orbital_position: 768 (=  30.0)
            West_East_flag: 0 (0x00)  [= WEST]
            Polarisation: 0 (0x00)  [= linear - horizontal]
            Kind: 1 (0x01)  [= DVB-S2]
            Roll Off Faktor: 2 (0x02)  [= Alpha 0.20]
            Modulation_type: 2 (0x02)  [= 8PSK]
            Symbol_rate: 2576384 (=  27.5000)
            FEC_inner: 3 (0x03)  [= 3/4 conv. code rate]

            DVB-DescriptorTag: 131 (0x83)  [= User defined/ATSC reserved]
            descriptor_length: 0 (0x00)

            DVB-DescriptorTag: 130 (0x82)  [= User defined/ATSC reserved]
            descriptor_length: 0 (0x00)

CRC: 745939845 (0x2c762385)
Huevos commented 2 years ago

So the code you sent is taking LCN from 2 different descriptors at the same time. That is bad. As said above in (0x82, 0x83) is wrong code. The LCN for each provider should come from one descriptor only. That code will need changing.

Azureit commented 2 years ago

So the code you sent is taking LCN from 2 different descriptors at the same time. That is bad. As said above in (0x82, 0x83) is wrong code. The LCN for each provider should come from one descriptor only. That code will need changing.

Add a pull request for that. The code was working with in (0x82, 0x83) at most it would overwrite the same lcn for each descriptor.

Azureit commented 2 years ago

@Huevos Did you revise my code? I'm waiting so that all TDT frequencies work without customtransponder, because as is now only the customtransponder I know transport_stream_id is working. There should not exists in DVB-T, one frequency exclusively to inform the services of another (one) different frequency, that would be stupid! :)

Huevos commented 2 years ago

Which is why I said use TerrestrialScan plugin.

Huevos commented 2 years ago

Can you explain this better: "This solves the need of DVB-T customtransponder to overwrite the frequency, eliminating the need to know all transponders transport_stream_id."

No idea what that is supposed to mean. And why if it is only transponder count == 1?

If the nit frequency is wrong in the first transponder, how? If the frequency is wrong how am I able to tune it and read the tables? If it is wrong in the provider file why is this not changed?

How does this help find subsequent transponders that also show the wrong frequency in the NIT?

The main purpose of CustomTransponder was to fill in frequency details where they are missing from certain T2 multiplexes (UK). The alternative use for repeated came later.

Azureit commented 2 years ago

Let me try to explain this code:

EDIT: this code will interfere with CustomTransponder, I will try to fix that. EDIT2: It's fixed, this code will not interfere with CustomTransponder. This code doesn't interfere with CustomTransponder, they will still work the same way if they are needed at the UK, but I'm trying to fix just what I described above, like the title says Fix DVB-T frequency when 1 transponder found at the NIT table and that frequency is different from tune frequency.


If the nit frequency is wrong in the first transponder, how? If the frequency is wrong how am I able to tune it and read the tables? If it is wrong in the provider file why is this not changed?

The frequency is missing or wrong in the NIT table, not at the tune frequency. It's not "in the first transponder" found like you said, first it process all frequencies found at NIT for transponder in nit_content: and then after this loop ends, my code will check if it found only one frequency.


How does this help find subsequent transponders that also show the wrong frequency in the NIT?

This only applies when one frequency is found in NIT, there's no subsequent transponders, transponder count == 1.

Huevos commented 2 years ago

Is this problem in pt_tdt?

Does each area only ever have one active transponder with all channels on that one transponder.

And obviously the reason TerrestrialScan plugin works is because it always uses the tuned frequency, but that system is not possible for reading all frequencies from the home transponder.

Azureit commented 2 years ago

Is this problem in pt_tdt?

yes

Does each area only ever have one active transponder with all channels on that one transponder.

yes

And obviously the reason TerrestrialScan plugin works is because it always uses the tuned frequency,

And without this code, I have to make CustomTransponder to fix the frequency, but I will need all transport_stream_id and I don't have that info. With this code the frequency will be corrected.

but that system is not possible for reading all frequencies from the home transponder.

Didn't understand what you mean, but if more that one frequency is found at the NIT table the code don't touch any frequency.

Huevos commented 2 years ago

Home transponder means the details of all transponders come from just one transponder. If you read all from one transponder you can't make corrections to the other (not read) transponders, which is why CustomTransponder was needed. Even worse UK T2 does not have frequency in the NIT.

With TerrestrialScan it steps through every frequency so it is possible to use tuned frequency for all multiplexes.

Azureit commented 2 years ago

@Huevos Thanks for your patience, now I can remove the pt_tdt CustomTransponder I use to fix the frequency I have in my area, all the other frequencies never worked at pt_tdt until this fix, don't know why no one reported, I guess everyone use frequency scan, I personally like to click the start scan and all is scanned and as fast as possible, and turn on the schedule scan, that I suspect is not compatible with the frequency scan.

Huevos commented 2 years ago

The problem of how much work CustomTransponder is can be found in terrestrial_NL_bouquet 1/5. Makes you wonder if anyone uses this as no changes in 5 years.