mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 16:40:07 -04:00
Update scripts
This commit is contained in:
parent
d681fcb3d5
commit
8e363d0e83
19 changed files with 562 additions and 141 deletions
35
scripts/models/guide.ts
Normal file
35
scripts/models/guide.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
import type { GuideData } from '../types/guide'
|
||||
import { uniqueId } from 'lodash'
|
||||
|
||||
export class Guide {
|
||||
channelId?: string
|
||||
feedId?: string
|
||||
siteDomain?: string
|
||||
siteId?: string
|
||||
siteName?: string
|
||||
languageCode?: string
|
||||
|
||||
constructor(data?: GuideData) {
|
||||
if (!data) return
|
||||
|
||||
this.channelId = data.channel
|
||||
this.feedId = data.feed
|
||||
this.siteDomain = data.site
|
||||
this.siteId = data.site_id
|
||||
this.siteName = data.site_name
|
||||
this.languageCode = data.lang
|
||||
}
|
||||
|
||||
getUUID(): string {
|
||||
if (!this.getStreamId() || !this.siteId) return uniqueId()
|
||||
|
||||
return this.getStreamId() + this.siteId
|
||||
}
|
||||
|
||||
getStreamId(): string | undefined {
|
||||
if (!this.channelId) return undefined
|
||||
if (!this.feedId) return this.channelId
|
||||
|
||||
return `${this.channelId}@${this.feedId}`
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue