This commit is contained in:
Aleksandr Statciuk
2022-02-07 03:52:47 +03:00
parent 5e1945ce4a
commit 3fd0006b31
19 changed files with 91 additions and 40 deletions

View File

@@ -3,3 +3,5 @@ exports.countries = require('./countries')
exports.languages = require('./languages')
exports.regions = require('./regions')
exports.index_m3u = require('./index_m3u')
exports.index_nsfw_m3u = require('./index_nsfw_m3u')
exports.index_category_m3u = require('./index_category_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.categories.length) return items.push(stream)
stream.categories.forEach(category => {
const item = _.cloneDeep(stream)
item.group_title = category.name
items.push(item)
})
})
items = _.sortBy(items, i => {
if (i.group_title === 'Undefined') return '_'
return i.group_title
})
return { filepath: 'index.category.m3u', items }
}

View File

@@ -0,0 +1,6 @@
const api = require('../core/api')
const _ = require('lodash')
module.exports = async function (streams = []) {
return { filepath: 'index.nsfw.m3u', items: streams }
}