Regarding your friend's box:
First screen shows that E2 thinks there is only one stream of MPEG format. In reality in PMT are audio 2 streams (0x17d6 and 0x17da) of HE-AAC format.
Second screen shows that E2 receives audio PID 0x17da. I don't know why E2 selected this stream (and not 0x17d6), because on 0x17da there is no sound broadcasted...
Maybe it's something wrong with PID caching... you could try edit lamedb... maybe to keep just "p:BBC" with no additional PIDs....
OK, let me reply regarding my friend's situation on IPBOX.
When he removes PIDs from lamedb, there is no sound or picture even if your script is running.
The PIDs shown in Service Information screen are actually those that he put in lamedb himself. No matter if he puts 0x17da or 0x17d6, there is no sound on HD channels.
Mind you, he also gets 2 timeouts in your script's log, but both sound and picture appear on SD channels.
Also, "timeout reading PMT" appears on his TV screen despite the fact that there is actually picture (and also sound on SD channels).
wget: bad address 'localhost'
currentSid: 0x
currentSid: 0x4484
trying with demux /dev/dvb/adapter0/demux0
pmtPid: 0x19c8
Error(110): read (PID 0x19c8): Connection timed out
0x9f 0x80 0x32 0x1e 0x03 0x44 0x84 0x09 0x00 0x13 0x01 0x81 0x08 0x0c 0xfd 0xac 0xe7
0x10 0x00 0x00 0x01 0x82 0x02 0x01 0x00 0x84 0x02 0x19 0xc8 0x0d 0x19 0xc8 0x00 0x00
Error(110): read (PID 0x19c8): Connection timed out
It seems that there are some differences between images and, possibly, boxes, which prevent your script for being universal for all.
For the time being it seems that it does its job only on DMM images (7020, 800se).