diff --git a/.github/ISSUE_TEMPLATE/2_streams_edit.yml b/.github/ISSUE_TEMPLATE/2_streams_edit.yml index f0c6b9ece7..5917f3d794 100644 --- a/.github/ISSUE_TEMPLATE/2_streams_edit.yml +++ b/.github/ISSUE_TEMPLATE/2_streams_edit.yml @@ -59,6 +59,7 @@ body: - 480p - 480i - 360p + - '~' - type: input id: http_user_agent diff --git a/scripts/commands/playlist/generate.ts b/scripts/commands/playlist/generate.ts index ccd40abcca..4d4663bf4d 100644 --- a/scripts/commands/playlist/generate.ts +++ b/scripts/commands/playlist/generate.ts @@ -52,7 +52,7 @@ async function main() { (stream: Stream) => (stream.isNot247 ? -1 : 0), (stream: Stream) => stream.getVerticalResolution() ], - ['asc', 'desc', 'desc', 'desc', 'asc'] + ['asc', 'desc', 'desc', 'desc'] ) logger.info('filtering streams...') diff --git a/scripts/commands/playlist/update.ts b/scripts/commands/playlist/update.ts index 4bb50a3f8a..ee04f10773 100644 --- a/scripts/commands/playlist/update.ts +++ b/scripts/commands/playlist/update.ts @@ -264,8 +264,11 @@ async function addStream(issue: Issue) { label: null }) - stream.isNot247 = data.has('live_247') ? !data.getBoolean('live_247') : false - stream.isGeoBlocked = data.has('geo_blocked') ? data.getBoolean('geo_blocked') : false + const live247 = data.getBoolean('live_247') + const geoBlocked = data.getBoolean('geo_blocked') + + stream.isNot247 = live247 === undefined ? false : !live247 + stream.isGeoBlocked = geoBlocked === true stream.updateTitle().updateFilepath() diff --git a/scripts/core/dataSet.ts b/scripts/core/dataSet.ts index ac1700ee5b..d8a838ac52 100644 --- a/scripts/core/dataSet.ts +++ b/scripts/core/dataSet.ts @@ -23,9 +23,11 @@ export class DataSet { } getBoolean(key: string): boolean | undefined { - if (this.missing(key)) return undefined + const value = this._data.get(key) - return this._data.get(key) === 'TRUE' ? true : false + if (value === undefined || value === '') return undefined + + return value === 'TRUE' } getString(key: string): string | undefined { diff --git a/scripts/models/stream.ts b/scripts/models/stream.ts index 62cc853ec4..8cb68010f7 100644 --- a/scripts/models/stream.ts +++ b/scripts/models/stream.ts @@ -53,8 +53,8 @@ export class Stream extends sdk.Models.Stream { const live247 = dataSet.getBoolean('live_247') const geoBlocked = dataSet.getBoolean('geo_blocked') - if (live247) this.isNot247 = live247 - if (geoBlocked) this.isGeoBlocked = geoBlocked + if (live247 !== undefined) this.isNot247 = !live247 + if (geoBlocked !== undefined) this.isGeoBlocked = geoBlocked const quality = dataSet.isDeleted('quality') ? '' : dataSet.getString('quality') const httpUserAgent = dataSet.isDeleted('http_user_agent') @@ -435,7 +435,7 @@ export class Stream extends sdk.Models.Stream { } getLabels(): string[] { - let labels: string[] = [] + const labels: string[] = [] if (this.isNot247 === true) { labels.push('Not 24/7') } diff --git a/tests/__data__/expected/playlist_update/streams/br_example.m3u b/tests/__data__/expected/playlist_update/streams/br_example.m3u index 63f672f867..0400ad8373 100644 --- a/tests/__data__/expected/playlist_update/streams/br_example.m3u +++ b/tests/__data__/expected/playlist_update/streams/br_example.m3u @@ -1,4 +1,4 @@ #EXTM3U -#EXTINF:-1 tvg-id="BBCAmerica.us@East",BBC America East (720p) [Not 24/7] +#EXTINF:-1 tvg-id="BBCAmerica.us@East",BBC America East (720p) #EXTVLCOPT:http-user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 Edge/12.246 https://servilive.com:3126/live/tele2000live.m3u8