Add per-alias custom live group sort order#1143
Merged
Merged
Conversation
Adds an optional "Sort groups in custom order" toggle to playlist aliases (default off). When enabled, a drag-to-reorder pane below the live group selection lets you set the order the selected live groups are delivered to the client, instead of inheriting the source playlist's group order. - PlaylistAlias: hasCustomLiveGroupSort()/getLiveGroupSortOrder(), backed by new group_filter keys (sort_live_groups_custom, live_group_order) — no migration - getChannelQuery(): ranks live groups by the alias order via a CASE on channels.group_internal, falling back to groups.sort_order for VOD and unlisted groups; applies consistently to M3U, EPG and Xtream output - SourceGroupsTable + alias group selects now display the imported group's custom name when one exists, falling back to the source name
The custom search closure on the source-group selector used `LIKE`, which is case-sensitive on PostgreSQL, so terms that didn't match the stored casing returned nothing (e.g. "enter" missed "Entertainment", "doc" missed "Documentaries"). SQLite/MySQL hid this because their LIKE is case-insensitive. Revert search and sort to Filament's default on the real source_groups.name column (case-insensitive across databases) and resolve the imported group's custom name via a correlated subquery for display only — instead of a join, which also made the `name` column ambiguous. Adds a Postgres-shaped regression test driving the table through a Livewire harness.
Group search now also matches the displayed (custom) name, not just the source name, so a group renamed away from its source — e.g. source "GENERAL hevc" shown as "Entertainment" — is found when searching either term. Implemented with an EXISTS subquery against the imported group, using LOWER(...) on both sides to stay case-insensitive on PostgreSQL.
Address Copilot review on m3ue#1143. Both the selector's custom-name search subquery and the live-group sort pane's label lookup matched groups by name_internal + playlist alone, so a group of a different type sharing the same name_internal could leak into search results or supply the wrong label. - SourceGroupsTable: tie the custom-name EXISTS subquery to source_groups.type - buildLiveGroupSortItems: constrain the label lookup to live groups Add regression tests for both cross-type cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional per-alias custom sort order for live groups, plus a couple of related improvements to the group selector.
Today a playlist alias delivers its live groups to the client in the source playlist's order. This PR adds a "Sort groups in custom order" toggle (off by default) on the alias form. When it's on, a drag-to-reorder pane appears beneath the live group selection so you can set the exact order the selected groups are delivered in.
What's included
group_filterJSON, so there's no migration. When enabled,getChannelQuery()ranks live groups by the saved order and falls back to the playlist's ownsort_orderfor VOD and any groups not in the list, so the order is consistent across the M3U, EPG and Xtream output.LOWER(...)so it behaves correctly on PostgreSQL, whoseLIKEis case-sensitive.Scope is intentionally limited to live groups for now; VOD groups and series categories keep inheriting the source order.
Note / possible follow-up
The selector lists source groups (the provider groups created at import). Custom, user-created groups live in the
groupstable and aren't listed here, so they can't currently be selected or sorted per-alias — this matches existing behaviour. Happy to add them to the selector as a follow-up if that'd be useful.Test plan
playlist.m3ulists the groups in that order.