Merge pull request #6702 from gabrielbergeron/addSubdivisionsToCountryLists

Add country subdivisions codes to the country lists
This commit is contained in:
Aleksandr Statciuk 2022-03-15 00:44:51 +03:00 committed by GitHub
commit 30c409d5db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 50 additions and 24 deletions

View File

@ -23,6 +23,7 @@ jobs:
curl -L -o scripts/data/guides.json https://iptv-org.github.io/api/guides.json
curl -L -o scripts/data/languages.json https://iptv-org.github.io/api/languages.json
curl -L -o scripts/data/regions.json https://iptv-org.github.io/api/regions.json
curl -L -o scripts/data/subdivisions.json https://iptv-org.github.io/api/subdivisions.json
- uses: actions/upload-artifact@v2
with:
name: data

View File

@ -35,5 +35,6 @@ api.categories = new API(`${DATA_DIR}/categories.json`)
api.languages = new API(`${DATA_DIR}/languages.json`)
api.regions = new API(`${DATA_DIR}/regions.json`)
api.blocklist = new API(`${DATA_DIR}/blocklist.json`)
api.subdivisions = new API(`${DATA_DIR}/subdivisions.json`)
module.exports = api

View File

@ -8,12 +8,18 @@ module.exports = async function (streams = []) {
const countries = await api.countries.all()
await api.regions.load()
const regions = await api.regions.all()
await api.subdivisions.load()
const subdivisions = await api.subdivisions.all()
const output = []
for (const country of countries) {
const countryAreaCodes = _.filter(regions, { countries: [country.code] }).map(
let countryRegionCodes = _.filter(regions, { countries: [country.code] }).map(
r => `r/${r.code}`
)
const countrySubdivisionCodes = _.filter(subdivisions, { country: country.code}).map(
r => `s/${r.code}`
)
const countryAreaCodes = countryRegionCodes.concat(countrySubdivisionCodes)
countryAreaCodes.push(`c/${country.code}`)
let items = _.filter(streams, stream => {

View File

@ -12,6 +12,10 @@ module.exports = async function (streams = []) {
let countries = await api.countries.all()
countries = _.keyBy(countries, 'code')
await api.subdivisions.load()
let subdivisions = await api.subdivisions.all()
subdivisions = _.keyBy(subdivisions, 'code')
let items = []
streams.forEach(stream => {
if (!stream.broadcast_area.length) {
@ -21,7 +25,8 @@ module.exports = async function (streams = []) {
return
}
getBroadcastCountries(stream, { countries, regions }).forEach(country => {
const broadcastCountries = getBroadcastCountries(stream, { countries, regions, subdivisions })
broadcastCountries.forEach(country => {
const item = _.cloneDeep(stream)
item.group_title = country.name
items.push(item)
@ -37,7 +42,7 @@ module.exports = async function (streams = []) {
return { filepath: 'index.country.m3u', items }
}
function getBroadcastCountries(stream, { countries, regions }) {
function getBroadcastCountries(stream, { countries, regions, subdivisions }) {
let codes = stream.broadcast_area.reduce((acc, item) => {
const [type, code] = item.split('/')
switch (type) {
@ -50,8 +55,9 @@ function getBroadcastCountries(stream, { countries, regions }) {
}
break
case 's':
const [c] = item.split('-')
acc.push(c)
if (subdivisions[code]) {
acc.push(subdivisions[code].country)
}
break
}
return acc

View File

@ -42,7 +42,7 @@ function getChannelRegions(stream, { regions }) {
acc.push(regions[code])
break
case 's':
const [c] = item.split('-')
const [c] = code.split('-')
const r1 = _.filter(regions, { countries: [c] })
acc = acc.concat(r1)
break

View File

@ -7,9 +7,20 @@ module.exports = async function (streams = []) {
await api.regions.load()
const regions = await api.regions.all()
await api.subdivisions.load()
const subdivisions = await api.subdivisions.all()
const output = []
for (const region of regions) {
const areaCodes = region.countries.map(code => `c/${code}`)
const regionCountries = region.countries
let areaCodes = regionCountries.map(code => `c/${code}`)
const regionSubdivisions = _.filter(
subdivisions,
s => regionCountries.indexOf(s.country) > -1
).map(s => `s/${s.code}`)
areaCodes = areaCodes.concat(regionSubdivisions)
areaCodes.push(`r/${region.code}`)
let items = _.filter(streams, stream => _.intersection(stream.broadcast_area, areaCodes).length)

View File

@ -1,3 +1,3 @@
#EXTM3U x-tvg-url=""
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA-ON" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8

View File

@ -1,5 +1,5 @@
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/uk/ontvtonight.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="General;News",BBC News HD
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA-ON" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8

View File

@ -5,7 +5,7 @@ http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8
#EXTINF:-1 tvg-id="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
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA-ON" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="UK" tvg-language="" tvg-logo="" group-title="Undefined" user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148",Andorra TV (720p) [Not 24/7]
#EXTVLCOPT:http-referrer=http://imn.iq

View File

@ -81,7 +81,7 @@ http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
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="Canada",BBC News HD
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Canada",Meteomedia
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA-ON" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Canada",Meteomedia
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.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="Cape Verde",BBC News HD
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8

View File

@ -1,7 +1,7 @@
#EXTM3U x-tvg-url="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"
#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="English",BBC News HD
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="French",Meteomedia
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA-ON" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="French",Meteomedia
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/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="Russian",ЛДПР ТВ (1080p)
http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8

View File

@ -7,7 +7,7 @@ http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index2.m3u8
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
#EXTINF:-1 tvg-id="" tvg-country="IN" tvg-language="" tvg-logo="" group-title="Undefined",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA-ON" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
#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

View File

@ -7,7 +7,7 @@ http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index2.m3u8
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
#EXTINF:-1 tvg-id="" tvg-country="IN" tvg-language="" tvg-logo="" group-title="Undefined",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA-ON" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
#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

View File

@ -1,5 +1,5 @@
#EXTM3U x-tvg-url="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"
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Americas",Meteomedia
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA-ON" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Americas",Meteomedia
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="IN" tvg-language="" tvg-logo="" group-title="Asia",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
@ -25,9 +25,9 @@ http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index2.m3u8
https://iptv-all.lanesh4d0w.repl.co/andorra/zoo
#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="MeteoMedia.ca" tvg-country="CA" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="North America",Meteomedia
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA-ON" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="North America",Meteomedia
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Northern America",Meteomedia
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA-ON" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Northern America",Meteomedia
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
#EXTINF:-1 tvg-id="" tvg-country="IN" tvg-language="" tvg-logo="" group-title="South Asia",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
@ -39,7 +39,7 @@ http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index2.m3u8
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
#EXTINF:-1 tvg-id="" tvg-country="IN" tvg-language="" tvg-logo="" group-title="Worldwide",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Worldwide",Meteomedia
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA-ON" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Worldwide",Meteomedia
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
#EXTINF:-1 tvg-id="Zoo.ad" tvg-country="AD" tvg-language="" tvg-logo="" group-title="Worldwide",Zoo (720p)
https://iptv-all.lanesh4d0w.repl.co/andorra/zoo

View File

@ -1,3 +1,3 @@
#EXTM3U x-tvg-url=""
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA-ON" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8

View File

@ -1,3 +1,3 @@
#EXTM3U x-tvg-url=""
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA-ON" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8

View File

@ -7,7 +7,7 @@ http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index2.m3u8
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
#EXTINF:-1 tvg-id="" tvg-country="IN" tvg-language="" tvg-logo="" group-title="Undefined",Daawah TV
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA-ON" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
#EXTINF:-1 tvg-id="Zoo.ad" tvg-country="AD" tvg-language="" tvg-logo="" group-title="Undefined",Zoo (720p)
https://iptv-all.lanesh4d0w.repl.co/andorra/zoo

View File

@ -1,3 +1,3 @@
#EXTM3U x-tvg-url=""
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA-ON" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8

View File

@ -1,3 +1,3 @@
#EXTM3U x-tvg-url=""
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-country="CA-ON" tvg-language="French" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8

View File

@ -131,7 +131,7 @@
"subdivision": null,
"city": null,
"broadcast_area": [
"c/CA"
"s/CA-ON"
],
"languages": [
"fra"

File diff suppressed because one or more lines are too long