mirror of
https://github.com/iptv-org/database.git
synced 2024-11-22 19:04:10 -05:00
92 lines
1.8 KiB
TypeScript
92 lines
1.8 KiB
TypeScript
type ChannelProps = {
|
|
id: string
|
|
name: string
|
|
alt_names: string[]
|
|
network: string
|
|
owners: string[]
|
|
country: string
|
|
subdivision: string
|
|
city: string
|
|
broadcast_area: string[]
|
|
languages: string[]
|
|
categories: string[]
|
|
is_nsfw: boolean
|
|
launched: string
|
|
closed: string
|
|
replaced_by: string
|
|
website: string
|
|
logo: string
|
|
}
|
|
|
|
export class Channel {
|
|
id: string
|
|
name: string
|
|
alt_names: string[]
|
|
network: string
|
|
owners: string[]
|
|
country: string
|
|
subdivision: string
|
|
city: string
|
|
broadcast_area: string[]
|
|
languages: string[]
|
|
categories: string[]
|
|
is_nsfw: boolean
|
|
launched: string
|
|
closed: string
|
|
replaced_by: string
|
|
website: string
|
|
logo: string
|
|
|
|
constructor({
|
|
id,
|
|
name,
|
|
alt_names,
|
|
network,
|
|
owners,
|
|
country,
|
|
subdivision,
|
|
city,
|
|
broadcast_area,
|
|
languages,
|
|
categories,
|
|
is_nsfw,
|
|
launched,
|
|
closed,
|
|
replaced_by,
|
|
website,
|
|
logo
|
|
}: ChannelProps) {
|
|
this.id = id
|
|
this.name = name
|
|
this.alt_names = alt_names
|
|
this.network = network
|
|
this.owners = owners
|
|
this.country = country
|
|
this.subdivision = subdivision
|
|
this.city = city
|
|
this.broadcast_area = broadcast_area
|
|
this.languages = languages
|
|
this.categories = categories
|
|
this.is_nsfw = is_nsfw
|
|
this.launched = launched
|
|
this.closed = closed
|
|
this.replaced_by = replaced_by
|
|
this.website = website
|
|
this.logo = logo
|
|
}
|
|
|
|
data() {
|
|
const { ...object } = this
|
|
|
|
return object
|
|
}
|
|
|
|
merge(channel: Channel) {
|
|
const data: { [key: string]: string | string[] | boolean } = channel.data()
|
|
for (const prop in data) {
|
|
if (data[prop] === undefined) continue
|
|
if (Array.isArray(data[prop]) && !data[prop].length) continue
|
|
this[prop] = data[prop]
|
|
}
|
|
}
|
|
}
|