Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Fazzani committed Dec 15, 2024
1 parent 88a561a commit 9e0851b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 51 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"black-formatter.args": ["--line-length", "150"],
"cSpell.words": [
"figlet",
"pliptv",
"strm"
]
}
75 changes: 31 additions & 44 deletions data/config_playlist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,58 +80,45 @@ piconfilter:
epgfilter:
enabled: false
priority: 20
index_url: https://raw.githubusercontent.com/Fazzani/grab/master/out/check_channels.json
index_url: https://raw.githubusercontent.com/Fazzani/grab/master/out/epg.csv
matching_groups:
-
names:
- "beIN VIP"
- "BeIN SPORTS"
- "beIN Media"
sources:
- "http://www.bein.net"
- BeinSports
- BeinSports__ar
- BeinSports__qa
country:
- qa
-
names:
- "TUNISIA TV"
sources:
- "http://www.watania.tn"
- Tunisia
- Tunisia__tn
- Tunisia__ar
country:
- tn
-
names:
- "OSN VIP"
- "Premium OSN"
sources:
- "http://www.osn.com"
- Osn
- Mbc
- Rotana
country:
- ar
- ae
- sa
- eg
- iq
- lb
- ma
- dz
-
names:
- "ARAB TV"
- "FHD ARAB"
- "Kids AR"
- "AR News"
- MBC
- "MBC VIP"
- "AR HEVC"
- MyHD
- PEHLA
- "Islamic AR"
- "AR Egypt"
sources:
- "http://www.elcinema.en.com"
- "http://www.elcinema.com"
-
names:
- "Chaîne Généraliste FR"
- "Sport FR"
- SFR-RMC
- Music
- "Musique FR"
- "Cinéma FR"
- "Séries & Divertissement FR"
- "FRANCE CH"
- "Découverte FR"
- "Jeunesse FR"
- "FRANCE CH (HEVC)"
sources:
- "http://www.canalsat.fr"
- "http://www.telerama.fr"
- "http://www.tv.orange.fr"
- France
- France__fr
- BeinSports__fr
country:
- fr
- ca
- ch
- be
matching_ratio: 0.6
name: playlist
8 changes: 3 additions & 5 deletions pliptv/pl_filters/epg_filter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from difflib import SequenceMatcher
from functools import lru_cache, reduce
from typing import Any, List, Optional
from typing import List, Optional

from pliptv.config_loader import PlaylistConfig
from pliptv.epg_service import get_epg_index
Expand All @@ -11,10 +11,6 @@
from pliptv.utils.log.decorators import func_logger


def _get_config(config, group: str) -> List[Any]:
return list(filter(lambda e: group in e["names"], config.epg.matching_groups))


class EpgFilter(FilterABC, metaclass=LoggingFilterAbcMixin):
def __init__(self, config: PlaylistConfig):
super().__init__(config=config)
Expand All @@ -30,6 +26,8 @@ def apply(self, value: Stream) -> Stream:
Returns:
Stream meta data
"""
# TODO: load data from csv file (epg.csv)
# and match stream name with country
epg: Epg = get_epg_index(self.filter_config.index_url)
if not epg:
raise AssertionError
Expand Down
6 changes: 4 additions & 2 deletions pliptv/pl_filters/grouping_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ def apply(self, value: Stream) -> Stream:
for group, regex in self.filter_config.map.__dict__.items():
match = re.search(regex, value.meta.tvg.group_title, re.IGNORECASE)
if match:
LOG.debug(f"Moving {value.meta.display_name} from {value.meta.tvg.group_title} to group {group}")
value.meta.tvg.group_title = group
group_value: str = f"{group}__{value.meta.country}" if value.meta.country else f"{group}__{value.meta.culture}"
LOG.debug(f"Moving {value.meta.display_name} from {value.meta.tvg.group_title} to group {group_value}")

value.meta.tvg.group_title = group_value
value.meta.hidden = False
break

Expand Down

0 comments on commit 9e0851b

Please sign in to comment.