Skip to content

feat: auto-merge channels on custom playlists - #1275

Open
tjelite1986 wants to merge 1 commit into
m3ue:devfrom
tjelite1986:feat/custom-playlist-channel-merge
Open

feat: auto-merge channels on custom playlists#1275
tjelite1986 wants to merge 1 commit into
m3ue:devfrom
tjelite1986:feat/custom-playlist-channel-merge

Conversation

@tjelite1986

Copy link
Copy Markdown
Contributor

Summary

Implements #1103: custom playlists get the same auto-merge capability as regular playlists, with merge candidates restricted to the channels attached to the custom playlist — optionally narrowed further to selected custom playlist groups. This directly addresses the issue's pain point: merging two overlapping providers only where they coexist in the curated custom playlist ("merged on a group basis"), instead of merging one playlist wholesale into the other.

How it works

  • New Auto-Merge Channels section in the custom playlist's Processing tab: enable toggle, custom-group scope, preferred playlist, ordered source-playlist priority, regex patterns, merge key (stream ID / TMDB ID), and the resolution / catchup / force-re-merge / deactivate-failover toggles.
  • MergeChannels gains optional customPlaylistId / customGroupNames scoping, applied to all three candidate queries (stream-id pass, name-fallback pass, regex pass). Group scoping uses the custom playlist's tag groups (same mechanism as the existing Processing Configs). Custom-context merges never fall back to the primary source playlist's own regex_patterns config.
  • SyncListener::getCustomPlaylistMergeJob() mirrors getMergeJob(): master priority comes from the configured playlist order, falling back to the distinct source playlists of the custom playlist's channels; buildWeightedConfig and the name-fallback config builder are reused as-is.
  • Trigger: after each custom playlist auto-sync, the merge job is chained before the existing processing rules so sort/recount see the post-merge lineup. AutoSyncGroupsToCustomPlaylist now fires SyncCompleted when auto-merge is enabled (previously only when processing rules existed).

Advanced priority scoring (group priorities / priority attributes / keywords) still works through the shared buildWeightedConfig, but I intentionally left that fieldset out of the custom playlist UI for now to keep the form focused — easy to add if wanted.

Test plan

  • New tests/Feature/CustomPlaylistChannelMergeTest.php (6 tests): scope isolation (duplicates outside the custom playlist untouched), custom-group filtering, master selection by configured playlist order, playlist derivation when unconfigured, null-job guards, and the merge→processing chain on sync completion.
  • Regression: MergeChannelOrdering|MergeDisabledGroups|RegexMerge|AliasFallbackMerge|AddGroupsToCustomPlaylist|AutoSyncGroupsToCustomPlaylist|ChannelCustomGroup|SyncListener|CustomPlaylistProviderProfile|CustomPlaylistSortOrder115 passed (235 assertions).
  • vendor/bin/pint --dirty clean.

Closes #1103

🤖 Generated with Claude Code

Adds the playlist auto-merge capability to custom playlists (issue
m3ue#1103), restricted to the channels actually attached to the custom
playlist so overlapping providers can be merged only where they coexist
in the curated lineup — optionally filtered to selected custom groups.

- MergeChannels gains optional customPlaylistId/customGroupNames scoping
  applied to all three candidate queries (stream-id, name-fallback,
  regex); custom-context merges never fall back to the source playlist's
  regex config
- SyncListener::getCustomPlaylistMergeJob builds the job from the new
  auto_merge_config on custom playlists, deriving the master-priority
  playlist order from the config or from the custom playlist's source
  playlists
- Merge is chained before the existing processing rules (sort/recount)
  after each custom playlist auto-sync; AutoSyncGroupsToCustomPlaylist
  now fires SyncCompleted when auto-merge is enabled
- New Auto-Merge Channels section in the custom playlist Processing tab
  (group scope, preferred playlist, source priority, regex patterns,
  merge key, resolution/catchup/re-merge/deactivate toggles)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

1 participant