lg_netcast platform fails to load if no channels defined (#4083)

* fixes loading of lg_netcast platform if no channels are defined

* turned list comprehension into for loop
This commit is contained in:
wokar 2016-10-30 01:52:53 +02:00 committed by Paulus Schoutsen
parent 3317b4916b
commit 3f6a5564ad

View File

@ -103,8 +103,11 @@ class LgTVDevice(MediaPlayerDevice):
channel_list = client.query_data('channel_list') channel_list = client.query_data('channel_list')
if channel_list: if channel_list:
channel_names = [str(c.find('chname').text) for channel_names = []
c in channel_list] for channel in channel_list:
channel_name = channel.find('chname')
if channel_name is not None:
channel_names.append(str(channel_name.text))
self._sources = dict(zip(channel_names, channel_list)) self._sources = dict(zip(channel_names, channel_list))
# sort source names by the major channel number # sort source names by the major channel number
source_tuples = [(k, self._sources[k].find('major').text) source_tuples = [(k, self._sources[k].find('major').text)