Update parsePlaylist() function

This commit is contained in:
Aleksandr Statciuk 2022-03-11 18:01:45 +03:00
parent 70207240d5
commit c1a6dd4ba1
3 changed files with 5 additions and 6 deletions

View File

@ -33,8 +33,8 @@ async function findStreams() {
const streams = []
const files = await file.list(`${options.inputDir}/**/*.m3u`)
for (const filepath of files) {
const items = await parser.parsePlaylist(filepath)
for (const item of items) {
const playlist = await parser.parsePlaylist(filepath)
for (const item of playlist.items) {
item.filepath = filepath
const stream = store.create()

View File

@ -31,8 +31,8 @@ async function main() {
const [__, country] = basename.match(/([a-z]{2})(|_.*)\.m3u/i) || [null, null]
const fileLog = []
const items = await parser.parsePlaylist(filepath)
for (const item of items) {
const playlist = await parser.parsePlaylist(filepath)
for (const item of playlist.items) {
if (item.tvg.id && !api.channels.find({ id: item.tvg.id })) {
fileLog.push({
type: 'warning',

View File

@ -6,9 +6,8 @@ const parser = {}
parser.parsePlaylist = async function (filepath) {
const content = await file.read(filepath)
const playlist = ipp.parse(content)
return playlist.items
return ipp.parse(content)
}
parser.parseLogs = async function (filepath) {