Moved filterPlaylist() back to helper.js

Need for test.js
This commit is contained in:
freearhey
2020-04-25 19:58:32 +03:00
parent 3bad4b49d5
commit d06b316392
2 changed files with 17 additions and 17 deletions

View File

@@ -188,6 +188,22 @@ helper.parseMessage = function (err, u) {
return line.replace(`${u}: `, '')
}
helper.filterPlaylists = function (arr, include = '', exclude = '') {
if (include) {
const included = include.split(',').map((filename) => `channels/${filename}.m3u`)
return arr.filter((i) => included.indexOf(i.url) > -1)
}
if (exclude) {
const excluded = exclude.split(',').map((filename) => `channels/${filename}.m3u`)
return arr.filter((i) => excluded.indexOf(i.url) === -1)
}
return arr
}
class Playlist {
constructor(data) {
this.header = data.header