mirror of
https://github.com/iptv-org/iptv
synced 2026-09-06 03:50:47 -04:00
Update scripts
This commit is contained in:
@@ -14,23 +14,25 @@ export class DataSet {
|
||||
return this._data.missing(key) || this._data.get(key) === undefined
|
||||
}
|
||||
|
||||
isDeleted(key: string): boolean {
|
||||
const deleteSymbol = '~'
|
||||
|
||||
return this._data.get(key) === deleteSymbol
|
||||
}
|
||||
|
||||
getBoolean(key: string): boolean {
|
||||
return Boolean(this._data.get(key))
|
||||
}
|
||||
|
||||
getString(key: string): string | undefined {
|
||||
const deleteSymbol = '~'
|
||||
|
||||
return this._data.get(key) === deleteSymbol ? '' : this._data.get(key)
|
||||
return this._data.get(key)
|
||||
}
|
||||
|
||||
getArray(key: string): string[] | undefined {
|
||||
const deleteSymbol = '~'
|
||||
|
||||
if (this._data.missing(key)) return undefined
|
||||
|
||||
const value = this._data.get(key)
|
||||
|
||||
return !value || value === deleteSymbol ? [] : value.split('\r\n')
|
||||
return !value || this.isDeleted(key) ? [] : value.split('\r\n')
|
||||
}
|
||||
}
|
||||
|
||||
+21
-12
@@ -33,20 +33,28 @@ export class Stream extends sdk.Models.Stream {
|
||||
}
|
||||
|
||||
updateWithIssue(dataSet: DataSet): this {
|
||||
const streamId = dataSet.getString('stream_id') || ''
|
||||
const [channelId, feedId] = streamId.split('@')
|
||||
|
||||
if (channelId) {
|
||||
this.channel = channelId
|
||||
this.feed = feedId
|
||||
if (dataSet.isDeleted('stream_id')) {
|
||||
this.channel = ''
|
||||
this.feed = ''
|
||||
this.updateTvgId().updateTitle().updateFilepath()
|
||||
} else if (dataSet.has('stream_id')) {
|
||||
const streamId = dataSet.getString('stream_id') || ''
|
||||
const [channelId, feedId] = streamId.split('@')
|
||||
|
||||
if (channelId) {
|
||||
this.channel = channelId
|
||||
this.feed = feedId
|
||||
this.updateTvgId().updateTitle().updateFilepath()
|
||||
}
|
||||
}
|
||||
|
||||
const data = {
|
||||
label: dataSet.getString('label'),
|
||||
quality: dataSet.getString('quality'),
|
||||
httpUserAgent: dataSet.getString('http_user_agent'),
|
||||
httpReferrer: dataSet.getString('http_referrer')
|
||||
label: dataSet.isDeleted('label') ? '' : dataSet.getString('label'),
|
||||
quality: dataSet.isDeleted('quality') ? '' : dataSet.getString('quality'),
|
||||
httpUserAgent: dataSet.isDeleted('http_user_agent')
|
||||
? ''
|
||||
: dataSet.getString('http_user_agent'),
|
||||
httpReferrer: dataSet.isDeleted('http_referrer') ? '' : dataSet.getString('http_referrer')
|
||||
}
|
||||
|
||||
if (data.label !== undefined) this.label = data.label
|
||||
@@ -318,8 +326,9 @@ export class Stream extends sdk.Models.Stream {
|
||||
}
|
||||
|
||||
updateTvgId(): this {
|
||||
if (!this.channel) return this
|
||||
if (this.feed) {
|
||||
if (!this.channel) {
|
||||
this.tvgId = ''
|
||||
} else if (this.feed) {
|
||||
this.tvgId = `${this.channel}@${this.feed}`
|
||||
} else {
|
||||
this.tvgId = this.channel
|
||||
|
||||
Reference in New Issue
Block a user