diff --git a/scripts/commands/generate-playlists.js b/scripts/commands/generate-playlists.js index 0572fd3e44..485ef19b72 100644 --- a/scripts/commands/generate-playlists.js +++ b/scripts/commands/generate-playlists.js @@ -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 }) + 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` diff --git a/scripts/data/languages.json b/scripts/data/languages.json index 0ba55659db..740c8a8ebc 100644 --- a/scripts/data/languages.json +++ b/scripts/data/languages.json @@ -22760,11 +22760,11 @@ "code": "pur" }, { - "name": "Pashto", + "name": "Pushto", "code": "pus" }, { - "name": "Pushto", + "name": "Pashto", "code": "pus" }, { diff --git a/tests/__data__/expected/.gh-pages/categories/general.m3u b/tests/__data__/expected/.gh-pages/categories/general.m3u new file mode 100644 index 0000000000..6e90aa990b --- /dev/null +++ b/tests/__data__/expected/.gh-pages/categories/general.m3u @@ -0,0 +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) +http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8 diff --git a/tests/__data__/expected/.gh-pages/categories/legislative.m3u b/tests/__data__/expected/.gh-pages/categories/legislative.m3u new file mode 100644 index 0000000000..6e90aa990b --- /dev/null +++ b/tests/__data__/expected/.gh-pages/categories/legislative.m3u @@ -0,0 +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) +http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8 diff --git a/tests/__data__/expected/.gh-pages/categories/news.m3u b/tests/__data__/expected/.gh-pages/categories/news.m3u new file mode 100644 index 0000000000..c9e8ad6e99 --- /dev/null +++ b/tests/__data__/expected/.gh-pages/categories/news.m3u @@ -0,0 +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 diff --git a/tests/__data__/expected/.gh-pages/categories/other.m3u b/tests/__data__/expected/.gh-pages/categories/other.m3u new file mode 100644 index 0000000000..58409e132d --- /dev/null +++ b/tests/__data__/expected/.gh-pages/categories/other.m3u @@ -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 diff --git a/tests/__data__/expected/.gh-pages/channels.json b/tests/__data__/expected/.gh-pages/channels.json new file mode 100644 index 0000000000..6076b36263 --- /dev/null +++ b/tests/__data__/expected/.gh-pages/channels.json @@ -0,0 +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":[],"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"}}] \ No newline at end of file diff --git a/tests/__data__/expected/.gh-pages/countries/ru.m3u b/tests/__data__/expected/.gh-pages/countries/ru.m3u new file mode 100644 index 0000000000..68e8fdb619 --- /dev/null +++ b/tests/__data__/expected/.gh-pages/countries/ru.m3u @@ -0,0 +1,5 @@ +#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml" +#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 diff --git a/tests/__data__/expected/.gh-pages/countries/uk.m3u b/tests/__data__/expected/.gh-pages/countries/uk.m3u new file mode 100644 index 0000000000..d282ad82f5 --- /dev/null +++ b/tests/__data__/expected/.gh-pages/countries/uk.m3u @@ -0,0 +1,5 @@ +#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 +#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 diff --git a/tests/__data__/expected/.gh-pages/countries/undefined.m3u b/tests/__data__/expected/.gh-pages/countries/undefined.m3u new file mode 100644 index 0000000000..e16261d1d7 --- /dev/null +++ b/tests/__data__/expected/.gh-pages/countries/undefined.m3u @@ -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 diff --git a/tests/__data__/expected/.gh-pages/index.category.m3u b/tests/__data__/expected/.gh-pages/index.category.m3u new file mode 100644 index 0000000000..05f83ce589 --- /dev/null +++ b/tests/__data__/expected/.gh-pages/index.category.m3u @@ -0,0 +1,11 @@ +#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml" +#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",ЛДПР ТВ (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="Legislative",ЛДПР ТВ (1080p) +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="Other",Daawah TV +http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8 diff --git a/tests/__data__/expected/.gh-pages/index.country.m3u b/tests/__data__/expected/.gh-pages/index.country.m3u new file mode 100644 index 0000000000..9e8fba4139 --- /dev/null +++ b/tests/__data__/expected/.gh-pages/index.country.m3u @@ -0,0 +1,13 @@ +#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml" +#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 +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="Russia",ЛДПР ТВ (1080p) +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="United Kingdom",BBC News HD (720p) [Not 24/7] +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 diff --git a/tests/__data__/expected/.gh-pages/index.language.m3u b/tests/__data__/expected/.gh-pages/index.language.m3u new file mode 100644 index 0000000000..c81dfd4f4f --- /dev/null +++ b/tests/__data__/expected/.gh-pages/index.language.m3u @@ -0,0 +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="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 diff --git a/tests/__data__/expected/.gh-pages/index.m3u b/tests/__data__/expected/.gh-pages/index.m3u new file mode 100644 index 0000000000..ef512adf63 --- /dev/null +++ b/tests/__data__/expected/.gh-pages/index.m3u @@ -0,0 +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="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 diff --git a/tests/__data__/expected/.gh-pages/index.nsfw.m3u b/tests/__data__/expected/.gh-pages/index.nsfw.m3u new file mode 100644 index 0000000000..3222ce02b7 --- /dev/null +++ b/tests/__data__/expected/.gh-pages/index.nsfw.m3u @@ -0,0 +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="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 diff --git a/tests/__data__/expected/.gh-pages/index.region.m3u b/tests/__data__/expected/.gh-pages/index.region.m3u new file mode 100644 index 0000000000..05f2704604 --- /dev/null +++ b/tests/__data__/expected/.gh-pages/index.region.m3u @@ -0,0 +1,17 @@ +#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="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) +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="Europe",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="Europe",ЛДПР ТВ (1080p) +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="Europe, the Middle East and Africa",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="Europe, the Middle East and Africa",ЛДПР ТВ (1080p) +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 diff --git a/tests/__data__/expected/.gh-pages/languages/eng.m3u b/tests/__data__/expected/.gh-pages/languages/eng.m3u new file mode 100644 index 0000000000..c9e8ad6e99 --- /dev/null +++ b/tests/__data__/expected/.gh-pages/languages/eng.m3u @@ -0,0 +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 diff --git a/tests/__data__/expected/.gh-pages/languages/rus.m3u b/tests/__data__/expected/.gh-pages/languages/rus.m3u new file mode 100644 index 0000000000..6e90aa990b --- /dev/null +++ b/tests/__data__/expected/.gh-pages/languages/rus.m3u @@ -0,0 +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) +http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8 diff --git a/tests/__data__/expected/.gh-pages/languages/undefined.m3u b/tests/__data__/expected/.gh-pages/languages/undefined.m3u new file mode 100644 index 0000000000..7ca9967b91 --- /dev/null +++ b/tests/__data__/expected/.gh-pages/languages/undefined.m3u @@ -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 diff --git a/tests/__data__/expected/.gh-pages/regions/asia.m3u b/tests/__data__/expected/.gh-pages/regions/asia.m3u new file mode 100644 index 0000000000..6e90aa990b --- /dev/null +++ b/tests/__data__/expected/.gh-pages/regions/asia.m3u @@ -0,0 +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) +http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8 diff --git a/tests/__data__/expected/.gh-pages/regions/cis.m3u b/tests/__data__/expected/.gh-pages/regions/cis.m3u new file mode 100644 index 0000000000..6e90aa990b --- /dev/null +++ b/tests/__data__/expected/.gh-pages/regions/cis.m3u @@ -0,0 +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) +http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8 diff --git a/tests/__data__/expected/.gh-pages/regions/emea.m3u b/tests/__data__/expected/.gh-pages/regions/emea.m3u new file mode 100644 index 0000000000..a99ae31b51 --- /dev/null +++ b/tests/__data__/expected/.gh-pages/regions/emea.m3u @@ -0,0 +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] +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) +http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8 diff --git a/tests/__data__/expected/.gh-pages/regions/eur.m3u b/tests/__data__/expected/.gh-pages/regions/eur.m3u new file mode 100644 index 0000000000..a99ae31b51 --- /dev/null +++ b/tests/__data__/expected/.gh-pages/regions/eur.m3u @@ -0,0 +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] +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) +http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8 diff --git a/tests/__data__/expected/.gh-pages/regions/int.m3u b/tests/__data__/expected/.gh-pages/regions/int.m3u new file mode 100644 index 0000000000..67cbf10937 --- /dev/null +++ b/tests/__data__/expected/.gh-pages/regions/int.m3u @@ -0,0 +1,3 @@ +#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 diff --git a/tests/__data__/expected/.gh-pages/regions/undefined.m3u b/tests/__data__/expected/.gh-pages/regions/undefined.m3u new file mode 100644 index 0000000000..e16261d1d7 --- /dev/null +++ b/tests/__data__/expected/.gh-pages/regions/undefined.m3u @@ -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 diff --git a/tests/__data__/expected/logs/generate-playlists/categories.log b/tests/__data__/expected/logs/generate-playlists/categories.log new file mode 100644 index 0000000000..feeadad3fb --- /dev/null +++ b/tests/__data__/expected/logs/generate-playlists/categories.log @@ -0,0 +1,6 @@ +{"name":"Cooking","slug":"cooking","count":1} +{"name":"General","slug":"general","count":1} +{"name":"Legislative","slug":"legislative","count":1} +{"name":"News","slug":"news","count":1} +{"name":"XXX","slug":"xxx","count":1} +{"name":"Other","slug":"other","count":1} diff --git a/tests/__data__/expected/logs/generate-playlists/countries.log b/tests/__data__/expected/logs/generate-playlists/countries.log new file mode 100644 index 0000000000..8d4859860b --- /dev/null +++ b/tests/__data__/expected/logs/generate-playlists/countries.log @@ -0,0 +1,4 @@ +{"name":"Andorra","code":"AD","count":1} +{"name":"Russia","code":"RU","count":2} +{"name":"United Kingdom","code":"UK","count":2} +{"name":"Undefined","code":"UNDEFINED","count":1} diff --git a/tests/__data__/expected/logs/generate-playlists/languages.log b/tests/__data__/expected/logs/generate-playlists/languages.log new file mode 100644 index 0000000000..02eee06c2c --- /dev/null +++ b/tests/__data__/expected/logs/generate-playlists/languages.log @@ -0,0 +1,4 @@ +{"name":"Catalan","code":"cat","count":0} +{"name":"English","code":"eng","count":1} +{"name":"Russian","code":"rus","count":1} +{"name":"Undefined","code":"undefined","count":2} diff --git a/tests/__data__/expected/logs/generate-playlists/regions.log b/tests/__data__/expected/logs/generate-playlists/regions.log new file mode 100644 index 0000000000..3380f477fd --- /dev/null +++ b/tests/__data__/expected/logs/generate-playlists/regions.log @@ -0,0 +1,6 @@ +{"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} diff --git a/tests/__data__/input/generate-playlists.test.db b/tests/__data__/input/generate-playlists.test.db index 7daacefc21..46b45e560d 100644 --- a/tests/__data__/input/generate-playlists.test.db +++ b/tests/__data__/input/generate-playlists.test.db @@ -1,7 +1,8 @@ {"name":"ЛДПР ТВ","id":"LDPRTV.ru","filepath":"tests/__data__/output/channels/ru.m3u","src_country":{"name":"Russia","code":"RU","lang":"rus"},"tvg_country":"RU","countries":[{"name":"Russia","code":"RU","lang":"rus"}],"regions":[{"name":"Asia","code":"ASIA"},{"name":"Commonwealth of Independent States","code":"CIS"},{"name":"Europe, the Middle East and Africa","code":"EMEA"},{"name":"Europe","code":"EUR"}],"languages":[{"name":"Russian","code":"rus"}],"categories":[{"name":"General","slug":"general","nsfw":false},{"name":"Legislative","slug":"legislative","nsfw":false}],"tvg_url":"","guides":["https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml"],"logo":"https://iptvx.one/icn/ldpr-tv.png","resolution":{"height":1080,"width":null},"status":{"label":"","code":"online","level":1},"url":"http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8","http":{"referrer":"","user-agent":""},"is_nsfw":false,"is_broken":false,"updated":false,"cluster_id":1,"_id":"2ST8btby3mmsgPF0"} {"name":"BBC News HD","id":"BBCNews.uk","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":"3TbieV1ptnZVCIdn"} +{"name":"BBC News HD","id":"BBCNews.uk","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/playlist.m3u8","http":{"referrer":"","user-agent":""},"is_nsfw":false,"is_broken":false,"updated":false,"cluster_id":3,"_id":"3TbieV1ptnZVCId5"} {"name":"ATV","id":"AndorraTV.ad","filepath":"tests/__data__/output/channels/ad.m3u","src_country":{"name":"Andorra","code":"AD","lang":"cat"},"tvg_country":"AD","countries":[{"name":"Andorra","code":"AD","lang":"cat"}],"regions":[{"name":"Europe, the Middle East and Africa","code":"EMEA"},{"name":"Europe","code":"EUR"}],"languages":[{"name":"Catalan","code":"cat"}],"categories":[{"name":"General","slug":"general","nsfw":false}],"tvg_url":"","guides":[],"logo":"https://i.imgur.com/kJCjeQ4.png","resolution":{"height":720,"width":null},"status":{"label":"Offline","code":"offline","level":5},"url":"https://iptv-all.lanesh4d0w.repl.co/andorra/atv","http":{"referrer":"","user-agent":""},"is_nsfw":false,"is_broken":true,"updated":false,"cluster_id":1,"_id":"I6cjG2xCBRFFP4sz"} {"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"} diff --git a/tests/__data__/input/readme.md b/tests/__data__/input/readme.md index db32f5f372..6b8eb4b1c1 100644 --- a/tests/__data__/input/readme.md +++ b/tests/__data__/input/readme.md @@ -4,8 +4,6 @@ Collection of publicly available IPTV channels from all over the world. -Internet Protocol television (IPTV) is the delivery of television content over Internet Protocol (IP) networks. - ## Usage To watch IPTV you just need to paste this link `https://iptv-org.github.io/iptv/index.m3u` to any player which supports M3U-playlists. diff --git a/tests/commands/generate-playlists.test.js b/tests/commands/generate-playlists.test.js index 6f548595af..0b5a12a08e 100644 --- a/tests/commands/generate-playlists.test.js +++ b/tests/commands/generate-playlists.test.js @@ -3,7 +3,7 @@ const path = require('path') const { execSync } = require('child_process') function content(filepath) { - return fs.readFileSync(`tests/__data__/output/${filepath}`, { + return fs.readFileSync(`tests/__data__/${filepath}`, { encoding: 'utf8' }) } @@ -24,230 +24,137 @@ afterEach(() => { }) it('can generate categories', () => { - expect(content('.gh-pages/categories/general.m3u')) - .toBe(`#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) -http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8 -`) + expect(content('output/.gh-pages/categories/general.m3u')).toBe( + content('expected/.gh-pages/categories/general.m3u') + ) - expect(content('.gh-pages/categories/legislative.m3u')) - .toBe(`#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) -http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8 -`) + expect(content('output/.gh-pages/categories/legislative.m3u')).toBe( + content('expected/.gh-pages/categories/legislative.m3u') + ) - expect(content('.gh-pages/categories/news.m3u')).toBe(`#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 -`) + 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('.gh-pages/countries/ru.m3u')) - .toBe(`#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml" -#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 -`) + expect(content('output/.gh-pages/countries/ru.m3u')).toBe( + content('expected/.gh-pages/countries/ru.m3u') + ) - expect(content('.gh-pages/countries/uk.m3u')).toBe(`#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 -#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 -`) + 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('.gh-pages/languages/rus.m3u')) - .toBe(`#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) -http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8 -`) + expect(content('output/.gh-pages/languages/rus.m3u')).toBe( + content('expected/.gh-pages/languages/rus.m3u') + ) - expect(content('.gh-pages/languages/eng.m3u')).toBe(`#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 -`) + 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('.gh-pages/regions/asia.m3u')) - .toBe(`#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) -http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8 -`) + expect(content('output/.gh-pages/regions/asia.m3u')).toBe( + content('expected/.gh-pages/regions/asia.m3u') + ) - expect(content('.gh-pages/regions/cis.m3u')) - .toBe(`#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) -http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8 -`) + expect(content('output/.gh-pages/regions/cis.m3u')).toBe( + content('expected/.gh-pages/regions/cis.m3u') + ) - expect(content('.gh-pages/regions/emea.m3u')) - .toBe(`#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="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 -`) + expect(content('output/.gh-pages/regions/emea.m3u')).toBe( + content('expected/.gh-pages/regions/emea.m3u') + ) - expect(content('.gh-pages/regions/eur.m3u')) - .toBe(`#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="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 -`) + expect(content('output/.gh-pages/regions/eur.m3u')).toBe( + content('expected/.gh-pages/regions/eur.m3u') + ) - expect(content('.gh-pages/regions/int.m3u')) - .toBe(`#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 -`) + 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('.gh-pages/channels.json')).toBe( - `[{"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":"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"}}]` + expect(content('output/.gh-pages/channels.json')).toBe( + content('expected/.gh-pages/channels.json') ) }) it('can generate index.category.m3u', () => { - expect(content('.gh-pages/index.category.m3u')) - .toBe(`#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml" -#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",ЛДПР ТВ (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="Legislative",ЛДПР ТВ (1080p) -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 -http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8 -`) + expect(content('output/.gh-pages/index.category.m3u')).toBe( + content('expected/.gh-pages/index.category.m3u') + ) }) it('can generate index.country.m3u', () => { - const result = content('.gh-pages/index.country.m3u') - expect(result).toEqual( - expect.stringContaining(`#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/ru/tv.yandex.ru.epg.xml"`)) - expect(result).toEqual( - expect.stringContaining(`#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="",Daawah TV -http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8`)) - expect(result).toEqual(expect.stringContaining(`#EXTINF:-1 tvg-id="LDPRTV.ru" tvg-country="RU" tvg-language="Russian" tvg-logo="https://iptvx.one/icn/ldpr-tv.png" group-title="Russia",ЛДПР ТВ (1080p) -http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8`)) - expect(result).toEqual(expect.stringContaining(`#EXTINF:-1 tvg-id="BBCNews.uk" tvg-country="UK" tvg-language="English" tvg-logo="https://i.imgur.com/eNPIQ9f.png" group-title="United Kingdom",BBC News HD (720p) [Not 24/7] -http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8`)) - expect(result).toEqual(expect.stringContaining(`#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`)) + expect(content('output/.gh-pages/index.country.m3u')).toBe( + content('expected/.gh-pages/index.country.m3u') + ) }) it('can generate index.language.m3u', () => { - expect(content('.gh-pages/index.language.m3u')) - .toBe(`#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 -`) + expect(content('output/.gh-pages/index.language.m3u')).toBe( + content('expected/.gh-pages/index.language.m3u') + ) }) it('can generate index.region.m3u', () => { - expect(content('.gh-pages/index.region.m3u')) - .toBe(`#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) -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="Europe",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="Europe",ЛДПР ТВ (1080p) -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="Europe, the Middle East and Africa",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="Europe, the Middle East and Africa",ЛДПР ТВ (1080p) -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 -`) + expect(content('output/.gh-pages/index.region.m3u')).toBe( + content('expected/.gh-pages/index.region.m3u') + ) }) it('can generate index.m3u', () => { - expect(content('.gh-pages/index.m3u')) - .toBe(`#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 -`) + expect(content('output/.gh-pages/index.m3u')).toBe(content('expected/.gh-pages/index.m3u')) }) it('can generate index.nsfw.m3u', () => { - expect(content('.gh-pages/index.nsfw.m3u')) - .toBe(`#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 -`) + expect(content('output/.gh-pages/index.nsfw.m3u')).toBe( + content('expected/.gh-pages/index.nsfw.m3u') + ) }) it('can generate logs categories', () => { - expect(content('logs/generate-playlists/categories.log')) - .toBe(`{"name":"Cooking","slug":"cooking","count":1} -{"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} -`) + expect(content('output/logs/generate-playlists/categories.log')).toBe( + content('expected/logs/generate-playlists/categories.log') + ) }) it('can generate logs countries', () => { - expect(content('logs/generate-playlists/countries.log')) - .toBe(`{"name":"Andorra","code":"AD","count":1} -{"name":"Russia","code":"RU","count":2} -{"name":"United Kingdom","code":"UK","count":2} -{"name":"Undefined","code":"UNDEFINED","count":1} -`) + expect(content('output/logs/generate-playlists/countries.log')).toBe( + content('expected/logs/generate-playlists/countries.log') + ) }) it('can generate logs languages', () => { - expect(content('logs/generate-playlists/languages.log')) - .toBe(`{"name":"Catalan","code":"cat","count":0} -{"name":"English","code":"eng","count":1} -{"name":"Russian","code":"rus","count":1} -{"name":"Undefined","code":"undefined","count":2} -`) + expect(content('output/logs/generate-playlists/languages.log')).toBe( + content('expected/logs/generate-playlists/languages.log') + ) }) it('can generate logs regions', () => { - expect(content('logs/generate-playlists/regions.log')) - .toBe(`{"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} -`) + expect(content('output/logs/generate-playlists/regions.log')).toBe( + content('expected/logs/generate-playlists/regions.log') + ) })