This commit is contained in:
Aleksandr Statciuk 2022-02-07 01:22:20 +03:00
parent 109deb476d
commit bad3eddf9d
25 changed files with 453 additions and 447 deletions

View File

@ -5,12 +5,11 @@ const _ = require('lodash')
async function main() {
const streams = await loadStreams()
logger.info(`generating categories/...`)
await generator.generate('categories', streams)
await generator.generate('countries', streams)
await generator.generate('languages', streams)
await generator.generate('regions', streams)
// await generateCountries(streams)
// await generateLanguages()
// await generateRegions()
// await generateIndex()
// await generateIndexNSFW()
@ -26,143 +25,44 @@ async function main() {
main()
async function generateCountries(streams) {
logger.info(`generating countries/...`)
const countries = await loadCountries()
const regions = await loadRegions()
for (const country of countries) {
let areaCodes = _.filter(regions, { countries: [country.code] }).map(r => r.code)
areaCodes.push(country.code)
const { count, items } = await generator.generate(
`${PUBLIC_PATH}/countries/${country.code.toLowerCase()}.m3u`,
streams,
{
public: true,
filter: s => _.intersection(areaCodes, s.broadcast_area).length
}
)
// async function generateRegions() {
// logger.info(`Generating regions/...`)
log.countries.push({
name: country.name,
code: country.code,
count
})
}
// for (const region of regions) {
// const { count } = await generator.generate(
// `${PUBLIC_PATH}/regions/${region.code.toLowerCase()}.m3u`,
// {
// regions: { $elemMatch: region }
// }
// )
const { count } = await generator.generate(`${PUBLIC_PATH}/countries/undefined.m3u`, streams, {
public: true,
filter: s => !s.broadcast_area.length,
onLoad: items => {
return items.map(item => {
item.group_title = 'Undefined'
return item
})
}
})
// await log('regions', {
// name: region.name,
// code: region.code,
// count
// })
// }
log.countries.push({
name: 'Undefined',
id: 'UNDEFINED',
count
})
// const { count: undefinedCount } = await generator.generate(
// `${PUBLIC_PATH}/regions/undefined.m3u`,
// { regions: { $size: 0 } },
// {
// saveEmpty: true,
// onLoad: function (items) {
// return items.map(item => {
// item.group_title = 'Undefined'
// return item
// })
// }
// }
// )
// const { count: undefinedCount } = await generator.generate(
// `${PUBLIC_PATH}/countries/undefined.m3u`,
// {
// countries: { $size: 0 }
// },
// {
// onLoad: function (items) {
// return items.map(item => {
// item.group_title = 'Undefined'
// return item
// })
// }
// }
// )
// await log('countries', {
// name: 'Undefined',
// code: 'UNDEFINED',
// count: undefinedCount
// })
}
async function generateLanguages() {
logger.info(`Generating languages/...`)
for (const language of _.uniqBy(languages, 'code')) {
const { count } = await generator.generate(`${PUBLIC_PATH}/languages/${language.code}.m3u`, {
languages: { $elemMatch: language }
})
await log('languages', {
name: language.name,
code: language.code,
count
})
}
const { count: undefinedCount } = await generator.generate(
`${PUBLIC_PATH}/languages/undefined.m3u`,
{
languages: { $size: 0 }
},
{
onLoad: function (items) {
return items.map(item => {
item.group_title = 'Undefined'
return item
})
}
}
)
await log('languages', {
name: 'Undefined',
code: 'undefined',
count: undefinedCount
})
}
async function generateRegions() {
logger.info(`Generating regions/...`)
for (const region of regions) {
const { count } = await generator.generate(
`${PUBLIC_PATH}/regions/${region.code.toLowerCase()}.m3u`,
{
regions: { $elemMatch: region }
}
)
await log('regions', {
name: region.name,
code: region.code,
count
})
}
const { count: undefinedCount } = await generator.generate(
`${PUBLIC_PATH}/regions/undefined.m3u`,
{ regions: { $size: 0 } },
{
saveEmpty: true,
onLoad: function (items) {
return items.map(item => {
item.group_title = 'Undefined'
return item
})
}
}
)
await log('regions', {
name: 'Undefined',
code: 'UNDEFINED',
count: undefinedCount
})
}
// await log('regions', {
// name: 'Undefined',
// code: 'UNDEFINED',
// count: undefinedCount
// })
// }
async function generateIndexNSFW() {
logger.info(`Generating index.nsfw.m3u...`)

View File

@ -2,6 +2,7 @@ const { create: createPlaylist } = require('./playlist')
const logger = require('./logger')
const file = require('./file')
const generators = require('../generators')
const _ = require('lodash')
const PUBLIC_DIR = process.env.PUBLIC_DIR || '.gh-pages'
const LOGS_DIR = process.env.LOGS_DIR || 'scripts/logs/generators'
@ -11,6 +12,12 @@ const generator = {}
generator.generate = async function (name, items = []) {
if (typeof generators[name] === 'function') {
try {
items = _.orderBy(
items,
['channel.name', 'status.level', 'resolution.height'],
['asc', 'asc', 'desc']
)
items = _.uniqBy(items, s => s.channel_id || _.uniqueId())
const output = await generators[name].bind()(items)
await file.create(`${LOGS_DIR}/${name}.log`, output.map(toJSON).join('\n'))
for (const type of output) {

View File

@ -2,12 +2,6 @@ const api = require('../core/api')
const _ = require('lodash')
module.exports = async function (streams = []) {
streams = _.orderBy(
streams,
['channel.name', 'status.level', 'resolution.height'],
['asc', 'asc', 'desc']
)
streams = _.uniqBy(streams, s => s.channel_id || _.uniqueId())
const output = []
await api.categories.load()
const categories = await api.categories.all()
@ -17,11 +11,7 @@ module.exports = async function (streams = []) {
}
let items = _.filter(streams, s => !s.categories.length)
items = items.map(item => {
item.group_title = 'Other'
return item
})
output.push({ id: 'other', items })
output.push({ id: 'undefined', items })
return output
}

View File

@ -0,0 +1,21 @@
const api = require('../core/api')
const _ = require('lodash')
module.exports = async function (streams = []) {
const output = []
await api.countries.load()
const countries = await api.countries.all()
await api.regions.load()
const regions = await api.regions.all()
for (const country of countries) {
const areaCodes = _.filter(regions, { countries: [country.code] }).map(r => r.code)
areaCodes.push(country.code)
let items = _.filter(streams, s => _.intersection(areaCodes, s.broadcast_area).length)
output.push({ id: country.code.toLowerCase(), items })
}
let items = _.filter(streams, s => !s.broadcast_area.length)
output.push({ id: 'undefined', items })
return output
}

View File

@ -1 +1,4 @@
exports.categories = require('./categories')
exports.countries = require('./countries')
exports.languages = require('./languages')
exports.regions = require('./regions')

View File

@ -0,0 +1,20 @@
const api = require('../core/api')
const _ = require('lodash')
module.exports = async function (streams = []) {
const output = []
await api.languages.load()
let languages = await api.languages.all()
languages = _.uniqBy(languages, 'code')
for (const language of languages) {
let items = _.filter(streams, { channel: { languages: [language.code] } })
if (items.length) {
output.push({ id: language.code, items })
}
}
let items = _.filter(streams, s => !s.languages.length)
output.push({ id: 'undefined', items })
return output
}

View File

@ -0,0 +1,19 @@
const api = require('../core/api')
const _ = require('lodash')
module.exports = async function (streams = []) {
const output = []
await api.regions.load()
const regions = await api.regions.all()
for (const region of regions) {
const areaCodes = region.countries
areaCodes.push(region.code)
let items = _.filter(streams, s => _.intersection(areaCodes, s.broadcast_area).length)
output.push({ id: region.code.toLowerCase(), items })
}
let items = _.filter(streams, s => !s.broadcast_area.length)
output.push({ id: 'undefined', items })
return output
}

View File

@ -1,12 +1,12 @@
module.exports = function () {
if (this.group_title !== undefined) return this.group_title
if (Array.isArray(this.categories)) {
if (Array.isArray(this.categories) && this.categories.length) {
return this.categories
.map(i => i.name)
.sort()
.join(';')
}
return ''
return 'Undefined'
}

View File

@ -1,7 +1,7 @@
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ad/andorradifusio.ad.epg.xml"
#EXTINF:-1 tvg-id="AndorraTV.ad" tvg-country="AD" tvg-language="Valencian" tvg-logo="" group-title="Other",BBC News HD (720p) [Not 24/7]
#EXTINF:-1 tvg-id="AndorraTV.ad" tvg-country="AD" tvg-language="Valencian" tvg-logo="" group-title="Undefined",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="Other",Tastemade
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="Undefined",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="Other",Daawah TV
#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,3 @@
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ad/andorradifusio.ad.epg.xml"
#EXTINF:-1 tvg-id="AndorraTV.ad" tvg-country="AD" tvg-language="Valencian" tvg-logo="" group-title="Undefined",BBC News HD (720p) [Not 24/7]
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8

View File

@ -1,3 +1,3 @@
#EXTM3U x-tvg-url=""
#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
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ch/tv.blue.ch.epg.xml,https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml,https://iptv-org.github.io/epg/guides/uk/ontvtonight.com.epg.xml,https://iptv-org.github.io/epg/guides/uk/sky.com.epg.xml"
#EXTINF:-1 tvg-id="BBCNews.uk" tvg-country="INT" tvg-language="English" tvg-logo="https://raw.githubusercontent.com/Tapiosinn/tv-logos/master/countries/united-kingdom/bbc-news-uk.png" group-title="News",BBC News HD (720p) [Not 24/7]
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/playlist.m3u8

View File

@ -0,0 +1,3 @@
#EXTM3U x-tvg-url=""
#EXTINF:-1 tvg-id="VisitXTV.nl" tvg-country="INT" tvg-language="Flemish" tvg-logo="https://i.imgur.com/RJ9wbNF.jpg" group-title="XXX",Visit-X TV
https://stream.visit-x.tv/vxtv/ngrp:live_all/playlist.m3u8

View File

@ -1,3 +1,3 @@
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml"
#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)
#EXTINF:-1 tvg-id="LDPRTV.ru" tvg-country="RU" tvg-language="Russian" tvg-logo="https://iptvx.one/icn/ldpr-tv.png" group-title="General",ЛДПР ТВ (1080p)
http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8

View File

@ -1,5 +1,5 @@
#EXTM3U x-tvg-url=""
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="Undefined",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
#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,3 +1,3 @@
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml"
#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)
#EXTINF:-1 tvg-id="LDPRTV.ru" tvg-country="RU" tvg-language="Russian" tvg-logo="https://iptvx.one/icn/ldpr-tv.png" group-title="General",ЛДПР ТВ (1080p)
http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8

View File

@ -1,3 +1,3 @@
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml"
#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)
#EXTINF:-1 tvg-id="LDPRTV.ru" tvg-country="RU" tvg-language="Russian" tvg-logo="https://iptvx.one/icn/ldpr-tv.png" group-title="General",ЛДПР ТВ (1080p)
http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8

View File

@ -1,5 +1,5 @@
#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]
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ad/andorradifusio.ad.epg.xml,https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml"
#EXTINF:-1 tvg-id="AndorraTV.ad" tvg-country="AD" tvg-language="Valencian" tvg-logo="" group-title="Undefined",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="General;Legislative",ЛДПР ТВ (1080p)
#EXTINF:-1 tvg-id="LDPRTV.ru" tvg-country="RU" tvg-language="Russian" tvg-logo="https://iptvx.one/icn/ldpr-tv.png" group-title="General",ЛДПР ТВ (1080p)
http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8

View File

@ -1,5 +1,5 @@
#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]
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ad/andorradifusio.ad.epg.xml,https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml"
#EXTINF:-1 tvg-id="AndorraTV.ad" tvg-country="AD" tvg-language="Valencian" tvg-logo="" group-title="Undefined",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="General;Legislative",ЛДПР ТВ (1080p)
#EXTINF:-1 tvg-id="LDPRTV.ru" tvg-country="RU" tvg-language="Russian" tvg-logo="https://iptvx.one/icn/ldpr-tv.png" group-title="General",ЛДПР ТВ (1080p)
http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8

View File

@ -1,3 +1,9 @@
#EXTM3U x-tvg-url=""
#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
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ad/andorradifusio.ad.epg.xml,https://iptv-org.github.io/epg/guides/ch/tv.blue.ch.epg.xml,https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml,https://iptv-org.github.io/epg/guides/uk/ontvtonight.com.epg.xml,https://iptv-org.github.io/epg/guides/uk/sky.com.epg.xml"
#EXTINF:-1 tvg-id="AndorraTV.ad" tvg-country="AD" tvg-language="Valencian" tvg-logo="" group-title="Undefined",BBC News HD (720p) [Not 24/7]
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
#EXTINF:-1 tvg-id="BBCNews.uk" tvg-country="INT" tvg-language="English" tvg-logo="https://raw.githubusercontent.com/Tapiosinn/tv-logos/master/countries/united-kingdom/bbc-news-uk.png" group-title="News",BBC News HD (720p) [Not 24/7]
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/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",ЛДПР ТВ (1080p)
http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8
#EXTINF:-1 tvg-id="VisitXTV.nl" tvg-country="INT" tvg-language="Flemish" tvg-logo="https://i.imgur.com/RJ9wbNF.jpg" group-title="XXX",Visit-X TV
https://stream.visit-x.tv/vxtv/ngrp:live_all/playlist.m3u8

View File

@ -1,3 +1,5 @@
#EXTM3U x-tvg-url=""
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="Undefined",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

@ -26,4 +26,4 @@
{"id":"travel","count":0}
{"id":"weather","count":0}
{"id":"xxx","count":1}
{"id":"other","count":3}
{"id":"undefined","count":3}

View File

@ -1,251 +1,251 @@
{"name":"Afghanistan","code":"AF","count":2}
{"name":"Albania","code":"AL","count":2}
{"name":"Algeria","code":"DZ","count":2}
{"name":"American Samoa","code":"AS","count":2}
{"name":"Andorra","code":"AD","count":3}
{"name":"Angola","code":"AO","count":2}
{"name":"Anguilla","code":"AI","count":2}
{"name":"Antarctica","code":"AQ","count":2}
{"name":"Antigua and Barbuda","code":"AG","count":2}
{"name":"Argentina","code":"AR","count":2}
{"name":"Armenia","code":"AM","count":2}
{"name":"Aruba","code":"AW","count":2}
{"name":"Australia","code":"AU","count":2}
{"name":"Austria","code":"AT","count":2}
{"name":"Azerbaijan","code":"AZ","count":2}
{"name":"Bahamas","code":"BS","count":2}
{"name":"Bahrain","code":"BH","count":2}
{"name":"Bangladesh","code":"BD","count":2}
{"name":"Barbados","code":"BB","count":2}
{"name":"Belarus","code":"BY","count":2}
{"name":"Belgium","code":"BE","count":2}
{"name":"Belize","code":"BZ","count":2}
{"name":"Benin","code":"BJ","count":2}
{"name":"Bermuda","code":"BM","count":2}
{"name":"Bhutan","code":"BT","count":2}
{"name":"Bolivia","code":"BO","count":2}
{"name":"Bonaire","code":"BQ","count":2}
{"name":"Bosnia and Herzegovina","code":"BA","count":2}
{"name":"Botswana","code":"BW","count":2}
{"name":"Bouvet Island","code":"BV","count":2}
{"name":"Brazil","code":"BR","count":2}
{"name":"British Indian Ocean Territory","code":"IO","count":2}
{"name":"British Virgin Islands","code":"VG","count":2}
{"name":"Brunei","code":"BN","count":2}
{"name":"Bulgaria","code":"BG","count":2}
{"name":"Burkina Faso","code":"BF","count":2}
{"name":"Burundi","code":"BI","count":2}
{"name":"Cambodia","code":"KH","count":2}
{"name":"Cameroon","code":"CM","count":2}
{"name":"Canada","code":"CA","count":2}
{"name":"Cape Verde","code":"CV","count":2}
{"name":"Cayman Islands","code":"KY","count":2}
{"name":"Central African Republic","code":"CF","count":2}
{"name":"Chad","code":"TD","count":2}
{"name":"Chile","code":"CL","count":2}
{"name":"China","code":"CN","count":2}
{"name":"Christmas Island","code":"CX","count":2}
{"name":"Cocos (Keeling) Islands","code":"CC","count":2}
{"name":"Colombia","code":"CO","count":2}
{"name":"Comoros","code":"KM","count":2}
{"name":"Cook Islands","code":"CK","count":2}
{"name":"Costa Rica","code":"CR","count":2}
{"name":"Croatia","code":"HR","count":2}
{"name":"Cuba","code":"CU","count":2}
{"name":"Curacao","code":"CW","count":2}
{"name":"Cyprus","code":"CY","count":2}
{"name":"Czech Republic","code":"CZ","count":2}
{"name":"Democratic Republic of the Congo","code":"CD","count":2}
{"name":"Denmark","code":"DK","count":2}
{"name":"Djibouti","code":"DJ","count":2}
{"name":"Dominica","code":"DM","count":2}
{"name":"Dominican Republic","code":"DO","count":2}
{"name":"East Timor","code":"TL","count":2}
{"name":"Ecuador","code":"EC","count":2}
{"name":"Egypt","code":"EG","count":2}
{"name":"El Salvador","code":"SV","count":2}
{"name":"Equatorial Guinea","code":"GQ","count":2}
{"name":"Eritrea","code":"ER","count":2}
{"name":"Estonia","code":"EE","count":2}
{"name":"Ethiopia","code":"ET","count":2}
{"name":"Falkland Islands","code":"FK","count":2}
{"name":"Faroe Islands","code":"FO","count":2}
{"name":"Fiji","code":"FJ","count":2}
{"name":"Finland","code":"FI","count":2}
{"name":"France","code":"FR","count":2}
{"name":"French Guiana","code":"GF","count":2}
{"name":"French Polynesia","code":"PF","count":2}
{"name":"French Southern Territories","code":"TF","count":2}
{"name":"Gabon","code":"GA","count":2}
{"name":"Gambia","code":"GM","count":2}
{"name":"Georgia","code":"GE","count":2}
{"name":"Germany","code":"DE","count":2}
{"name":"Ghana","code":"GH","count":2}
{"name":"Gibraltar","code":"GI","count":2}
{"name":"Greece","code":"GR","count":2}
{"name":"Greenland","code":"GL","count":2}
{"name":"Grenada","code":"GD","count":2}
{"name":"Guadeloupe","code":"GP","count":2}
{"name":"Guam","code":"GU","count":2}
{"name":"Guatemala","code":"GT","count":2}
{"name":"Guernsey","code":"GG","count":2}
{"name":"Guinea","code":"GN","count":2}
{"name":"Guinea-Bissau","code":"GW","count":2}
{"name":"Guyana","code":"GY","count":2}
{"name":"Haiti","code":"HT","count":2}
{"name":"Heard Island and McDonald Islands","code":"HM","count":2}
{"name":"Honduras","code":"HN","count":2}
{"name":"Hong Kong","code":"HK","count":2}
{"name":"Hungary","code":"HU","count":2}
{"name":"Iceland","code":"IS","count":2}
{"name":"India","code":"IN","count":2}
{"name":"Indonesia","code":"ID","count":2}
{"name":"Iran","code":"IR","count":2}
{"name":"Iraq","code":"IQ","count":2}
{"name":"Ireland","code":"IE","count":2}
{"name":"Isle of Man","code":"IM","count":2}
{"name":"Israel","code":"IL","count":2}
{"name":"Italy","code":"IT","count":2}
{"name":"Ivory Coast","code":"CI","count":2}
{"name":"Jamaica","code":"JM","count":2}
{"name":"Japan","code":"JP","count":2}
{"name":"Jersey","code":"JE","count":2}
{"name":"Jordan","code":"JO","count":2}
{"name":"Kazakhstan","code":"KZ","count":2}
{"name":"Kenya","code":"KE","count":2}
{"name":"Kiribati","code":"KI","count":2}
{"name":"Kosovo","code":"XK","count":2}
{"name":"Kuwait","code":"KW","count":2}
{"name":"Kyrgyzstan","code":"KG","count":2}
{"name":"Laos","code":"LA","count":2}
{"name":"Latvia","code":"LV","count":2}
{"name":"Lebanon","code":"LB","count":2}
{"name":"Lesotho","code":"LS","count":2}
{"name":"Liberia","code":"LR","count":2}
{"name":"Libya","code":"LY","count":2}
{"name":"Liechtenstein","code":"LI","count":2}
{"name":"Lithuania","code":"LT","count":2}
{"name":"Luxembourg","code":"LU","count":2}
{"name":"Macao","code":"MO","count":2}
{"name":"Madagascar","code":"MG","count":2}
{"name":"Malawi","code":"MW","count":2}
{"name":"Malaysia","code":"MY","count":2}
{"name":"Maldives","code":"MV","count":2}
{"name":"Mali","code":"ML","count":2}
{"name":"Malta","code":"MT","count":2}
{"name":"Marshall Islands","code":"MH","count":2}
{"name":"Martinique","code":"MQ","count":2}
{"name":"Mauritania","code":"MR","count":2}
{"name":"Mauritius","code":"MU","count":2}
{"name":"Mayotte","code":"YT","count":2}
{"name":"Mexico","code":"MX","count":2}
{"name":"Micronesia","code":"FM","count":2}
{"name":"Moldova","code":"MD","count":2}
{"name":"Monaco","code":"MC","count":2}
{"name":"Mongolia","code":"MN","count":2}
{"name":"Montenegro","code":"ME","count":2}
{"name":"Montserrat","code":"MS","count":2}
{"name":"Morocco","code":"MA","count":2}
{"name":"Mozambique","code":"MZ","count":2}
{"name":"Myanmar (Burma)","code":"MM","count":2}
{"name":"Namibia","code":"NA","count":2}
{"name":"Nauru","code":"NR","count":2}
{"name":"Nepal","code":"NP","count":2}
{"name":"Netherlands","code":"NL","count":2}
{"name":"New Caledonia","code":"NC","count":2}
{"name":"New Zealand","code":"NZ","count":2}
{"name":"Nicaragua","code":"NI","count":2}
{"name":"Niger","code":"NE","count":2}
{"name":"Nigeria","code":"NG","count":2}
{"name":"Niue","code":"NU","count":2}
{"name":"Norfolk Island","code":"NF","count":2}
{"name":"North Korea","code":"KP","count":2}
{"name":"North Macedonia","code":"MK","count":2}
{"name":"Northern Mariana Islands","code":"MP","count":2}
{"name":"Norway","code":"NO","count":2}
{"name":"Oman","code":"OM","count":2}
{"name":"Pakistan","code":"PK","count":2}
{"name":"Palau","code":"PW","count":2}
{"name":"Palestine","code":"PS","count":2}
{"name":"Panama","code":"PA","count":2}
{"name":"Papua New Guinea","code":"PG","count":2}
{"name":"Paraguay","code":"PY","count":2}
{"name":"Peru","code":"PE","count":2}
{"name":"Philippines","code":"PH","count":2}
{"name":"Pitcairn Islands","code":"PN","count":2}
{"name":"Poland","code":"PL","count":2}
{"name":"Portugal","code":"PT","count":2}
{"name":"Puerto Rico","code":"PR","count":2}
{"name":"Qatar","code":"QA","count":2}
{"name":"Republic of the Congo","code":"CG","count":2}
{"name":"Romania","code":"RO","count":2}
{"name":"Russia","code":"RU","count":3}
{"name":"Rwanda","code":"RW","count":2}
{"name":"Réunion","code":"RE","count":2}
{"name":"Saint Barthélemy","code":"BL","count":2}
{"name":"Saint Helena","code":"SH","count":2}
{"name":"Saint Kitts and Nevis","code":"KN","count":2}
{"name":"Saint Lucia","code":"LC","count":2}
{"name":"Saint Martin","code":"MF","count":2}
{"name":"Saint Pierre and Miquelon","code":"PM","count":2}
{"name":"Saint Vincent and the Grenadines","code":"VC","count":2}
{"name":"Samoa","code":"WS","count":2}
{"name":"San Marino","code":"SM","count":2}
{"name":"Saudi Arabia","code":"SA","count":2}
{"name":"Senegal","code":"SN","count":2}
{"name":"Serbia","code":"RS","count":2}
{"name":"Seychelles","code":"SC","count":2}
{"name":"Sierra Leone","code":"SL","count":2}
{"name":"Singapore","code":"SG","count":2}
{"name":"Sint Maarten","code":"SX","count":2}
{"name":"Slovakia","code":"SK","count":2}
{"name":"Slovenia","code":"SI","count":2}
{"name":"Solomon Islands","code":"SB","count":2}
{"name":"Somalia","code":"SO","count":2}
{"name":"South Africa","code":"ZA","count":2}
{"name":"South Georgia and the South Sandwich Islands","code":"GS","count":2}
{"name":"South Korea","code":"KR","count":2}
{"name":"South Sudan","code":"SS","count":2}
{"name":"Spain","code":"ES","count":2}
{"name":"Sri Lanka","code":"LK","count":2}
{"name":"Sudan","code":"SD","count":2}
{"name":"Suriname","code":"SR","count":2}
{"name":"Svalbard and Jan Mayen","code":"SJ","count":2}
{"name":"Swaziland","code":"SZ","count":2}
{"name":"Sweden","code":"SE","count":2}
{"name":"Switzerland","code":"CH","count":2}
{"name":"Syria","code":"SY","count":2}
{"name":"São Tomé and Príncipe","code":"ST","count":2}
{"name":"Taiwan","code":"TW","count":2}
{"name":"Tajikistan","code":"TJ","count":2}
{"name":"Tanzania","code":"TZ","count":2}
{"name":"Thailand","code":"TH","count":2}
{"name":"Togo","code":"TG","count":2}
{"name":"Tokelau","code":"TK","count":2}
{"name":"Tonga","code":"TO","count":2}
{"name":"Trinidad and Tobago","code":"TT","count":2}
{"name":"Tunisia","code":"TN","count":2}
{"name":"Turkey","code":"TR","count":2}
{"name":"Turkmenistan","code":"TM","count":2}
{"name":"Turks and Caicos Islands","code":"TC","count":2}
{"name":"Tuvalu","code":"TV","count":2}
{"name":"U.S. Minor Outlying Islands","code":"UM","count":2}
{"name":"U.S. Virgin Islands","code":"VI","count":2}
{"name":"Uganda","code":"UG","count":2}
{"name":"Ukraine","code":"UA","count":2}
{"name":"United Arab Emirates","code":"AE","count":2}
{"name":"United Kingdom","code":"UK","count":2}
{"name":"United States","code":"US","count":2}
{"name":"Uruguay","code":"UY","count":2}
{"name":"Uzbekistan","code":"UZ","count":2}
{"name":"Vanuatu","code":"VU","count":2}
{"name":"Vatican City","code":"VA","count":2}
{"name":"Venezuela","code":"VE","count":2}
{"name":"Vietnam","code":"VN","count":2}
{"name":"Wallis and Futuna","code":"WF","count":2}
{"name":"Western Sahara","code":"EH","count":2}
{"name":"Yemen","code":"YE","count":2}
{"name":"Zambia","code":"ZM","count":2}
{"name":"Zimbabwe","code":"ZW","count":2}
{"name":"Åland","code":"AX","count":2}
{"name":"Undefined","id":"UNDEFINED","count":2}
{"id":"af","count":2}
{"id":"al","count":2}
{"id":"dz","count":2}
{"id":"as","count":2}
{"id":"ad","count":3}
{"id":"ao","count":2}
{"id":"ai","count":2}
{"id":"aq","count":2}
{"id":"ag","count":2}
{"id":"ar","count":2}
{"id":"am","count":2}
{"id":"aw","count":2}
{"id":"au","count":2}
{"id":"at","count":2}
{"id":"az","count":2}
{"id":"bs","count":2}
{"id":"bh","count":2}
{"id":"bd","count":2}
{"id":"bb","count":2}
{"id":"by","count":2}
{"id":"be","count":2}
{"id":"bz","count":2}
{"id":"bj","count":2}
{"id":"bm","count":2}
{"id":"bt","count":2}
{"id":"bo","count":2}
{"id":"bq","count":2}
{"id":"ba","count":2}
{"id":"bw","count":2}
{"id":"bv","count":2}
{"id":"br","count":2}
{"id":"io","count":2}
{"id":"vg","count":2}
{"id":"bn","count":2}
{"id":"bg","count":2}
{"id":"bf","count":2}
{"id":"bi","count":2}
{"id":"kh","count":2}
{"id":"cm","count":2}
{"id":"ca","count":2}
{"id":"cv","count":2}
{"id":"ky","count":2}
{"id":"cf","count":2}
{"id":"td","count":2}
{"id":"cl","count":2}
{"id":"cn","count":2}
{"id":"cx","count":2}
{"id":"cc","count":2}
{"id":"co","count":2}
{"id":"km","count":2}
{"id":"ck","count":2}
{"id":"cr","count":2}
{"id":"hr","count":2}
{"id":"cu","count":2}
{"id":"cw","count":2}
{"id":"cy","count":2}
{"id":"cz","count":2}
{"id":"cd","count":2}
{"id":"dk","count":2}
{"id":"dj","count":2}
{"id":"dm","count":2}
{"id":"do","count":2}
{"id":"tl","count":2}
{"id":"ec","count":2}
{"id":"eg","count":2}
{"id":"sv","count":2}
{"id":"gq","count":2}
{"id":"er","count":2}
{"id":"ee","count":2}
{"id":"et","count":2}
{"id":"fk","count":2}
{"id":"fo","count":2}
{"id":"fj","count":2}
{"id":"fi","count":2}
{"id":"fr","count":2}
{"id":"gf","count":2}
{"id":"pf","count":2}
{"id":"tf","count":2}
{"id":"ga","count":2}
{"id":"gm","count":2}
{"id":"ge","count":2}
{"id":"de","count":2}
{"id":"gh","count":2}
{"id":"gi","count":2}
{"id":"gr","count":2}
{"id":"gl","count":2}
{"id":"gd","count":2}
{"id":"gp","count":2}
{"id":"gu","count":2}
{"id":"gt","count":2}
{"id":"gg","count":2}
{"id":"gn","count":2}
{"id":"gw","count":2}
{"id":"gy","count":2}
{"id":"ht","count":2}
{"id":"hm","count":2}
{"id":"hn","count":2}
{"id":"hk","count":2}
{"id":"hu","count":2}
{"id":"is","count":2}
{"id":"in","count":2}
{"id":"id","count":2}
{"id":"ir","count":2}
{"id":"iq","count":2}
{"id":"ie","count":2}
{"id":"im","count":2}
{"id":"il","count":2}
{"id":"it","count":2}
{"id":"ci","count":2}
{"id":"jm","count":2}
{"id":"jp","count":2}
{"id":"je","count":2}
{"id":"jo","count":2}
{"id":"kz","count":2}
{"id":"ke","count":2}
{"id":"ki","count":2}
{"id":"xk","count":2}
{"id":"kw","count":2}
{"id":"kg","count":2}
{"id":"la","count":2}
{"id":"lv","count":2}
{"id":"lb","count":2}
{"id":"ls","count":2}
{"id":"lr","count":2}
{"id":"ly","count":2}
{"id":"li","count":2}
{"id":"lt","count":2}
{"id":"lu","count":2}
{"id":"mo","count":2}
{"id":"mg","count":2}
{"id":"mw","count":2}
{"id":"my","count":2}
{"id":"mv","count":2}
{"id":"ml","count":2}
{"id":"mt","count":2}
{"id":"mh","count":2}
{"id":"mq","count":2}
{"id":"mr","count":2}
{"id":"mu","count":2}
{"id":"yt","count":2}
{"id":"mx","count":2}
{"id":"fm","count":2}
{"id":"md","count":2}
{"id":"mc","count":2}
{"id":"mn","count":2}
{"id":"me","count":2}
{"id":"ms","count":2}
{"id":"ma","count":2}
{"id":"mz","count":2}
{"id":"mm","count":2}
{"id":"na","count":2}
{"id":"nr","count":2}
{"id":"np","count":2}
{"id":"nl","count":2}
{"id":"nc","count":2}
{"id":"nz","count":2}
{"id":"ni","count":2}
{"id":"ne","count":2}
{"id":"ng","count":2}
{"id":"nu","count":2}
{"id":"nf","count":2}
{"id":"kp","count":2}
{"id":"mk","count":2}
{"id":"mp","count":2}
{"id":"no","count":2}
{"id":"om","count":2}
{"id":"pk","count":2}
{"id":"pw","count":2}
{"id":"ps","count":2}
{"id":"pa","count":2}
{"id":"pg","count":2}
{"id":"py","count":2}
{"id":"pe","count":2}
{"id":"ph","count":2}
{"id":"pn","count":2}
{"id":"pl","count":2}
{"id":"pt","count":2}
{"id":"pr","count":2}
{"id":"qa","count":2}
{"id":"cg","count":2}
{"id":"ro","count":2}
{"id":"ru","count":3}
{"id":"rw","count":2}
{"id":"re","count":2}
{"id":"bl","count":2}
{"id":"sh","count":2}
{"id":"kn","count":2}
{"id":"lc","count":2}
{"id":"mf","count":2}
{"id":"pm","count":2}
{"id":"vc","count":2}
{"id":"ws","count":2}
{"id":"sm","count":2}
{"id":"sa","count":2}
{"id":"sn","count":2}
{"id":"rs","count":2}
{"id":"sc","count":2}
{"id":"sl","count":2}
{"id":"sg","count":2}
{"id":"sx","count":2}
{"id":"sk","count":2}
{"id":"si","count":2}
{"id":"sb","count":2}
{"id":"so","count":2}
{"id":"za","count":2}
{"id":"gs","count":2}
{"id":"kr","count":2}
{"id":"ss","count":2}
{"id":"es","count":2}
{"id":"lk","count":2}
{"id":"sd","count":2}
{"id":"sr","count":2}
{"id":"sj","count":2}
{"id":"sz","count":2}
{"id":"se","count":2}
{"id":"ch","count":2}
{"id":"sy","count":2}
{"id":"st","count":2}
{"id":"tw","count":2}
{"id":"tj","count":2}
{"id":"tz","count":2}
{"id":"th","count":2}
{"id":"tg","count":2}
{"id":"tk","count":2}
{"id":"to","count":2}
{"id":"tt","count":2}
{"id":"tn","count":2}
{"id":"tr","count":2}
{"id":"tm","count":2}
{"id":"tc","count":2}
{"id":"tv","count":2}
{"id":"um","count":2}
{"id":"vi","count":2}
{"id":"ug","count":2}
{"id":"ua","count":2}
{"id":"ae","count":2}
{"id":"uk","count":2}
{"id":"us","count":2}
{"id":"uy","count":2}
{"id":"uz","count":2}
{"id":"vu","count":2}
{"id":"va","count":2}
{"id":"ve","count":2}
{"id":"vn","count":2}
{"id":"wf","count":2}
{"id":"eh","count":2}
{"id":"ye","count":2}
{"id":"zm","count":2}
{"id":"zw","count":2}
{"id":"ax","count":2}
{"id":"undefined","count":2}

View File

@ -1,4 +1,5 @@
{"name":"Catalan","code":"cat","count":0}
{"name":"English","code":"eng","count":1}
{"name":"Russian","code":"rus","count":1}
{"name":"Undefined","code":"undefined","count":2}
{"id":"cat","count":1}
{"id":"eng","count":1}
{"id":"nld","count":1}
{"id":"rus","count":1}
{"id":"undefined","count":2}

View File

@ -1,6 +1,25 @@
{"name":"Asia","code":"ASIA","count":1}
{"name":"Commonwealth of Independent States","code":"CIS","count":1}
{"name":"Europe","code":"EUR","count":2}
{"name":"Europe, the Middle East and Africa","code":"EMEA","count":2}
{"name":"Worldwide","code":"INT","count":1}
{"name":"Undefined","code":"UNDEFINED","count":1}
{"id":"afr","count":0}
{"id":"amer","count":0}
{"id":"arab","count":0}
{"id":"asia","count":1}
{"id":"apac","count":0}
{"id":"carib","count":0}
{"id":"cas","count":0}
{"id":"cis","count":1}
{"id":"eur","count":2}
{"id":"emea","count":2}
{"id":"hispam","count":0}
{"id":"latam","count":0}
{"id":"lac","count":0}
{"id":"maghreb","count":0}
{"id":"mideast","count":0}
{"id":"mena","count":0}
{"id":"nord","count":0}
{"id":"noram","count":0}
{"id":"nam","count":0}
{"id":"oce","count":0}
{"id":"sas","count":0}
{"id":"ssa","count":0}
{"id":"wafr","count":0}
{"id":"int","count":4}
{"id":"undefined","count":2}

View File

@ -18,23 +18,35 @@ beforeEach(() => {
console.log(stdout)
})
fit.each([
'.gh-pages/categories/general.m3u',
'.gh-pages/categories/legislative.m3u',
'.gh-pages/categories/news.m3u',
'.gh-pages/categories/other.m3u',
'logs/generators/categories.log'
])('can generate %s', filepath => {
expect(content(`output/${filepath}`)).toBe(content(`expected/${filepath}`))
})
it('can generate playlists', () => {
const files = [
'.gh-pages/categories/general.m3u',
'.gh-pages/categories/legislative.m3u',
'.gh-pages/categories/news.m3u',
'.gh-pages/categories/undefined.m3u',
'logs/generators/categories.log',
'.gh-pages/countries/ru.m3u',
'.gh-pages/countries/uk.m3u',
'.gh-pages/countries/undefined.m3u',
'logs/generators/countries.log',
'.gh-pages/languages/cat.m3u',
'.gh-pages/languages/eng.m3u',
'.gh-pages/languages/nld.m3u',
'.gh-pages/languages/rus.m3u',
'.gh-pages/languages/undefined.m3u',
'logs/generators/languages.log',
'.gh-pages/regions/asia.m3u',
'.gh-pages/regions/cis.m3u',
'.gh-pages/regions/emea.m3u',
'.gh-pages/regions/eur.m3u',
'.gh-pages/regions/int.m3u',
'.gh-pages/regions/undefined.m3u',
'logs/generators/regions.log'
]
it.each([
'.gh-pages/countries/ru.m3u',
'.gh-pages/countries/uk.m3u',
'.gh-pages/countries/undefined.m3u',
'logs/generators/countries.log'
])('can generate %s', filepath => {
expect(content(`output/${filepath}`)).toBe(content(`expected/${filepath}`))
files.forEach(filepath => {
expect(content(`output/${filepath}`)).toBe(content(`expected/${filepath}`))
})
})
function content(filepath) {