hoshsadiq / m3ufilter

ABANDONED - A tool that allows to filter specific items from an m3u filter designed for IPTV.
GNU General Public License v2.0
48 stars 18 forks source link

Enhancement: CSV Based Filter #14

Open ramarnat opened 4 years ago

ramarnat commented 4 years ago

I would like to suggest a way to specify an input csv file to batch filter/set individual streams:

core:
  server_listen: localhost:8080
  update_schedule: "*/24 * * * *"
  output: m3u
  group_order:
    - Entertainment
    - Family/Kids
    - News
    - Drama
providers:
  - uri: file:///path/to/m3u/playlist.m3u
    csv_filter: file:///path/to/m3u/filter.csv
    csv_setter:
        - Id: tvg_id_csv_col
        csv_filter_field: CUID_csv_col

what do you think @hoshsadiq ?

hoshsadiq commented 4 years ago

If your aim is to make avoid writing conditionals, I'm not sure I see a reason to use CSV over a more simple YAML based filtering mechanism. I'm curious what the use case is. Also, what would the CSV look like?

ramarnat commented 4 years ago

Here is my (albeit) personal workflow:

  1. Use m3ufilter to generate a csv starting point (all streams)
  2. Clean up the big items (Titles, remove low bw etc.) using the global filters
  3. Regenerate the csv
  4. use the csv map the channels that I have access to clean epg data (schedules direct), in the csv - basically a whitelist
  5. (this proposal) Use the whitelist csv to generate the streams via m3ufilter. CSV, because its just easier to maintain, and has the feedback loop with the csv output of m3ufilter.
  6. I'd also want to continue to publish channels that are not in the whitelist using the global filters
  7. The csv is also useful to filter the source epg list.
  8. This filtered m3u and epg then goes into my xteve proxy server
ramarnat commented 4 years ago

To answer the specific question, I was thinking the csv would have a column for the CUID (column specified in the yaml example as csv_filter_field) to identify the stream, and then columns that would override the value that is coming from the stream. In the above example yaml above, you would specify what the mapping is. Any field not mapped, would use the original value.

ramarnat commented 4 years ago

btw, not proposing for you to build this, I was going to do it for my workflow, but if you have suggestions on how it could be done so it can be accepted as a PR (while still working for my workflow) was the purpose of opening the issue.

hoshsadiq commented 4 years ago

Seems like an interesting workflow. Would potentially make the yaml config much simpler. Feel free to raise a PR and I'd be happy to review and accept.

ramarnat commented 4 years ago

I'll take a crack at it, and post the PR

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

hoshsadiq commented 3 years ago

An initial implementation for CSV usage is done in #36, to be merged into master soon. Test it out and let me know!