I would like to confirm what I believe to be a bug in the code that is manifesting in the ServiceName2.py converter.
In line 314 of ServiceName2.py there is a format option "%b" that is meant to return the DVB-T bandwidth:
Code: Select all
elif f == 'b': # %b - bandwidth (dvb-t)
if type == 'DVB-T':
x = self.tpdata.get('bandwidth', 1)
result += x in range(4) and {0:'8 MHz',1:'7 MHz',2:'6 MHz',3:'Auto'}[x] or ''
The problem is that somewhere along the line the data returned is no longer an index but rather the actual bandwidth in Hz. The self.tpdata.get('bandwidth', 1) call expects to see a value of "1" for 7 MHz bandwidth but instead gets "7000000". The lookup obviously fails so an empty string is returned.
I have coded a small patch to work around the issue in ServiceName2.py:
Code: Select all
elif f == 'b': # %b - bandwidth (dvb-t)
if type == 'DVB-T':
x = self.tpdata.get('bandwidth', 1)
if x < 100:
result += x in range(4) and {0:'8 MHz',1:'7 MHz',2:'6 MHz',3:'Auto'}[x] or ''
else:
bands = {1712000: "1.712 MHz", 5000000: "5 MHz", 6000000: "6 MHz", 7000000: "7 MHz", 8000000: "8 MHz", 10000000: "10 MHz"}
result += bands.get(x, "Auto")
My concern is that if this code is expecting data in one format and it arrives in another format then how often is this problem happening elsewhere in the code?
Should this hack be used to fix the problem here, is a similar hack needed elsewhere or should the underlying issue be addressed? I believe it will be in all our interests if the issue is investigated by those with a better understanding and grip on this type of code and the adjustments and/or corrections be applied across the code base. This is an issue that I am unable to investigate.
If it is decided to return the data to an index into a bandwidth table then the original list of options will need to be expanded to encompass all the current bandwidth options (see my patch "bands" dictionary).
Can someone please weigh in on this problem and suggest how it can/should be addressed.
Regards,
Ian.