Update scripts

This commit is contained in:
freearhey 2025-04-19 02:06:15 +03:00
parent d681fcb3d5
commit 8e363d0e83
19 changed files with 562 additions and 141 deletions

35
scripts/models/guide.ts Normal file
View 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}`
}
}