mirror of
https://github.com/iptv-org/epg
synced 2026-05-13 21:05:07 -04:00
Update scripts
This commit is contained in:
49
scripts/models/apiGuide.ts
Normal file
49
scripts/models/apiGuide.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { WorkerGuideSource } from './worker'
|
||||
|
||||
export interface ApiGuideData {
|
||||
channel: string | null
|
||||
feed: string | null
|
||||
site: string
|
||||
site_id: string
|
||||
site_name: string
|
||||
lang: string | null
|
||||
sources?: WorkerGuideSource[]
|
||||
}
|
||||
|
||||
export class ApiGuide {
|
||||
channel: string | null
|
||||
feed: string | null
|
||||
site: string
|
||||
site_id: string
|
||||
site_name: string
|
||||
lang: string
|
||||
sources: WorkerGuideSource[] = []
|
||||
|
||||
constructor(data: ApiGuideData) {
|
||||
this.channel = data.channel || null
|
||||
this.feed = data.feed || null
|
||||
this.site = data.site
|
||||
this.site_id = data.site_id
|
||||
this.site_name = data.site_name
|
||||
this.lang = data.lang || 'en'
|
||||
this.sources = data.sources || []
|
||||
}
|
||||
|
||||
addSource(source: ApiGuideSource): this {
|
||||
this.sources.push(source)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
toJSON(): ApiGuideData {
|
||||
return {
|
||||
channel: this.channel,
|
||||
feed: this.feed,
|
||||
site: this.site,
|
||||
site_id: this.site_id,
|
||||
site_name: this.site_name,
|
||||
lang: this.lang,
|
||||
sources: this.sources
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user