Skip to content

Commit 2e672ae

Browse files
committed
example: epg + lcn
example of navigation across channels via epg numbers
1 parent 0a9c9a8 commit 2e672ae

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

usr/lib/hypnotix/hypnotix.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,8 +1524,21 @@ def activate_hchannel(chan):
15241524
elif event.keyval == Gdk.KEY_Return:
15251525
if channel_focused:
15261526
try:
1527-
chan = [c for c in self.hchannels if c.channel.lcn == str(self.chan_lcn_buf)][0]
1528-
activate_hchannel(chan)
1527+
chan = [c for c in self.hchannels if c.channel.lcn == str(self.chan_lcn_buf)]
1528+
1529+
"""
1530+
1531+
If this branch will be merged with "epg", it's very easy to jump across channels using
1532+
their EPG numbers (without needing a lcn tag) just by adding the lines here below:
1533+
1534+
1535+
if (len(chan) == 0 and self.epg is not None):
1536+
epg_channel = [p.attrib["id"] for p in self.epg.findall("channel") if p.attrib["id"].split()[-1] == str(self.chan_lcn_buf)][0]
1537+
chan = [c for c in self.hchannels if chan_match(c.channel.name, epg_channel)]
1538+
1539+
"""
1540+
1541+
activate_hchannel(chan[0])
15291542
finally:
15301543
self.chan_lcn_buf = 0
15311544
return True

0 commit comments

Comments
 (0)