mirror of
https://github.com/iptv-org/iptv
synced 2026-09-09 13:27:58 -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
|
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 {
|
getBoolean(key: string): boolean {
|
||||||
return Boolean(this._data.get(key))
|
return Boolean(this._data.get(key))
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(key: string): string | undefined {
|
getString(key: string): string | undefined {
|
||||||
const deleteSymbol = '~'
|
return this._data.get(key)
|
||||||
|
|
||||||
return this._data.get(key) === deleteSymbol ? '' : this._data.get(key)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getArray(key: string): string[] | undefined {
|
getArray(key: string): string[] | undefined {
|
||||||
const deleteSymbol = '~'
|
|
||||||
|
|
||||||
if (this._data.missing(key)) return undefined
|
if (this._data.missing(key)) return undefined
|
||||||
|
|
||||||
const value = this._data.get(key)
|
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 {
|
updateWithIssue(dataSet: DataSet): this {
|
||||||
const streamId = dataSet.getString('stream_id') || ''
|
if (dataSet.isDeleted('stream_id')) {
|
||||||
const [channelId, feedId] = streamId.split('@')
|
this.channel = ''
|
||||||
|
this.feed = ''
|
||||||
if (channelId) {
|
|
||||||
this.channel = channelId
|
|
||||||
this.feed = feedId
|
|
||||||
this.updateTvgId().updateTitle().updateFilepath()
|
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 = {
|
const data = {
|
||||||
label: dataSet.getString('label'),
|
label: dataSet.isDeleted('label') ? '' : dataSet.getString('label'),
|
||||||
quality: dataSet.getString('quality'),
|
quality: dataSet.isDeleted('quality') ? '' : dataSet.getString('quality'),
|
||||||
httpUserAgent: dataSet.getString('http_user_agent'),
|
httpUserAgent: dataSet.isDeleted('http_user_agent')
|
||||||
httpReferrer: dataSet.getString('http_referrer')
|
? ''
|
||||||
|
: dataSet.getString('http_user_agent'),
|
||||||
|
httpReferrer: dataSet.isDeleted('http_referrer') ? '' : dataSet.getString('http_referrer')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.label !== undefined) this.label = data.label
|
if (data.label !== undefined) this.label = data.label
|
||||||
@@ -318,8 +326,9 @@ export class Stream extends sdk.Models.Stream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateTvgId(): this {
|
updateTvgId(): this {
|
||||||
if (!this.channel) return this
|
if (!this.channel) {
|
||||||
if (this.feed) {
|
this.tvgId = ''
|
||||||
|
} else if (this.feed) {
|
||||||
this.tvgId = `${this.channel}@${this.feed}`
|
this.tvgId = `${this.channel}@${this.feed}`
|
||||||
} else {
|
} else {
|
||||||
this.tvgId = this.channel
|
this.tvgId = this.channel
|
||||||
|
|||||||
Reference in New Issue
Block a user