Fill in the blank group-title

Resolves #6017
This commit is contained in:
Aleksandr Statciuk 2022-01-12 20:35:02 +03:00
parent d9f1c0dedb
commit c0547c3fae
15 changed files with 237 additions and 84 deletions

View File

@ -48,7 +48,15 @@ async function generateCategories() {
const { count: otherCount } = await generator.generate(
`${PUBLIC_PATH}/categories/other.m3u`,
{ categories: { $size: 0 } },
{ saveEmpty: true }
{
saveEmpty: true,
onLoad: function (items) {
return items.map(item => {
item.group_title = 'Other'
return item
})
}
}
)
await log('categories', {
@ -80,6 +88,14 @@ async function generateCountries() {
`${PUBLIC_PATH}/countries/undefined.m3u`,
{
countries: { $size: 0 }
},
{
onLoad: function (items) {
return items.map(item => {
item.group_title = 'Undefined'
return item
})
}
}
)
@ -109,6 +125,14 @@ async function generateLanguages() {
`${PUBLIC_PATH}/languages/undefined.m3u`,
{
languages: { $size: 0 }
},
{
onLoad: function (items) {
return items.map(item => {
item.group_title = 'Undefined'
return item
})
}
}
)
@ -140,7 +164,15 @@ async function generateRegions() {
const { count: undefinedCount } = await generator.generate(
`${PUBLIC_PATH}/regions/undefined.m3u`,
{ regions: { $size: 0 } },
{ saveEmpty: true }
{
saveEmpty: true,
onLoad: function (items) {
return items.map(item => {
item.group_title = 'Undefined'
return item
})
}
}
)
await log('regions', {
@ -153,13 +185,50 @@ async function generateRegions() {
async function generateIndexNSFW() {
logger.info(`Generating index.nsfw.m3u...`)
await generator.generate(`${PUBLIC_PATH}/index.nsfw.m3u`, {}, { includeNSFW: true })
await generator.generate(
`${PUBLIC_PATH}/index.nsfw.m3u`,
{},
{
includeNSFW: true,
onLoad: function (items) {
return items.map(item => {
if (!item.categories || !item.categories.length) {
item.group_title = 'Other'
}
return item
})
},
sortBy: item => {
if (item.group_title === 'Other') return '_'
return item.group_title || ''
}
}
)
}
async function generateIndex() {
logger.info(`Generating index.m3u...`)
await generator.generate(`${PUBLIC_PATH}/index.m3u`, {})
await generator.generate(
`${PUBLIC_PATH}/index.m3u`,
{},
{
onLoad: function (items) {
return items.map(item => {
if (!item.categories || !item.categories.length) {
item.group_title = 'Other'
}
return item
})
},
sortBy: item => {
if (item.group_title === 'Other') return '_'
return item.group_title || ''
}
}
)
}
async function generateIndexCategory() {
@ -168,19 +237,22 @@ async function generateIndexCategory() {
await generator.generate(
`${PUBLIC_PATH}/index.category.m3u`,
{},
{
{
onLoad: function (items) {
let results = items
.filter(item => !item.categories || !item.categories.length)
.map(item => {
const newItem = _.cloneDeep(item)
newItem.group_title = ''
newItem.group_title = 'Other'
return newItem
})
for (const category of _.sortBy(Object.values(categories), ['name'])) {
let filtered = items
.filter(item => {
return Array.isArray(item.categories) && item.categories.map(c => c.slug).includes(category.slug)
return (
Array.isArray(item.categories) &&
item.categories.map(c => c.slug).includes(category.slug)
)
})
.map(item => {
const newItem = _.cloneDeep(item)
@ -192,7 +264,11 @@ async function generateIndexCategory() {
return results
},
sortBy: item => item.group_title }
sortBy: item => {
if (item.group_title === 'Other') return '_'
return item.group_title
}
}
)
}
@ -208,14 +284,17 @@ async function generateIndexCountry() {
.filter(item => !item.countries || !item.countries.length)
.map(item => {
const newItem = _.cloneDeep(item)
newItem.group_title = ''
newItem.group_title = 'Undefined'
newItem.categories = []
return newItem
})
for (const country of _.sortBy(Object.values(countries), ['name'])) {
let filtered = items
.filter(item => {
return Array.isArray(item.countries) && item.countries.map(c => c.code).includes(country.code)
return (
Array.isArray(item.countries) &&
item.countries.map(c => c.code).includes(country.code)
)
})
.map(item => {
const newItem = _.cloneDeep(item)
@ -227,7 +306,10 @@ async function generateIndexCountry() {
return results
},
sortBy: item => item.group_title
sortBy: item => {
if (item.group_title === 'Undefined') return '_'
return item.group_title
}
}
)
}
@ -244,14 +326,17 @@ async function generateIndexLanguage() {
.filter(item => !item.languages || !item.languages.length)
.map(item => {
const newItem = _.cloneDeep(item)
newItem.group_title = ''
newItem.group_title = 'Undefined'
newItem.categories = []
return newItem
})
for (const language of languages) {
let filtered = items
.filter(item => {
return Array.isArray(item.languages) && item.languages.map(c => c.code).includes(language.code)
return (
Array.isArray(item.languages) &&
item.languages.map(c => c.code).includes(language.code)
)
})
.map(item => {
const newItem = _.cloneDeep(item)
@ -263,7 +348,10 @@ async function generateIndexLanguage() {
return results
},
sortBy: item => item.group_title
sortBy: item => {
if (item.group_title === 'Undefined') return '_'
return item.group_title
}
}
)
}
@ -280,7 +368,7 @@ async function generateIndexRegion() {
.filter(item => !item.regions.length)
.map(item => {
const newItem = _.cloneDeep(item)
newItem.group_title = ''
newItem.group_title = 'Undefined'
newItem.categories = []
return newItem
})
@ -299,7 +387,10 @@ async function generateIndexRegion() {
return results
},
sortBy: item => item.group_title
sortBy: item => {
if (item.group_title === 'Undefined') return '_'
return item.group_title
}
}
)
}
@ -307,16 +398,28 @@ async function generateIndexRegion() {
async function generateChannelsJson() {
logger.info('Generating channels.json...')
await generator.generate(`${PUBLIC_PATH}/channels.json`, {}, { format: 'json', includeNSFW: true, uniqBy: null })
await generator.generate(
`${PUBLIC_PATH}/channels.json`,
{},
{ format: 'json', includeNSFW: true, uniqBy: null }
)
}
async function setUp() {
logger.info(`Loading database...`)
const items = await db.find({})
categories = _.sortBy(_.uniqBy(_.flatten(items.map(i => i.categories)), 'slug'), ['name']).filter(i => i)
countries = _.sortBy(_.uniqBy(_.flatten(items.map(i => i.countries)), 'code'), ['name']).filter(i => i)
languages = _.sortBy(_.uniqBy(_.flatten(items.map(i => i.languages)), 'code'), ['name']).filter(i => i)
regions = _.sortBy(_.uniqBy(_.flatten(items.map(i => i.regions)), 'code'), ['name']).filter(i => i)
categories = _.sortBy(_.uniqBy(_.flatten(items.map(i => i.categories)), 'slug'), ['name']).filter(
i => i
)
countries = _.sortBy(_.uniqBy(_.flatten(items.map(i => i.countries)), 'code'), ['name']).filter(
i => i
)
languages = _.sortBy(_.uniqBy(_.flatten(items.map(i => i.languages)), 'code'), ['name']).filter(
i => i
)
regions = _.sortBy(_.uniqBy(_.flatten(items.map(i => i.regions)), 'code'), ['name']).filter(
i => i
)
const categoriesLog = `${LOGS_PATH}/generate-playlists/categories.log`
const countriesLog = `${LOGS_PATH}/generate-playlists/countries.log`

View File

@ -0,0 +1,3 @@
#EXTM3U x-tvg-url=""
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="Other",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8

View File

@ -1 +1 @@
[{"name":"BBC News HD","logo":"https://i.imgur.com/eNPIQ9f.png","url":"http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8","categories":[{"name":"News","slug":"news"}],"countries":[{"name":"United Kingdom","code":"UK"}],"languages":[{"name":"English","code":"eng"}],"tvg":{"id":"BBCNews.uk","name":"BBC News HD","url":""}},{"name":"BBC News HD","logo":"https://i.imgur.com/eNPIQ9f.png","url":"http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/playlist.m3u8","categories":[{"name":"News","slug":"news"}],"countries":[{"name":"United Kingdom","code":"UK"}],"languages":[{"name":"English","code":"eng"}],"tvg":{"id":"BBCNews.uk","name":"BBC News HD","url":""}},{"name":"Daawah TV","logo":"","url":"http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8","categories":[{"name":"Religious","slug":"religious"}],"countries":[],"languages":[],"tvg":{"id":"","name":"Daawah TV","url":""}},{"name":"Tastemade","logo":"","url":"https://tastemade-freetv16min-plex.amagi.tv/hls/amagi_hls_data_tastemade-tastemadefreetv16-plex/CDN/playlist.m3u8","categories":[{"name":"Cooking","slug":"cooking"}],"countries":[{"name":"Andorra","code":"AD"},{"name":"Russia","code":"RU"},{"name":"United Kingdom","code":"UK"}],"languages":[],"tvg":{"id":"","name":"Tastemade","url":""}},{"name":"Visit-X TV","logo":"","url":"https://stream.visit-x.tv/vxtv/ngrp:live_all/playlist.m3u8","categories":[{"name":"XXX","slug":"xxx"}],"countries":[],"languages":[],"tvg":{"id":"","name":"Visit-X TV","url":""}},{"name":"ЛДПР ТВ","logo":"https://iptvx.one/icn/ldpr-tv.png","url":"http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8","categories":[{"name":"General","slug":"general"},{"name":"Legislative","slug":"legislative"}],"countries":[{"name":"Russia","code":"RU"}],"languages":[{"name":"Russian","code":"rus"}],"tvg":{"id":"LDPRTV.ru","name":"ЛДПР ТВ","url":"https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml"}}]
[{"name":"BBC News HD","logo":"https://i.imgur.com/eNPIQ9f.png","url":"http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8","categories":[{"name":"News","slug":"news"}],"countries":[{"name":"United Kingdom","code":"UK"}],"languages":[{"name":"English","code":"eng"}],"tvg":{"id":"BBCNews.uk","name":"BBC News HD","url":""}},{"name":"BBC News HD","logo":"https://i.imgur.com/eNPIQ9f.png","url":"http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/playlist.m3u8","categories":[{"name":"News","slug":"news"}],"countries":[{"name":"United Kingdom","code":"UK"}],"languages":[{"name":"English","code":"eng"}],"tvg":{"id":"BBCNews.uk","name":"BBC News HD","url":""}},{"name":"Daawah TV","logo":"","url":"http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8","categories":[],"countries":[],"languages":[],"tvg":{"id":"","name":"Daawah TV","url":""}},{"name":"Tastemade","logo":"","url":"https://tastemade-freetv16min-plex.amagi.tv/hls/amagi_hls_data_tastemade-tastemadefreetv16-plex/CDN/playlist.m3u8","categories":[{"name":"Cooking","slug":"cooking"}],"countries":[{"name":"Andorra","code":"AD"},{"name":"Russia","code":"RU"},{"name":"United Kingdom","code":"UK"}],"languages":[],"tvg":{"id":"","name":"Tastemade","url":""}},{"name":"Visit-X TV","logo":"","url":"https://stream.visit-x.tv/vxtv/ngrp:live_all/playlist.m3u8","categories":[{"name":"XXX","slug":"xxx"}],"countries":[],"languages":[],"tvg":{"id":"","name":"Visit-X TV","url":""}},{"name":"ЛДПР ТВ","logo":"https://iptvx.one/icn/ldpr-tv.png","url":"http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8","categories":[{"name":"General","slug":"general"},{"name":"Legislative","slug":"legislative"}],"countries":[{"name":"Russia","code":"RU"}],"languages":[{"name":"Russian","code":"rus"}],"tvg":{"id":"LDPRTV.ru","name":"ЛДПР ТВ","url":"https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml"}}]

View File

@ -0,0 +1,3 @@
#EXTM3U x-tvg-url=""
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="Undefined",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8

View File

@ -7,5 +7,5 @@ http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8
http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8
#EXTINF:-1 tvg-id="BBCNews.uk" tvg-country="UK" tvg-language="English" tvg-logo="https://i.imgur.com/eNPIQ9f.png" group-title="News",BBC News HD (720p) [Not 24/7]
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="Religious",Daawah TV
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="Other",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8

View File

@ -1,6 +1,4 @@
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml"
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="INT" tvg-language="" tvg-logo="" group-title="Andorra",Tastemade
https://tastemade-freetv16min-plex.amagi.tv/hls/amagi_hls_data_tastemade-tastemadefreetv16-plex/CDN/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="INT" tvg-language="" tvg-logo="" group-title="Russia",Tastemade
@ -11,3 +9,5 @@ http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
#EXTINF:-1 tvg-id="" tvg-country="INT" tvg-language="" tvg-logo="" group-title="United Kingdom",Tastemade
https://tastemade-freetv16min-plex.amagi.tv/hls/amagi_hls_data_tastemade-tastemadefreetv16-plex/CDN/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="Undefined",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8

View File

@ -1,9 +1,9 @@
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml"
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="INT" tvg-language="" tvg-logo="" group-title="",Tastemade
https://tastemade-freetv16min-plex.amagi.tv/hls/amagi_hls_data_tastemade-tastemadefreetv16-plex/CDN/playlist.m3u8
#EXTINF:-1 tvg-id="BBCNews.uk" tvg-country="UK" tvg-language="English" tvg-logo="https://i.imgur.com/eNPIQ9f.png" group-title="English",BBC News HD (720p) [Not 24/7]
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
#EXTINF:-1 tvg-id="LDPRTV.ru" tvg-country="RU" tvg-language="Russian" tvg-logo="https://iptvx.one/icn/ldpr-tv.png" group-title="Russian",ЛДПР ТВ (1080p)
http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="Undefined",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="INT" tvg-language="" tvg-logo="" group-title="Undefined",Tastemade
https://tastemade-freetv16min-plex.amagi.tv/hls/amagi_hls_data_tastemade-tastemadefreetv16-plex/CDN/playlist.m3u8

View File

@ -1,9 +1,9 @@
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml"
#EXTINF:-1 tvg-id="BBCNews.uk" tvg-country="UK" tvg-language="English" tvg-logo="https://i.imgur.com/eNPIQ9f.png" group-title="News",BBC News HD (720p) [Not 24/7]
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="Religious",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="INT" tvg-language="" tvg-logo="" group-title="Cooking",Tastemade
https://tastemade-freetv16min-plex.amagi.tv/hls/amagi_hls_data_tastemade-tastemadefreetv16-plex/CDN/playlist.m3u8
#EXTINF:-1 tvg-id="LDPRTV.ru" tvg-country="RU" tvg-language="Russian" tvg-logo="https://iptvx.one/icn/ldpr-tv.png" group-title="General;Legislative",ЛДПР ТВ (1080p)
http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="Other",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8

View File

@ -1,11 +1,11 @@
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml"
#EXTINF:-1 tvg-id="BBCNews.uk" tvg-country="UK" tvg-language="English" tvg-logo="https://i.imgur.com/eNPIQ9f.png" group-title="News",BBC News HD (720p) [Not 24/7]
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="Religious",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="INT" tvg-language="" tvg-logo="" group-title="Cooking",Tastemade
https://tastemade-freetv16min-plex.amagi.tv/hls/amagi_hls_data_tastemade-tastemadefreetv16-plex/CDN/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="XXX",Visit-X TV
https://stream.visit-x.tv/vxtv/ngrp:live_all/playlist.m3u8
#EXTINF:-1 tvg-id="LDPRTV.ru" tvg-country="RU" tvg-language="Russian" tvg-logo="https://iptvx.one/icn/ldpr-tv.png" group-title="General;Legislative",ЛДПР ТВ (1080p)
http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="Other",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8

View File

@ -1,6 +1,4 @@
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml"
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
#EXTINF:-1 tvg-id="LDPRTV.ru" tvg-country="RU" tvg-language="Russian" tvg-logo="https://iptvx.one/icn/ldpr-tv.png" group-title="Asia",ЛДПР ТВ (1080p)
http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8
#EXTINF:-1 tvg-id="LDPRTV.ru" tvg-country="RU" tvg-language="Russian" tvg-logo="https://iptvx.one/icn/ldpr-tv.png" group-title="Commonwealth of Independent States",ЛДПР ТВ (1080p)
@ -15,3 +13,5 @@ http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="INT" tvg-language="" tvg-logo="" group-title="Worldwide",Tastemade
https://tastemade-freetv16min-plex.amagi.tv/hls/amagi_hls_data_tastemade-tastemadefreetv16-plex/CDN/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="Undefined",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8

View File

@ -0,0 +1,5 @@
#EXTM3U x-tvg-url=""
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="Undefined",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="INT" tvg-language="" tvg-logo="" group-title="Undefined",Tastemade
https://tastemade-freetv16min-plex.amagi.tv/hls/amagi_hls_data_tastemade-tastemadefreetv16-plex/CDN/playlist.m3u8

View File

@ -0,0 +1,3 @@
#EXTM3U x-tvg-url=""
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="Undefined",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8

View File

@ -2,6 +2,5 @@
{"name":"General","slug":"general","count":1}
{"name":"Legislative","slug":"legislative","count":1}
{"name":"News","slug":"news","count":1}
{"name":"Religious","slug":"religious","count":1}
{"name":"XXX","slug":"xxx","count":1}
{"name":"Other","slug":"other","count":0}
{"name":"Other","slug":"other","count":1}

View File

@ -5,4 +5,4 @@
{"name":"BBC News HD","id":"AndorraTV.ad","filepath":"tests/__data__/output/channels/uk.m3u","src_country":{"name":"United Kingdom","code":"UK","lang":"eng"},"tvg_country":"UK","countries":[{"name":"United Kingdom","code":"UK","lang":"eng"}],"regions":[{"name":"Europe, the Middle East and Africa","code":"EMEA"},{"name":"Europe","code":"EUR"}],"languages":[{"name":"English","code":"eng"}],"categories":[{"name":"News","slug":"news","nsfw":false}],"tvg_url":"","guides":[],"logo":"https://i.imgur.com/eNPIQ9f.png","resolution":{"height":720,"width":null},"status":{"label":"Not 24/7","code":"not_247","level":3},"url":"http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8","http":{"referrer":"","user-agent":""},"is_nsfw":false,"is_broken":false,"updated":false,"cluster_id":3,"_id":"WTbieV1ptnZVCIdn"}
{"name":"Visit-X TV","id":"","filepath":"tests/__data__/output/channels/nl.m3u","src_country":{},"tvg_country":"","countries":[],"regions":[],"languages":[],"categories":[{"name":"XXX","slug":"xxx","nsfw":true}],"tvg_url":"","guides":[],"logo":"","resolution":{},"status":{"label":"","code":"online","level":1},"url":"https://stream.visit-x.tv/vxtv/ngrp:live_all/playlist.m3u8","http":{"referrer":"","user-agent":""},"is_nsfw":true,"is_broken":false,"updated":false,"cluster_id":1,"_id":"2ST8btby3mmsgPF5"}
{"name":"Tastemade","id":"","filepath":"tests/__data__/output/channels/qa.m3u","src_country":{},"tvg_country":"INT","countries":[{"name":"Andorra","code":"AD","lang":"cat"},{"name":"Russia","code":"RU","lang":"rus"},{"name":"United Kingdom","code":"UK","lang":"eng"}],"regions":[{"name":"Worldwide","code":"INT"}],"languages":[],"categories":[{"name":"Cooking","slug":"cooking","nsfw":false}],"tvg_url":"","guides":[],"logo":"","resolution":{},"status":{"label":"","code":"online","level":1},"url":"https://tastemade-freetv16min-plex.amagi.tv/hls/amagi_hls_data_tastemade-tastemadefreetv16-plex/CDN/playlist.m3u8","http":{"referrer":"","user-agent":""},"is_nsfw":false,"is_broken":false,"updated":false,"cluster_id":1,"_id":"2ST8btby3mmsgPAB"}
{"name":"Daawah TV","id":"","filepath":"tests/__data__/output/channels/in.m3u","src_country":{},"tvg_country":"","countries":[],"regions":[],"languages":[],"categories":[{"name":"Religious","slug":"religious","nsfw":false}],"tvg_url":"","guides":[],"logo":"","resolution":{},"status":{"label":"","code":"online","level":1},"url":"http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8","http":{"referrer":"","user-agent":""},"is_nsfw":false,"is_broken":false,"updated":false,"cluster_id":1,"_id":"2ST8btby3mmsgPF9"}
{"name":"Daawah TV","id":"","filepath":"tests/__data__/output/channels/in.m3u","src_country":{},"tvg_country":"","countries":[],"regions":[],"languages":[],"categories":[],"tvg_url":"","guides":[],"logo":"","resolution":{},"status":{"label":"","code":"online","level":1},"url":"http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8","http":{"referrer":"","user-agent":""},"is_nsfw":false,"is_broken":false,"updated":false,"cluster_id":1,"_id":"2ST8btby3mmsgPF9"}

View File

@ -24,100 +24,137 @@ afterEach(() => {
})
it('can generate categories', () => {
expect(content('output/.gh-pages/categories/general.m3u'))
.toBe(content('expected/.gh-pages/categories/general.m3u'))
expect(content('output/.gh-pages/categories/general.m3u')).toBe(
content('expected/.gh-pages/categories/general.m3u')
)
expect(content('output/.gh-pages/categories/legislative.m3u'))
.toBe(content('expected/.gh-pages/categories/legislative.m3u'))
expect(content('output/.gh-pages/categories/legislative.m3u')).toBe(
content('expected/.gh-pages/categories/legislative.m3u')
)
expect(content('output/.gh-pages/categories/news.m3u'))
.toBe(content('expected/.gh-pages/categories/news.m3u'))
expect(content('output/.gh-pages/categories/news.m3u')).toBe(
content('expected/.gh-pages/categories/news.m3u')
)
expect(content('output/.gh-pages/categories/other.m3u')).toBe(
content('expected/.gh-pages/categories/other.m3u')
)
})
it('can generate countries', () => {
expect(content('output/.gh-pages/countries/ru.m3u'))
.toBe(content('expected/.gh-pages/countries/ru.m3u'))
expect(content('output/.gh-pages/countries/ru.m3u')).toBe(
content('expected/.gh-pages/countries/ru.m3u')
)
expect(content('output/.gh-pages/countries/uk.m3u'))
.toBe(content('expected/.gh-pages/countries/uk.m3u'))
expect(content('output/.gh-pages/countries/uk.m3u')).toBe(
content('expected/.gh-pages/countries/uk.m3u')
)
expect(content('output/.gh-pages/countries/undefined.m3u')).toBe(
content('expected/.gh-pages/countries/undefined.m3u')
)
})
it('can generate languages', () => {
expect(content('output/.gh-pages/languages/rus.m3u'))
.toBe(content('expected/.gh-pages/languages/rus.m3u'))
expect(content('output/.gh-pages/languages/rus.m3u')).toBe(
content('expected/.gh-pages/languages/rus.m3u')
)
expect(content('output/.gh-pages/languages/eng.m3u'))
.toBe(content('expected/.gh-pages/languages/eng.m3u'))
expect(content('output/.gh-pages/languages/eng.m3u')).toBe(
content('expected/.gh-pages/languages/eng.m3u')
)
expect(content('output/.gh-pages/languages/undefined.m3u')).toBe(
content('expected/.gh-pages/languages/undefined.m3u')
)
})
it('can generate regions', () => {
expect(content('output/.gh-pages/regions/asia.m3u'))
.toBe(content('expected/.gh-pages/regions/asia.m3u'))
expect(content('output/.gh-pages/regions/asia.m3u')).toBe(
content('expected/.gh-pages/regions/asia.m3u')
)
expect(content('output/.gh-pages/regions/cis.m3u'))
.toBe(content('expected/.gh-pages/regions/cis.m3u'))
expect(content('output/.gh-pages/regions/cis.m3u')).toBe(
content('expected/.gh-pages/regions/cis.m3u')
)
expect(content('output/.gh-pages/regions/emea.m3u'))
.toBe(content('expected/.gh-pages/regions/emea.m3u'))
expect(content('output/.gh-pages/regions/emea.m3u')).toBe(
content('expected/.gh-pages/regions/emea.m3u')
)
expect(content('output/.gh-pages/regions/eur.m3u'))
.toBe(content('expected/.gh-pages/regions/eur.m3u'))
expect(content('output/.gh-pages/regions/eur.m3u')).toBe(
content('expected/.gh-pages/regions/eur.m3u')
)
expect(content('output/.gh-pages/regions/int.m3u'))
.toBe(content('expected/.gh-pages/regions/int.m3u'))
expect(content('output/.gh-pages/regions/int.m3u')).toBe(
content('expected/.gh-pages/regions/int.m3u')
)
expect(content('output/.gh-pages/regions/undefined.m3u')).toBe(
content('expected/.gh-pages/regions/undefined.m3u')
)
})
it('can generate channels.json', () => {
expect(content('output/.gh-pages/channels.json'))
.toBe(content('expected/.gh-pages/channels.json'))
expect(content('output/.gh-pages/channels.json')).toBe(
content('expected/.gh-pages/channels.json')
)
})
it('can generate index.category.m3u', () => {
expect(content('output/.gh-pages/index.category.m3u'))
.toBe(content('expected/.gh-pages/index.category.m3u'))
expect(content('output/.gh-pages/index.category.m3u')).toBe(
content('expected/.gh-pages/index.category.m3u')
)
})
it('can generate index.country.m3u', () => {
expect(content('output/.gh-pages/index.country.m3u'))
.toBe(content('expected/.gh-pages/index.country.m3u'))
expect(content('output/.gh-pages/index.country.m3u')).toBe(
content('expected/.gh-pages/index.country.m3u')
)
})
it('can generate index.language.m3u', () => {
expect(content('output/.gh-pages/index.language.m3u'))
.toBe(content('expected/.gh-pages/index.language.m3u'))
expect(content('output/.gh-pages/index.language.m3u')).toBe(
content('expected/.gh-pages/index.language.m3u')
)
})
it('can generate index.region.m3u', () => {
expect(content('output/.gh-pages/index.region.m3u'))
.toBe(content('expected/.gh-pages/index.region.m3u'))
expect(content('output/.gh-pages/index.region.m3u')).toBe(
content('expected/.gh-pages/index.region.m3u')
)
})
it('can generate index.m3u', () => {
expect(content('output/.gh-pages/index.m3u'))
.toBe(content('expected/.gh-pages/index.m3u'))
expect(content('output/.gh-pages/index.m3u')).toBe(content('expected/.gh-pages/index.m3u'))
})
it('can generate index.nsfw.m3u', () => {
expect(content('output/.gh-pages/index.nsfw.m3u'))
.toBe(content('expected/.gh-pages/index.nsfw.m3u'))
expect(content('output/.gh-pages/index.nsfw.m3u')).toBe(
content('expected/.gh-pages/index.nsfw.m3u')
)
})
it('can generate logs categories', () => {
expect(content('output/logs/generate-playlists/categories.log'))
.toBe(content('expected/logs/generate-playlists/categories.log'))
expect(content('output/logs/generate-playlists/categories.log')).toBe(
content('expected/logs/generate-playlists/categories.log')
)
})
it('can generate logs countries', () => {
expect(content('output/logs/generate-playlists/countries.log'))
.toBe(content('expected/logs/generate-playlists/countries.log'))
expect(content('output/logs/generate-playlists/countries.log')).toBe(
content('expected/logs/generate-playlists/countries.log')
)
})
it('can generate logs languages', () => {
expect(content('output/logs/generate-playlists/languages.log'))
.toBe(content('expected/logs/generate-playlists/languages.log'))
expect(content('output/logs/generate-playlists/languages.log')).toBe(
content('expected/logs/generate-playlists/languages.log')
)
})
it('can generate logs regions', () => {
expect(content('output/logs/generate-playlists/regions.log'))
.toBe(content('expected/logs/generate-playlists/regions.log'))
expect(content('output/logs/generate-playlists/regions.log')).toBe(
content('expected/logs/generate-playlists/regions.log')
)
})