Update parsePlaylist() function
This commit is contained in:
parent
70207240d5
commit
c1a6dd4ba1
|
@ -33,8 +33,8 @@ async function findStreams() {
|
||||||
const streams = []
|
const streams = []
|
||||||
const files = await file.list(`${options.inputDir}/**/*.m3u`)
|
const files = await file.list(`${options.inputDir}/**/*.m3u`)
|
||||||
for (const filepath of files) {
|
for (const filepath of files) {
|
||||||
const items = await parser.parsePlaylist(filepath)
|
const playlist = await parser.parsePlaylist(filepath)
|
||||||
for (const item of items) {
|
for (const item of playlist.items) {
|
||||||
item.filepath = filepath
|
item.filepath = filepath
|
||||||
|
|
||||||
const stream = store.create()
|
const stream = store.create()
|
||||||
|
|
|
@ -31,8 +31,8 @@ async function main() {
|
||||||
const [__, country] = basename.match(/([a-z]{2})(|_.*)\.m3u/i) || [null, null]
|
const [__, country] = basename.match(/([a-z]{2})(|_.*)\.m3u/i) || [null, null]
|
||||||
|
|
||||||
const fileLog = []
|
const fileLog = []
|
||||||
const items = await parser.parsePlaylist(filepath)
|
const playlist = await parser.parsePlaylist(filepath)
|
||||||
for (const item of items) {
|
for (const item of playlist.items) {
|
||||||
if (item.tvg.id && !api.channels.find({ id: item.tvg.id })) {
|
if (item.tvg.id && !api.channels.find({ id: item.tvg.id })) {
|
||||||
fileLog.push({
|
fileLog.push({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
|
|
|
@ -6,9 +6,8 @@ const parser = {}
|
||||||
|
|
||||||
parser.parsePlaylist = async function (filepath) {
|
parser.parsePlaylist = async function (filepath) {
|
||||||
const content = await file.read(filepath)
|
const content = await file.read(filepath)
|
||||||
const playlist = ipp.parse(content)
|
|
||||||
|
|
||||||
return playlist.items
|
return ipp.parse(content)
|
||||||
}
|
}
|
||||||
|
|
||||||
parser.parseLogs = async function (filepath) {
|
parser.parseLogs = async function (filepath) {
|
||||||
|
|
Loading…
Reference in New Issue