Skip to content

Commit 1969dcf

Browse files
committed
fix: Group title output for Custom Playlists
1 parent 470fe5c commit 1969dcf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

app/Http/Controllers/PlaylistGenerateController.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ function () use ($cursor, $baseUrl, $playlist, $proxyEnabled, $logoProxyEnabled,
126126
}
127127
if ($type === 'custom') {
128128
// We selected the custom tag name as `custom_group_name` when building the query
129+
// It's a JSON field with translations, so decode and extract the 'en' locale
129130
if (!empty($channel->custom_group_name)) {
130-
$group = $channel->custom_group_name;
131+
$groupName = json_decode($channel->custom_group_name, true);
132+
$group = $groupName['en'] ?? $groupName[array_key_first($groupName)] ?? '';
131133
}
132134
}
133135

@@ -541,7 +543,7 @@ public static function getChannelQuery($playlist): mixed
541543
$join->on('channels.id', '=', 'taggables.taggable_id')
542544
->where('taggables.taggable_type', '=', Channel::class);
543545
});
544-
546+
545547
$query->leftJoin('tags as custom_tags', function ($join) use ($playlistUuid) {
546548
$join->on('taggables.tag_id', '=', 'custom_tags.id')
547549
->where('custom_tags.type', '=', $playlistUuid);
@@ -553,7 +555,9 @@ public static function getChannelQuery($playlist): mixed
553555
->orderBy('channels.channel')
554556
->orderBy('channels.title');
555557

556-
// Include the custom tag name/order in the selected columns so it is available
558+
// Include the custom tag name/order in the selected columns
559+
// Note: custom_tags.name is a JSON field with translations like {"en":"Name"}
560+
// We'll decode it in PHP to extract the locale-specific value
557561
$query->selectRaw('custom_tags.name as custom_group_name')
558562
->selectRaw('custom_tags.order_column as custom_order');
559563
} else {

0 commit comments

Comments
 (0)