Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom sorting #12

Open
FrancYescO opened this issue May 19, 2021 · 12 comments
Open

custom sorting #12

FrancYescO opened this issue May 19, 2021 · 12 comments

Comments

@FrancYescO
Copy link
Contributor

FrancYescO commented May 19, 2021

would be nice to have a way to set a custom order for some channels... i.e.
this is the starting list (assume this is the channel name, i stripped all other m3u values...)

PIPPO 2
ZAZZA 3
PIPPO 1
LALALA 3
ZAZZA 1
LALALA
LILLOZAZZA 1

Setting the flags like -R -s [['^ZAZZA','^LALALA$'], 'tvg-id', 'title', 'height']

Will generate this list:

ZAZZA 1 [720p]
ZAZZA 3 [1080p]
LALALA [1080p]
PIPPO 1 [1080p]
PIPPO 2 [1080p]
LALALA 3 [720p]
LILLOZAZZA 1 [720p]
@huxuan
Copy link
Owner

huxuan commented May 20, 2021

This seems to be quite an odd feature for me. Any specific reason to achieve this?

@FrancYescO
Copy link
Contributor Author

FrancYescO commented May 20, 2021

That's because i manage a list that is in a pretty confused order (or at least in an order that i don't like) or it get confused after being sorted by tvg-id or height, so i need a better and more specific sorting priority list..

like the example above, i just want that all channels named ZAZZA (1,2,3) are one next to the other and not mixed with PIPPO, and i want to put these before LALALA just because i like these more than LALALA so i want these to be on top of my list

@huxuan
Copy link
Owner

huxuan commented May 20, 2021

I would expect it should be something like title buckets. Different channels belong to different buckets according to the title. It would be more reasonable to have a specific order for buckets. What do you think of?

@FrancYescO
Copy link
Contributor Author

Yep this should be okay at least for grouping these that getting mixed, but the real thing that i want to take care is their sorting order, that basically is "something i like in this way".
there are few channels (or buckets), call these favourites, that i want on top of my list and in a specific order, than all the other (filtered channels) will follow the 'tvg-id' / 'title' / 'height' sorting

@huxuan
Copy link
Owner

huxuan commented May 21, 2021

Yep, that is almost what I mean. I would prefer to have a new concept bucket so that we can sort by the bucket id. In this way, what we need to do are:

  1. Specify the rules and orders of the buckets.
  2. Specify the bucket alongside others (tvg-id, title, height) as sort keys.

Any opinions?

@FrancYescO
Copy link
Contributor Author

FrancYescO commented May 21, 2021

looks good, i still have unclear how do you want to "generate" a new bucket (in my example i've just keeped simple using an array in array of regex of the -s flag that will generate what you call bucket and give them an order), but if these bucket can be custom ordered (so will not follow the alphabetical order) is what i was searching for

in my specific case i have just 1 bucket (4 channels starting with same prefix) and ~6 different named channels as favourites, but its not a problem if i need to create a bucket for each one of this channel to have it callable in the sorting flag

@huxuan
Copy link
Owner

huxuan commented May 21, 2021

OK, let me try some further explanation. There will be a new argument for buckets. For example, --buckets '^ZAZZA' '^LALALA$' will generate two buckets. The bucket id for ^ZAZZA is 0 and 1 for ^LALALA$. In this way, we can utilize the current sort keys to sort by the bucket id.

An example of the arguments would be

--buckets '^ZAZZA' '^LALALA$' --sort-keys bucket tvg-id title height

@FrancYescO
Copy link
Contributor Author

oh ok, so basically it will keep ordering by the newly created bucket id (probably not referenced/keeped in the final m3u), yep this allow me to go straight to the objective :)

@FrancYescO
Copy link
Contributor Author

any news on this?

@huxuan
Copy link
Owner

huxuan commented Jul 27, 2021

Sorry, I was too busy these days to make any commitment.

@FrancYescO
Copy link
Contributor Author

any guidance to get this implemented?

@huxuan
Copy link
Owner

huxuan commented Feb 21, 2022

Thanks for the interests! Just some points in a rush, just let me know if there is anything unclear.

  1. Leverage nargs with a * for argument bucket, so they are ordered naturally.
  2. Mark the entry with corresponding bucket index as something like bucket id when the title matches the regular expression of the bucket. (defaults to maximum)
  3. Sort by bucket id directly.

Will this make it clear?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants