Merge branch 'master' into patch-2

This commit is contained in:
vbHeiko 2021-08-06 17:42:53 +02:00 committed by GitHub
commit 0bcf820d4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 5 deletions

View File

@ -6614,3 +6614,5 @@ https://ln-zen.localnowlive.com/v1/master/385c85a93929f94966d0fb186fc33b431e6f1e
https://rockentertainment-zoomoo-1.samsung.wurl.com/manifest/playlist.m3u8 https://rockentertainment-zoomoo-1.samsung.wurl.com/manifest/playlist.m3u8
#EXTINF:-1 tvg-id="KanalDisney.us" tvg-name="Канал Disney" tvg-country="RU" tvg-language="Russian" tvg-logo="https://i.imgur.com/Q9KoVy9.png" group-title="Kids",Канал Disney (576p) #EXTINF:-1 tvg-id="KanalDisney.us" tvg-name="Канал Disney" tvg-country="RU" tvg-language="Russian" tvg-logo="https://i.imgur.com/Q9KoVy9.png" group-title="Kids",Канал Disney (576p)
http://188.40.68.167/russia/disney/playlist.m3u8 http://188.40.68.167/russia/disney/playlist.m3u8
#EXTINF:-1 tvg-id="KABCDT2.us" tvg-name="Localish (KABC-DT2)" tvg-country="US" tvg-language="English" tvg-logo="https://zap2it.tmsimg.com/h3/NowShowing/35230/s70938_h3_aa.png" group-title="Local",Localish (KABC-DT2)
https://streams.the6tv.duckdns.org:2443/locals/SoCal/kabc-dt2.m3u8

View File

@ -17,7 +17,7 @@ program
const config = program.opts() const config = program.opts()
const offlineStatusCodes = [404, 410, 451, 500, 501] const offlineStatusCodes = [404, 410, 451, 500, 501]
const ignore = ['Geo-blocked', 'Not 24/7'] const ignoreStatus = ['Geo-blocked', 'Not 24/7', 'Offline']
const instance = axios.create({ const instance = axios.create({
timeout: config.timeout, timeout: config.timeout,
maxContentLength: 200000, maxContentLength: 200000,
@ -56,9 +56,12 @@ async function checkStatus(playlist) {
for (const [index, channel] of playlist.channels.entries()) { for (const [index, channel] of playlist.channels.entries()) {
const current = index + 1 const current = index + 1
const counter = chalk.gray(`[${current}/${total}]`) const counter = chalk.gray(`[${current}/${total}]`)
const skipChannel =
channel.status &&
ignoreStatus.map(i => i.toLowerCase()).includes(channel.status.toLowerCase())
bar.tick() bar.tick()
if ( if (
(channel.status && ignore.map(i => i.toLowerCase()).includes(channel.status.toLowerCase())) || skipChannel ||
(!channel.url.startsWith('http://') && !channel.url.startsWith('https://')) (!channel.url.startsWith('http://') && !channel.url.startsWith('https://'))
) { ) {
channels.push(channel) channels.push(channel)

View File

@ -15,6 +15,7 @@ program
.parse(process.argv) .parse(process.argv)
const config = program.opts() const config = program.opts()
const ignoreStatus = ['Offline']
const instance = axios.create({ const instance = axios.create({
timeout: config.timeout, timeout: config.timeout,
maxContentLength: 200000, maxContentLength: 200000,
@ -50,7 +51,10 @@ async function detectResolution(playlist) {
let updated = false let updated = false
for (const channel of playlist.channels) { for (const channel of playlist.channels) {
bar.tick() bar.tick()
if (!channel.resolution.height) { const skipChannel =
channel.status &&
ignoreStatus.map(i => i.toLowerCase()).includes(channel.status.toLowerCase())
if (!channel.resolution.height && !skipChannel) {
const CancelToken = axios.CancelToken const CancelToken = axios.CancelToken
const source = CancelToken.source() const source = CancelToken.source()
const timeout = setTimeout(() => { const timeout = setTimeout(() => {

View File

@ -42,7 +42,7 @@ function generateIndex() {
const nsfwFilename = `${ROOT_DIR}/index.nsfw.m3u` const nsfwFilename = `${ROOT_DIR}/index.nsfw.m3u`
file.create(nsfwFilename, '#EXTM3U\n') file.create(nsfwFilename, '#EXTM3U\n')
const channels = db.channels.sortBy(['name', 'url']).removeDuplicates().get() const channels = db.channels.sortBy(['name', 'url']).removeDuplicates().removeOffline().get()
for (const channel of channels) { for (const channel of channels) {
if (!channel.isNSFW()) { if (!channel.isNSFW()) {
file.append(filename, channel.toString()) file.append(filename, channel.toString())
@ -56,7 +56,11 @@ function generateCategoryIndex() {
const filename = `${ROOT_DIR}/index.category.m3u` const filename = `${ROOT_DIR}/index.category.m3u`
file.create(filename, '#EXTM3U\n') file.create(filename, '#EXTM3U\n')
const channels = db.channels.sortBy(['category', 'name', 'url']).removeDuplicates().get() const channels = db.channels
.sortBy(['category', 'name', 'url'])
.removeDuplicates()
.removeOffline()
.get()
for (const channel of channels) { for (const channel of channels) {
file.append(filename, channel.toString()) file.append(filename, channel.toString())
} }
@ -72,6 +76,7 @@ function generateCountryIndex() {
.sortBy(['name', 'url']) .sortBy(['name', 'url'])
.forCountry(country) .forCountry(country)
.removeDuplicates() .removeDuplicates()
.removeOffline()
.get() .get()
for (const channel of channels) { for (const channel of channels) {
const groupTitle = channel.group.title const groupTitle = channel.group.title
@ -95,6 +100,7 @@ function generateLanguageIndex() {
.sortBy(['name', 'url']) .sortBy(['name', 'url'])
.forLanguage(language) .forLanguage(language)
.removeDuplicates() .removeDuplicates()
.removeOffline()
.get() .get()
for (const channel of channels) { for (const channel of channels) {
const groupTitle = channel.group.title const groupTitle = channel.group.title
@ -121,6 +127,7 @@ function generateCategories() {
.sortBy(['name', 'url']) .sortBy(['name', 'url'])
.forCategory(category) .forCategory(category)
.removeDuplicates() .removeDuplicates()
.removeOffline()
.get() .get()
for (const channel of channels) { for (const channel of channels) {
file.append(filename, channel.toString()) file.append(filename, channel.toString())
@ -141,6 +148,7 @@ function generateCountries() {
.sortBy(['name', 'url']) .sortBy(['name', 'url'])
.forCountry(country) .forCountry(country)
.removeDuplicates() .removeDuplicates()
.removeOffline()
.get() .get()
for (const channel of channels) { for (const channel of channels) {
if (!channel.isNSFW()) { if (!channel.isNSFW()) {
@ -163,6 +171,7 @@ function generateLanguages() {
.sortBy(['name', 'url']) .sortBy(['name', 'url'])
.forLanguage(language) .forLanguage(language)
.removeDuplicates() .removeDuplicates()
.removeOffline()
.get() .get()
for (const channel of channels) { for (const channel of channels) {
if (!channel.isNSFW()) { if (!channel.isNSFW()) {

View File

@ -31,6 +31,7 @@ db.channels = {
list: [], list: [],
filter: null, filter: null,
duplicates: true, duplicates: true,
offline: true,
nsfw: true, nsfw: true,
add(channel) { add(channel) {
this.list.push(channel) this.list.push(channel)
@ -86,8 +87,13 @@ db.channels = {
output = output.filter(channel => !channel.isNSFW()) output = output.filter(channel => !channel.isNSFW())
} }
if (!this.offline) {
output = output.filter(channel => channel.status !== 'Offline')
}
this.nsfw = true this.nsfw = true
this.duplicates = true this.duplicates = true
this.offline = true
this.filter = null this.filter = null
return output return output
@ -102,6 +108,11 @@ db.channels = {
return this return this
}, },
removeOffline() {
this.offline = false
return this
},
all() { all() {
return this.list return this.list
}, },