mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-12 10:00:05 -04:00
wip
This commit is contained in:
parent
d604f35ba1
commit
9a4a62fd10
45 changed files with 733 additions and 35060 deletions
|
@ -1,6 +1,9 @@
|
|||
const { create: createPlaylist } = require('./playlist')
|
||||
const store = require('./store')
|
||||
const path = require('path')
|
||||
const glob = require('glob')
|
||||
const fs = require('mz/fs')
|
||||
const _ = require('lodash')
|
||||
|
||||
const file = {}
|
||||
|
||||
|
@ -64,4 +67,45 @@ file.basename = function (filepath) {
|
|||
return path.basename(filepath)
|
||||
}
|
||||
|
||||
// file.saveAsM3U = async function (filepath, items, options = {}) {
|
||||
// const playlist = createPlaylist(filepath)
|
||||
|
||||
// const header = {}
|
||||
// if (options.public) {
|
||||
// let guides = items.map(item => item.guides)
|
||||
// guides = _.uniq(_.flatten(guides)).sort().join(',')
|
||||
|
||||
// header['x-tvg-url'] = guides
|
||||
// }
|
||||
// playlist.setHeader(header)
|
||||
|
||||
// for (const item of items) {
|
||||
// const stream = store.create(item)
|
||||
|
||||
// let attrs
|
||||
// if (options.public) {
|
||||
// attrs = {
|
||||
// 'tvg-id': stream.get('tvg_id'),
|
||||
// 'tvg-country': stream.get('tvg_country'),
|
||||
// 'tvg-language': stream.get('tvg_language'),
|
||||
// 'tvg-logo': stream.get('tvg_logo'),
|
||||
// 'user-agent': stream.get('http.user-agent') || undefined,
|
||||
// 'group-title': stream.get('group_title')
|
||||
// }
|
||||
// } else {
|
||||
// attrs = {
|
||||
// 'tvg-id': stream.get('tvg_id'),
|
||||
// 'user-agent': stream.get('http.user-agent') || undefined
|
||||
// }
|
||||
// }
|
||||
|
||||
// playlist.add(stream.get('url'), stream.get('display_name'), attrs, {
|
||||
// 'http-referrer': stream.get('http.referrer') || undefined,
|
||||
// 'http-user-agent': stream.get('http.user-agent') || undefined
|
||||
// })
|
||||
// }
|
||||
|
||||
// return file.write(filepath, playlist.toString())
|
||||
// }
|
||||
|
||||
module.exports = file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue