Create Channel model

This commit is contained in:
freearhey 2025-03-07 04:27:23 +03:00
parent 4bfb062731
commit 9aa1b9fe50
11 changed files with 123 additions and 56 deletions

View file

@ -9,7 +9,7 @@
nsfw: 'The channel has been added to our blocklist due to NSFW content'
}
const blocklistRefs = channel.blocklist_records
const blocklistRefs = channel._blocklistRecords
.map(record => {
let refName

View file

@ -13,6 +13,7 @@
const guides = channel._guides
const streams = channel._streams
const displayName = channel._displayName
const [name, country] = channel.id.split('.')
@ -20,11 +21,7 @@
let prevUrl = '/'
const onOpened = () => {
prevUrl = window.location.href
window.history.pushState(
{},
`${channel.displayName} • iptv-org`,
`/channels/${country}/${name}`
)
window.history.pushState({}, `${displayName} • iptv-org`, `/channels/${country}/${name}`)
}
const onClose = () => {
window.history.pushState({}, `iptv-org`, prevUrl)
@ -32,13 +29,13 @@
const showGuides = () =>
open(
GuidesPopup,
{ guides, title: channel.displayName },
{ guides, title: displayName },
{ transitionBgProps: { duration: 0 }, transitionWindowProps: { duration: 0 } }
)
const showStreams = () =>
open(
StreamsPopup,
{ streams, title: channel.displayName },
{ streams, title: displayName },
{ transitionBgProps: { duration: 0 }, transitionWindowProps: { duration: 0 } }
)
const showChannelData = () => {
@ -89,7 +86,7 @@
loading="lazy"
referrerpolicy="no-referrer"
src={channel.logo}
alt={channel.displayName}
alt={displayName}
/>
{/if}
</div>
@ -103,9 +100,9 @@
href="/channels/{country}/{name}"
tabindex="0"
class="font-normal text-gray-600 dark:text-white hover:underline hover:text-blue-500 truncate whitespace-nowrap"
title={channel.displayName}
title={displayName}
>
{channel.displayName}
{displayName}
</a>
<div class="flex space-x-2">
{#if channel.is_closed}

View file

@ -30,7 +30,7 @@
>
<div class="w-2/3 overflow-hidden">
<div class="flex items-center space-x-3">
<h3 class="text-l font-medium text-gray-900 dark:text-white">{channel.displayName}</h3>
<h3 class="text-l font-medium text-gray-900 dark:text-white">{channel._displayName}</h3>
<div class="flex space-x-2">
{#if channel.is_closed}
<ClosedBadge {channel} />

View file

@ -6,7 +6,7 @@
export let channel
const endpoint = 'https://github.com/iptv-org/database/issues/new'
const title = `Edit: ${channel.displayName}`
const title = `Edit: ${channel._displayName}`
const labels = 'channels:edit'
const template = '__channels_edit.yml'

View file

@ -1,7 +1,5 @@
<script>
import dayjs from 'dayjs'
import { goto } from '$app/navigation'
import { query, hasQuery, setSearchParam } from '~/store'
export let data
export let close = () => {}
@ -19,7 +17,7 @@
{
name: 'owners',
type: 'link[]',
value: data.owners.map(value => ({ label: value, query: `owners:${norm(value)}` }))
value: data.owners.map(value => ({ label: value, query: `owner:${norm(value)}` }))
},
{
name: 'country',
@ -41,7 +39,7 @@
{
name: 'broadcast_area',
type: 'link[]',
value: data._broadcast_area.map(v => ({
value: data._broadcastArea.map(v => ({
label: v.name,
query: `broadcast_area:${v.type}/${v.code}`
}))
@ -49,12 +47,12 @@
{
name: 'languages',
type: 'link[]',
value: data._languages.map(v => ({ label: v.name, query: `languages:${v.code}` }))
value: data._languages.map(v => ({ label: v.name, query: `language:${v.code}` }))
},
{
name: 'categories',
type: 'link[]',
value: data._categories.map(v => ({ label: v.name, query: `categories:${v.id}` }))
value: data._categories.map(v => ({ label: v.name, query: `category:${v.id}` }))
},
{
name: 'is_nsfw',

View file

@ -15,12 +15,12 @@
result: 'Find channels that have "Nat Geo" in the name.'
},
{
query: 'alt_names:חינוכית',
query: 'alt_name:חינוכית',
result: 'Finds channels whose alternative name contains "חינוכית".'
},
{ query: 'network:ABC', result: 'Finds all channels operated by the ABC Network.' },
{
query: 'owners:^$',
query: 'owner:^$',
result: 'Finds channels that have no owner listed.'
},
{ query: 'country:GY', result: 'Finds all channels that are broadcast from Guyana.' },
@ -30,8 +30,8 @@
},
{ query: 'city:"San Francisco"', result: 'Finds all channels broadcast from San Francisco.' },
{ query: 'broadcast_area:c/CV', result: 'Finds channels that are broadcast in Cape Verde.' },
{ query: 'languages:fra', result: 'Find channels that are broadcast in French.' },
{ query: 'categories:news', result: 'Finds all the news channels.' },
{ query: 'language:fra', result: 'Find channels that are broadcast in French.' },
{ query: 'category:news', result: 'Finds all the news channels.' },
{ query: 'website:.', result: 'Finds channels that have a link to the official website.' },
{ query: 'is_nsfw:true', result: 'Finds channels marked as NSFW.' },
{