mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-11 17:40:03 -04:00
wip
This commit is contained in:
parent
bad3eddf9d
commit
86e0c2f7da
31 changed files with 611 additions and 698 deletions
|
@ -7,11 +7,11 @@ module.exports = async function (streams = []) {
|
|||
const categories = await api.categories.all()
|
||||
for (const category of categories) {
|
||||
let items = _.filter(streams, { channel: { categories: [category.id] } })
|
||||
output.push({ id: category.id, items })
|
||||
output.push({ filepath: `categories/${category.id}.m3u`, items })
|
||||
}
|
||||
|
||||
let items = _.filter(streams, s => !s.categories.length)
|
||||
output.push({ id: 'undefined', items })
|
||||
output.push({ filepath: 'categories/undefined.m3u', items })
|
||||
|
||||
return output
|
||||
}
|
||||
|
|
|
@ -11,11 +11,11 @@ module.exports = async function (streams = []) {
|
|||
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 })
|
||||
output.push({ filepath: `countries/${country.code.toLowerCase()}.m3u`, items })
|
||||
}
|
||||
|
||||
let items = _.filter(streams, s => !s.broadcast_area.length)
|
||||
output.push({ id: 'undefined', items })
|
||||
output.push({ filepath: 'countries/undefined.m3u', items })
|
||||
|
||||
return output
|
||||
}
|
||||
|
|
|
@ -2,3 +2,4 @@ exports.categories = require('./categories')
|
|||
exports.countries = require('./countries')
|
||||
exports.languages = require('./languages')
|
||||
exports.regions = require('./regions')
|
||||
exports.index_m3u = require('./index_m3u')
|
||||
|
|
6
scripts/generators/index_m3u.js
Normal file
6
scripts/generators/index_m3u.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
const api = require('../core/api')
|
||||
const _ = require('lodash')
|
||||
|
||||
module.exports = async function (streams = []) {
|
||||
return { filepath: 'index.m3u', items: streams }
|
||||
}
|
|
@ -9,12 +9,12 @@ module.exports = async function (streams = []) {
|
|||
for (const language of languages) {
|
||||
let items = _.filter(streams, { channel: { languages: [language.code] } })
|
||||
if (items.length) {
|
||||
output.push({ id: language.code, items })
|
||||
output.push({ filepath: `languages/${language.code}.m3u`, items })
|
||||
}
|
||||
}
|
||||
|
||||
let items = _.filter(streams, s => !s.languages.length)
|
||||
output.push({ id: 'undefined', items })
|
||||
output.push({ filepath: 'languages/undefined.m3u', items })
|
||||
|
||||
return output
|
||||
}
|
||||
|
|
|
@ -9,11 +9,11 @@ module.exports = async function (streams = []) {
|
|||
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 })
|
||||
output.push({ filepath: `regions/${region.code.toLowerCase()}.m3u`, items })
|
||||
}
|
||||
|
||||
let items = _.filter(streams, s => !s.broadcast_area.length)
|
||||
output.push({ id: 'undefined', items })
|
||||
output.push({ filepath: 'regions/undefined.m3u', items })
|
||||
|
||||
return output
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue