This commit is contained in:
Aleksandr Statciuk 2022-02-07 05:53:30 +03:00
parent 42cbfcd7ad
commit 510e566f8a
6 changed files with 121 additions and 90 deletions

View file

@ -6,3 +6,5 @@ exports.index_m3u = require('./index_m3u')
exports.index_nsfw_m3u = require('./index_nsfw_m3u')
exports.index_category_m3u = require('./index_category_m3u')
exports.index_country_m3u = require('./index_country_m3u')
exports.index_language_m3u = require('./index_language_m3u')
exports.index_region_m3u = require('./index_region_m3u')

View file

@ -0,0 +1,22 @@
const api = require('../core/api')
const _ = require('lodash')
module.exports = async function (streams = []) {
streams = _.filter(streams, s => !s.channel || s.channel.is_nsfw === false)
let items = []
streams.forEach(stream => {
if (!stream.languages.length) return items.push(stream)
stream.languages.forEach(language => {
const item = _.cloneDeep(stream)
item.group_title = language.name
items.push(item)
})
})
items = _.sortBy(items, i => {
if (i.group_title === 'Undefined') return '_'
return i.group_title
})
return { filepath: 'index.language.m3u', items }
}

View file

@ -0,0 +1,22 @@
const api = require('../core/api')
const _ = require('lodash')
module.exports = async function (streams = []) {
streams = _.filter(streams, s => !s.channel || s.channel.is_nsfw === false)
let items = []
streams.forEach(stream => {
if (!stream.regions.length) return items.push(stream)
stream.regions.forEach(region => {
const item = _.cloneDeep(stream)
item.group_title = region.name
items.push(item)
})
})
items = _.sortBy(items, i => {
if (i.group_title === 'Undefined') return '_'
return i.group_title
})
return { filepath: 'index.region.m3u', items }
}