Closed SanderM2 closed 1 week ago
hi @SanderM2 do you have a problem like here same group names
I do indeed have a provider that is using the same category name for VOD and Live TV. I want to filter Live TV and VOD differently and because if that I think it would be nice to have the option to filter based on the item type ( live tv / vod )
For example like this:
templates:
Other (related) question: I can add multiple sources to source.yml but I cannot have different filters per source?
Other (related) question: I can add multiple sources to source.yml but I cannot have different filters per source?
Ok i think tehere is a misunderstanding. in source.yml
you define templates
and sources
.
Templates are filter templates which you can reuse multiple times.
A source
can have multiple inputs
and multiple targets
. The filter are defined for a target and applied to the inputs to create a target.
Does this answer your question ?
Ok. Sorry, I misunderstood that part. That answers the question.
I was trying to get a selection of channels from source1 and a different selection of source2 into a single target while renaming all groups from source1 and source2 to prefix it with S1 or S2 depending from which source it came from
So, for examlple I want from source 1 groups A B C and from source 2 groups D E F. I want a single target that lists: (S1) A (S1) B (S1) C (S2) D (S2) E (S2) F
But maybe m3u-filter is not disigned for this then?
Ok. Sorry, I misunderstood that part. That answers the question.
I was trying to get a selection of channels from source1 and a different selection of source2 into a single target while renaming all groups from source1 and source2 to prefix it with S1 or S2 depending from which source it came from
So, for examlple I want from source 1 groups A B C and from source 2 groups D E F. I want a single target that lists: (S1) A (S1) B (S1) C (S2) D (S2) E (S2) F
But maybe m3u-filter is not disigned for this then?
This is currently not directly supported, however you could use the Url
filter.
The Filter condition looks like (Group|Title|Name|Url) ~ "regexp"
. This means you could set e filter on the Url.
If this does not satisy your needs:
You could add a feature request like : Filter by Source-Input
.
So, I can do it like this?
templates:
- name: IS_PROV1
value: 'Url ~ "https?:\/\/<some regex to match>"'
- name: PROV1_FILTER
value: >-
!IS_PROV1! AND <some channel filter regex>
- name: IS_PROV2
value: 'Url ~ "https?:\/\/<some regex to match>"'
- name: PROV2_FILTER
value: >-
!IS_PROV2! AND <some channel filter regex>
sources:
- inputs:
- name: prov1
type: xtream
.... rest of xtream config
- name: prov2
type: xtream
.... rest of xtream config
targets:
- name: prov1_target
filename: playlist_prov1
output:
- type: xtream
filter: '!PROV1_FILTER!'
rename:
- { field: group, new_name: (S1) $1, pattern: ^(.*) }
options: { ignore_logo: true, xtream_skip_live_direct_source: true, xtream_skip_video_direct_source: true, xtream_skip_series_direct_source: true}
sort:
groups:
order: asc
- name: prov2_target
filename: playlist_prov2
output:
- type: xtream
filter: '!PROV2_FILTER!'
rename:
- { field: group, new_name: (S2) $1, pattern: ^(.*) }
options: { ignore_logo: true, xtream_skip_live_direct_source: true, xtream_skip_video_direct_source: true, xtream_skip_series_direct_source: true}
sort:
groups:
order: asc
But I cannot get them combined in a single target? Actually, I can combine them but the rename feature cat't work for different sources?
First of all if you use IS_PROV1
or IS_PROV2
only one time you do not need it as template.
Second: the regexp 'Url ~ "https?://"' does not filter anything. it should look like Url ~ "^https?://my\-provider1\.com.*"
I changed the example in previous post. I did add 'some regex to match' to the url example but it was not showing in github. I changed the example code inside code brackets for github now.
So I think the above will work but am I right that I cannot combine it in a single target?
Yes you can combine to a single target, or multiple targets. You have multiple inputs and multiple targets.
You should use the mapping functionality, it provides much more control over renaming.
The rename
functionality in source.yml
is for very simple renamings.
Btw the mapping allows you to append suffix and prefix.
I have been reading the about the mapping but didn't quite understand how to do it. Any chance you can create a short example adding to the example I have above?
Not really. Can't find any example on how to rename groups using the mapping feature. I't yet unclear to me how to use it so will probably have to check back later when I have more time. I was hoping a small example could help me getting started
Ok then provide me example names of groups and tell me under which criteria what you expect as result.
I have this in my source.yml now:
templates:
- name: IS_PROVIDER1
value: 'Url ~ "https?:\/\/<..removed..>"'
- name: PROVIDER1
value: >-
!IS_PROVIDER1! AND NOT(Group ~ "(?i)^(HORSE RACING|WORLD CRICKET|RADIO)$" OR Group ~ "(?i)^(AF|AFG|AL||ANT|AR|ASIA|AT|AZE|BA|BG|BR|CAR|CH|CU|CY|CZ|DE|DK|DOMR|EXYU|FI|FR|GR|HAT|HR|HU|IE|IL|IR|IT|KURD|LAT|ME|MK|NO|NZ|PL|PT|RO|RS|RU|SE|SI|SOM|SU|TR|UKR|ARM) ")
- name: IS_PROVIDER2
value: 'Url ~ "https?:\/\/<..removed..>"'
- name: PROVIDER2
value: >-
! IS_PROVIDER2! AND NOT(Group ~ "(?i)^(HORSE RACING|BT SPORT|AR)" OR Group ~ "(?i)^(AU|AR|BR|DE|DK|EX-YU|FR|GR|IN|IT|NO|PT|RUS|SCAN|SO|SR|SW|TR|AF|ABC|AL|AM|ASIA|AZ|BY|CAR|CH|CY|CZ|EE|FI|FJ|GE|HU|IE|INT|IR|ISL|KR|KU|KZ|LA|LU|LV|MT|MX|NZ|PL|RO|RU|SE|SU|UA|WS|XX|LT|BG|FR) ?(\||I|l|$)")
sources:
- inputs:
- name: prov1
...
- name: prov2
...
targets:
- name: prov1_filtered
filename: playlist_prov1
output:
- type: xtream
filter: '!PROVIDER1!'
rename:
- { field: group, new_name: (S1) $1, pattern: ^(.*) }
options: { ignore_logo: true, xtream_skip_live_direct_source: true, xtream_skip_video_direct_source: true, xtream_skip_series_direct_source: true}
sort:
groups:
order: asc
- name: prov2_filtered
filename: playlist_prov2
output:
- type: xtream
filter: '!PROVIDER2!'
rename:
- { field: group, new_name: (S2) $1, pattern: ^(.*) }
options: { ignore_logo: true, xtream_skip_live_direct_source: true, xtream_skip_video_direct_source: true, xtream_skip_series_direct_source: true}
sort:
groups:
order: asc
I can use prov1_filtered or prov2_filtered target in api-proxy.yml and it will list the channel groups like I want ( prepending S1 or S2 in front of it).
I wanted to combine this in a single target so that my client can see all categories prefixed with S1 and S2
Ok first: the filter Group ~ "(?i)^(AF|AFG|AL||ANT|AR|ASIA|AT|AZE|BA.....
only mathches when the group really has only the name like 'AF', 'AFG' .... and nothing more.
What you want to do is adding prefix for the different sources.
This is done with mapping like this:
mapping.yml
mappings:
templates:
- name: IS_PROVIDER1
value: 'Url ~ "https?:\/\/<..removed..>"'
- name: PROVIDER1
value: >-
!IS_PROVIDER1! AND NOT(Group ~ "(?i)^(HORSE RACING|WORLD CRICKET|RADIO)$" OR Group ~ "(?i)^(AF|AFG|AL||ANT|AR|ASIA|AT|AZE|BA|BG|BR|CAR|CH|CU|CY|CZ|DE|DK|DOMR|EXYU|FI|FR|GR|HAT|HR|HU|IE|IL|IR|IT|KURD|LAT|ME|MK|NO|NZ|PL|PT|RO|RS|RU|SE|SI|SOM|SU|TR|UKR|ARM) ")
- name: IS_PROVIDER2
value: 'Url ~ "https?:\/\/<..removed..>"'
- name: PROVIDER2
value: >-
! IS_PROVIDER2! AND NOT(Group ~ "(?i)^(HORSE RACING|BT SPORT|AR)" OR Group ~ "(?i)^(AU|AR|BR|DE|DK|EX-YU|FR|GR|IN|IT|NO|PT|RUS|SCAN|SO|SR|SW|TR|AF|ABC|AL|AM|ASIA|AZ|BY|CAR|CH|CY|CZ|EE|FI|FJ|GE|HU|IE|INT|IR|ISL|KR|KU|KZ|LA|LU|LV|MT|MX|NZ|PL|RO|RU|SE|SU|UA|WS|XX|LT|BG|FR) ?(\||I|l|$)")
mapping:
- id: source-prefix
match_as_ascii: true
mapper:
- filter: "!PROVIDER1!"
pattern: ".*"
prefix: (S1)
- filter: "!PROVIDER2!"
pattern: ".*"
prefix: (S2)
and your source.yml
should look like
... the filter template section from above...
sources:
- inputs:
- name: prov1
...
- name: prov2
...
targets:
- name:
filename: playlist_prov1_and_2
output:
- type: xtream
mapping:
- source-prefix
filter: '!PROVIDER1! OR !PROVIDER2!'
options: { ignore_logo: true, xtream_skip_live_direct_source: true, xtream_skip_video_direct_source: true, xtream_skip_series_direct_source: true}
sort:
groups:
order: asc
I could not test it, maybe there are some errors, but this is how it shold work.
I think in the mapping.yml
you only need the !IS_PROVIDER1!
and the !IS_PROVIDER2!
part of the filter, because the other countries are filtered out with the target filter. I think it is uneccasary to define them in the mapping filter ( mean the NOT ... AM|... part).
I am still trying to make it work. For some reason I do always see this warning when launching:
[2024-08-26T14:57:52Z WARN m3u_filter::utils::config_reader] cant read mapping file: mapping.yml
But the mapping.yml file is in the current working dir and even specifying it with the -m parameter doesn't help. Permissions are good to.
So maybe I have syntax error? But then it shouldn't tell me it can't read the file ...
As soon as I add a mapper entry as show in your example it's failing to load:
mapper:
- filter: "!PROVIDER1!"
pattern: ".*"
prefix: (S1)
Not throwing any errors except the cant read mapping.yml so I'm stuck here
I got it to work. The example had some errors.
Now the last thing I need to figure out is how to get EPG working. Is m3u-filter supposed to fetch epg data from xtream sources without specifically specifying any xmltv.php link in the source configuration?
xtream source should be able to figure the xmltv.php link out on it's own, right?
epg is only fetched when you provide an epg url. Why ? The epg is processed and filtered based on the target output.
Aha, that makes sense. Ok. I got it working now. Thank you very much mate!
i have added a new filter Type = live|vod|series
You can use it like Group ~ "^FR.*" AND Type = vod
I have tested this and can confirm it’s working fine!
Right now we cannot filter based on the type, can we? I want to filter groups for live tv and groups for vod differently.
Can this be done already, if so, how?
If not, this is a feature request.