Returns back the list of streams

This commit is contained in:
freearhey 2023-10-09 16:04:01 +03:00
parent 230e426c9c
commit 4bad886862
5 changed files with 14 additions and 83 deletions

View file

@ -20,47 +20,33 @@ export async function entries() {
})
}
export async function load({ params }) {
const data = await loadData()
export function load({ params }) {
const data = loadData()
const country = params.country
const name = params.name
const id = `${name}.${country}`.toLowerCase()
const _channels = data.channels
let streams = []
let channel = _channels.find(channel => channel.id.toLowerCase() === id)
let channel = channels.find(channel => channel.id.toLowerCase() === id) || {}
if (channel) {
channel = transformChannel(channel, data)
streams = channel._streams
}
return {
channel,
streams
channel
}
}
async function loadData() {
function loadData() {
const data = {}
data.countries = _.keyBy(
countries.map(country => {
country.expanded = false
return country
}),
'code'
)
data.countries = _.keyBy(countries, 'code')
data.regions = _.keyBy(regions, 'code')
data.subdivisions = _.keyBy(subdivisions, 'code')
data.languages = _.keyBy(languages, 'code')
data.categories = _.keyBy(categories, 'id')
data.streams = _.keyBy(streams, 'channel')
data.blocklist = _.keyBy(blocklist, 'channel')
data.channels = channels
data.streams = _.groupBy(streams, 'channel')
data.blocklist = _.groupBy(blocklist, 'channel')
return data
}

View file

@ -9,7 +9,7 @@
let isLoading = false
let channel = data.channel
let streams = data.streams
let streams = channel ? channel._streams : []
</script>
<svelte:head>
@ -64,23 +64,5 @@
</div>
</div>
{/if}
<!-- {#if guides.length}
<div class="border rounded-md border-gray-200 dark:border-gray-700 dark:bg-gray-800 bg-white">
<div
class="flex justify-between items-center py-4 pl-5 pr-4 rounded-t border-b dark:border-gray-700"
>
<div class="w-1/3 overflow-hidden">
<h3 class="text-l font-medium text-gray-900 dark:text-white">Guides</h3>
</div>
</div>
<div class="overflow-y-auto overflow-x-hidden w-full p-6">
<div class="space-y-2">
{#each guides as guide}
<GuideItem guide="{guide}" />
{/each}
</div>
</div>
</div>
{/if} -->
</section>
</main>