Skip to content

Commit

Permalink
Fix group/channel filter bug. (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
huxuan authored May 20, 2021
1 parent 24aebee commit 162f357
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions iptvtools/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,30 +96,27 @@ def _parse(self, sources, is_template=False):
current_item = utils.unify_title_and_id(current_item)
current_id = current_item['id']

if not skip and current_item.get('params') and \
current_item['params'].get('group-title'):
group = current_item['params']['group-title']
if not skip and self.args.group_include:
if re.search(self.args.group_include, group):
logging.debug(f'Group to include: `{group}`.')
else:
skip = True
if not skip and self.args.group_exclude and \
re.search(self.args.group_exclude, group):
group = current_item.get('params', {}).get('group-title')
if not skip and self.args.group_include:
if re.search(self.args.group_include, group):
logging.debug(f'Group to include: `{group}`.')
else:
skip = True
logging.debug(f'Group to exclude: `{group}`.')

if not skip and current_item.get('title'):
title = current_item['title']
if not skip and self.args.channel_include:
if re.search(self.args.channel_include, title):
logging.debug(f'Channel to include: `{title}`.')
else:
skip = True
if not skip and self.args.channel_exclude and \
re.search(self.args.channel_exclude, title):
if not skip and self.args.group_exclude and \
re.search(self.args.group_exclude, group):
skip = True
logging.debug(f'Group to exclude: `{group}`.')

title = current_item.get('title')
if not skip and self.args.channel_include:
if re.search(self.args.channel_include, title):
logging.debug(f'Channel to include: `{title}`.')
else:
skip = True
logging.debug(f'Channel to exclude: `{title}`.')
if not skip and self.args.channel_exclude and \
re.search(self.args.channel_exclude, title):
skip = True
logging.debug(f'Channel to exclude: `{title}`.')

else:
if is_template:
Expand Down

0 comments on commit 162f357

Please sign in to comment.