Bug Fix: Fixes a bug with auto channel sync where channel numbers could be duplicated if multiple groups overlapped.

This commit is contained in:
SergeantPanda 2026-02-13 15:07:24 -06:00
parent 2c9f6d7360
commit fb2f156fd8

View file

@ -1648,6 +1648,13 @@ def sync_auto_channels(account_id, scan_start_time=None):
channels_updated = 0
channels_deleted = 0
# Get all channel numbers that are already in use by other channels (not auto-created by this account)
used_numbers = set(
Channel.objects.exclude(
auto_created=True, auto_created_by=account
).values_list("channel_number", flat=True)
)
for group_relation in auto_sync_groups:
channel_group = group_relation.channel_group
start_number = group_relation.auto_sync_channel_start or 1.0
@ -1841,13 +1848,6 @@ def sync_auto_channels(account_id, scan_start_time=None):
channels_to_renumber = []
temp_channel_number = start_number
# Get all channel numbers that are already in use by other channels (not auto-created by this account)
used_numbers = set(
Channel.objects.exclude(
auto_created=True, auto_created_by=account
).values_list("channel_number", flat=True)
)
for stream in current_streams:
if stream.id in existing_channel_map:
channel = existing_channel_map[stream.id]