mirror of
https://github.com/iptv-org/iptv
synced 2025-12-17 02:47:33 -05:00
Update index_country_m3u.js
This commit is contained in:
@@ -25,6 +25,12 @@ module.exports = async function (streams = []) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stream.broadcast_area.includes('r/INT')) {
|
||||||
|
const item = _.cloneDeep(stream)
|
||||||
|
item.group_title = 'International'
|
||||||
|
items.push(item)
|
||||||
|
}
|
||||||
|
|
||||||
const broadcastCountries = getBroadcastCountries(stream, { countries, regions, subdivisions })
|
const broadcastCountries = getBroadcastCountries(stream, { countries, regions, subdivisions })
|
||||||
broadcastCountries.forEach(country => {
|
broadcastCountries.forEach(country => {
|
||||||
const item = _.cloneDeep(stream)
|
const item = _.cloneDeep(stream)
|
||||||
@@ -33,11 +39,7 @@ module.exports = async function (streams = []) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
items = _.sortBy(items, item => {
|
items = sortByGroupTitle(items)
|
||||||
if (item.group_title === 'Undefined') return ''
|
|
||||||
|
|
||||||
return item.group_title
|
|
||||||
})
|
|
||||||
|
|
||||||
return { filepath: 'index.country.m3u', items }
|
return { filepath: 'index.country.m3u', items }
|
||||||
}
|
}
|
||||||
@@ -50,7 +52,7 @@ function getBroadcastCountries(stream, { countries, regions, subdivisions }) {
|
|||||||
acc.push(code)
|
acc.push(code)
|
||||||
break
|
break
|
||||||
case 'r':
|
case 'r':
|
||||||
if (regions[code]) {
|
if (code !== 'INT' && regions[code]) {
|
||||||
acc = acc.concat(regions[code].countries)
|
acc = acc.concat(regions[code].countries)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@@ -67,3 +69,12 @@ function getBroadcastCountries(stream, { countries, regions, subdivisions }) {
|
|||||||
|
|
||||||
return codes.map(code => countries[code]).filter(c => c)
|
return codes.map(code => countries[code]).filter(c => c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sortByGroupTitle(items) {
|
||||||
|
return _.sortBy(items, item => {
|
||||||
|
if (item.group_title === 'International') return '[' // ASCII character 91
|
||||||
|
if (item.group_title === 'Undefined') return ']' // ASCII character 93
|
||||||
|
|
||||||
|
return item.group_title
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user