mirror of
https://github.com/iptv-org/iptv-org.github.io.git
synced 2025-05-12 01:50:05 -04:00
Returns back the list of streams
This commit is contained in:
parent
230e426c9c
commit
4bad886862
5 changed files with 14 additions and 83 deletions
|
@ -9,7 +9,6 @@
|
|||
|
||||
export let channel
|
||||
|
||||
const guides = channel._guides
|
||||
const streams = channel._streams
|
||||
|
||||
const [name, country] = channel.id.split('.')
|
||||
|
@ -26,7 +25,7 @@
|
|||
const showGuides = () =>
|
||||
open(
|
||||
GuidesPopup,
|
||||
{ guides, title: channel.name },
|
||||
{ title: channel.name },
|
||||
{ transitionBgProps: { duration: 0 }, transitionWindowProps: { duration: 0 } }
|
||||
)
|
||||
const showStreams = () =>
|
||||
|
@ -138,31 +137,6 @@
|
|||
</div>
|
||||
<div class="w-40 px-6 sm:w-[150px]">
|
||||
<div class="text-right flex justify-end space-x-3 items-center">
|
||||
<!-- {#if guides.length}
|
||||
<button
|
||||
on:click="{showGuides}"
|
||||
class="text-sm text-gray-500 dark:text-gray-100 inline-flex space-x-1 flex items-center hover:text-blue-500 dark:hover:text-blue-400"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 20 20"
|
||||
fill="currentColor"
|
||||
class="w-5 h-5"
|
||||
>
|
||||
<path
|
||||
d="M5.25 12a.75.75 0 01.75-.75h.01a.75.75 0 01.75.75v.01a.75.75 0 01-.75.75H6a.75.75 0 01-.75-.75V12zM6 13.25a.75.75 0 00-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 00.75-.75V14a.75.75 0 00-.75-.75H6zM7.25 12a.75.75 0 01.75-.75h.01a.75.75 0 01.75.75v.01a.75.75 0 01-.75.75H8a.75.75 0 01-.75-.75V12zM8 13.25a.75.75 0 00-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 00.75-.75V14a.75.75 0 00-.75-.75H8zM9.25 10a.75.75 0 01.75-.75h.01a.75.75 0 01.75.75v.01a.75.75 0 01-.75.75H10a.75.75 0 01-.75-.75V10zM10 11.25a.75.75 0 00-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 00.75-.75V12a.75.75 0 00-.75-.75H10zM9.25 14a.75.75 0 01.75-.75h.01a.75.75 0 01.75.75v.01a.75.75 0 01-.75.75H10a.75.75 0 01-.75-.75V14zM12 9.25a.75.75 0 00-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 00.75-.75V10a.75.75 0 00-.75-.75H12zM11.25 12a.75.75 0 01.75-.75h.01a.75.75 0 01.75.75v.01a.75.75 0 01-.75.75H12a.75.75 0 01-.75-.75V12zM12 13.25a.75.75 0 00-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 00.75-.75V14a.75.75 0 00-.75-.75H12zM13.25 10a.75.75 0 01.75-.75h.01a.75.75 0 01.75.75v.01a.75.75 0 01-.75.75H14a.75.75 0 01-.75-.75V10zM14 11.25a.75.75 0 00-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 00.75-.75V12a.75.75 0 00-.75-.75H14z"
|
||||
/>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
d="M5.75 2a.75.75 0 01.75.75V4h7V2.75a.75.75 0 011.5 0V4h.25A2.75 2.75 0 0118 6.75v8.5A2.75 2.75 0 0115.25 18H4.75A2.75 2.75 0 012 15.25v-8.5A2.75 2.75 0 014.75 4H5V2.75A.75.75 0 015.75 2zm-1 5.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25v-6.5c0-.69-.56-1.25-1.25-1.25H4.75z"
|
||||
clip-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
|
||||
<div>{guides.length}</div>
|
||||
<div>{pluralize(guides.length, 'guide')}</div>
|
||||
</button>
|
||||
{/if} -->
|
||||
{#if streams.length}
|
||||
<button
|
||||
on:click={showStreams}
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
import { getContext } from 'svelte'
|
||||
const { close } = getContext('simple-modal')
|
||||
|
||||
export let guides = []
|
||||
export let title = 'Guides'
|
||||
</script>
|
||||
|
||||
<div class="relative px-2 py-32 flex justify-center" on:keypress on:click|self="{close}">
|
||||
<div class="relative px-2 py-32 flex justify-center" on:keypress on:click|self={close}>
|
||||
<div class="relative bg-white rounded-md shadow dark:bg-gray-800 w-full max-w-2xl">
|
||||
<div
|
||||
class="flex justify-between items-center py-4 pl-5 pr-4 rounded-t border-b dark:border-gray-700"
|
||||
|
@ -30,11 +29,11 @@
|
|||
d="M5.75 2a.75.75 0 01.75.75V4h7V2.75a.75.75 0 011.5 0V4h.25A2.75 2.75 0 0118 6.75v8.5A2.75 2.75 0 0115.25 18H4.75A2.75 2.75 0 012 15.25v-8.5A2.75 2.75 0 014.75 4H5V2.75A.75.75 0 015.75 2zm-1 5.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25v-6.5c0-.69-.56-1.25-1.25-1.25H4.75z"
|
||||
clip-rule="evenodd"
|
||||
/>
|
||||
</svg> </span
|
||||
>{title}
|
||||
</svg>
|
||||
</span>{title}
|
||||
</h3>
|
||||
<button
|
||||
on:click="{close}"
|
||||
on:click={close}
|
||||
type="button"
|
||||
class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-full text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white"
|
||||
>
|
||||
|
@ -52,12 +51,5 @@
|
|||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="overflow-y-scroll overflow-x-hidden w-full">
|
||||
<div class="p-6 space-y-2">
|
||||
{#each guides as guide}
|
||||
<GuideItem guide="{guide}" />
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -52,7 +52,6 @@ export async function fetchChannels() {
|
|||
'closed',
|
||||
'replaced_by',
|
||||
'streams',
|
||||
'guides',
|
||||
'is_nsfw',
|
||||
'is_closed',
|
||||
'is_blocked'
|
||||
|
@ -128,8 +127,6 @@ async function loadAPI() {
|
|||
.then(data => _.groupBy(data, 'channel'))
|
||||
.catch(console.error)
|
||||
|
||||
api.guides = {}
|
||||
|
||||
api.channels = await fetch('https://iptv-org.github.io/api/channels.json')
|
||||
.then(r => r.json())
|
||||
.catch(err => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue