diff --git a/src/components/ChannelItem.svelte b/src/components/ChannelItem.svelte index 815caa468..5a5b1e514 100644 --- a/src/components/ChannelItem.svelte +++ b/src/components/ChannelItem.svelte @@ -16,7 +16,11 @@ let prevUrl = '/' const onOpened = () => { prevUrl = window.location.href - window.history.pushState({}, `${channel.name} • iptv-org`, `/channels/${country}/${name}`) + window.history.pushState( + {}, + `${channel.displayName} • iptv-org`, + `/channels/${country}/${name}` + ) } const onClose = () => { window.history.pushState({}, `iptv-org`, prevUrl) @@ -24,7 +28,7 @@ const showStreams = () => open( StreamsPopup, - { streams, title: channel.name }, + { streams, title: channel.displayName }, { transitionBgProps: { duration: 0 }, transitionWindowProps: { duration: 0 } } ) const showChannelData = () => { @@ -74,7 +78,7 @@ loading="lazy" referrerpolicy="no-referrer" src={channel.logo} - alt={channel.name} + alt={channel.displayName} /> {/if} @@ -88,9 +92,9 @@ href="/channels/{country}/{name}" tabindex="0" class="font-normal text-gray-600 dark:text-white hover:underline hover:text-blue-500 line-clamp-1" - title={channel.name} + title={channel.displayName} > - {channel.name} + {channel.displayName} {#if channel.is_closed}
-

{channel.name}

+

{channel.displayName}

diff --git a/src/components/EditButton.svelte b/src/components/EditButton.svelte index ffd4e2cea..95d9d3633 100644 --- a/src/components/EditButton.svelte +++ b/src/components/EditButton.svelte @@ -4,7 +4,7 @@ export let channel const endpoint = 'https://github.com/iptv-org/database/issues/new' - const title = `Edit: ${channel.name}` + const title = `Edit: ${channel.displayName}` const labels = 'channels:edit' const template = '__channels_edit.yml' diff --git a/src/pages/channels/[country]/[name]/+page.server.js b/src/pages/channels/[country]/[name]/+page.server.js index 25f29d1b9..39a2f16c5 100644 --- a/src/pages/channels/[country]/[name]/+page.server.js +++ b/src/pages/channels/[country]/[name]/+page.server.js @@ -21,6 +21,7 @@ data.categories = _.keyBy(categories, 'id') data.streams = _.groupBy(_streams, 'channel') data.blocklist = _.groupBy(blocklist, 'channel') data.channels = _.keyBy(channels, channel => channel.id.toLowerCase()) +data.nameIndex = _.groupBy(channels, channel => channel.name.toLowerCase()) export const csr = true export const ssr = true diff --git a/src/pages/channels/[country]/[name]/+page.svelte b/src/pages/channels/[country]/[name]/+page.svelte index f8fe99345..5a02ca550 100644 --- a/src/pages/channels/[country]/[name]/+page.svelte +++ b/src/pages/channels/[country]/[name]/+page.svelte @@ -26,8 +26,8 @@ - {channel && channel.name ? `${channel.name} • iptv-org` : 'iptv-org'} - + {channel && channel.displayName ? `${channel.displayName} • iptv-org` : 'iptv-org'} + {@html schema()} @@ -50,7 +50,7 @@ class="flex justify-between items-center py-3 pl-5 pr-4 rounded-t border-b dark:border-gray-700" >
-

{channel.name}

+

{channel.displayName}

diff --git a/src/store.js b/src/store.js index a678f112b..ff7d351aa 100644 --- a/src/store.js +++ b/src/store.js @@ -139,6 +139,8 @@ async function loadAPI() { return [] }) + api.nameIndex = _.groupBy(api.channels, channel => channel.name.toLowerCase()) + return api } @@ -163,6 +165,11 @@ export function transformChannel(channel, data) { channel.is_blocked = !!data.blocklist[channel.id] channel.streams = channel._streams.length + const isChannelNameRepeated = data.nameIndex[channel.name.toLowerCase()].length > 1 + channel.displayName = isChannelNameRepeated + ? `${channel.name} (${channel._country.name})` + : channel.name + return channel }