Skip to content

Commit e442712

Browse files
committed
fix: Non-unique groups causing insert error, preventing Playlist sync
1 parent 87eebb9 commit e442712

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

app/Jobs/ProcessM3uImport.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,12 @@ private function processXtreamChannelCollections(
10751075

10761076
// Create the source groups
10771077
foreach ($liveGroups->chunk(50) as $chunk) {
1078+
// Deduplicate the channels
1079+
$chunk = collect($chunk)
1080+
->unique(fn ($item) => $item['category_name'].$playlistId.'live')
1081+
->toArray();
1082+
1083+
// Upsert the source groups
10781084
SourceGroup::upsert(
10791085
collect($chunk)->map(function ($group) use ($playlistId) {
10801086
return [
@@ -1089,6 +1095,12 @@ private function processXtreamChannelCollections(
10891095
);
10901096
}
10911097
foreach ($vodGroups->chunk(50) as $chunk) {
1098+
// Deduplicate the channels
1099+
$chunk = collect($chunk)
1100+
->unique(fn ($item) => $item['category_name'].$playlistId.'vod')
1101+
->toArray();
1102+
1103+
// Upsert the source groups
10921104
SourceGroup::upsert(
10931105
collect($chunk)->map(function ($group) use ($playlistId) {
10941106
return [

0 commit comments

Comments
 (0)