mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-13 02:20:03 -04:00
Moved filterPlaylist() back to helper.js
Need for test.js
This commit is contained in:
parent
7ff1d5ab0b
commit
bc570de9ce
2 changed files with 17 additions and 17 deletions
|
@ -65,7 +65,7 @@ async function main() {
|
|||
|
||||
function parseIndex() {
|
||||
const playlist = helper.parsePlaylist('index.m3u')
|
||||
playlist.items = filterPlaylists(playlist.items, config.country, config.exclude)
|
||||
playlist.items = helper.filterPlaylists(playlist.items, config.country, config.exclude)
|
||||
|
||||
console.log(`Found ${playlist.items.length + 1} playlist(s)`)
|
||||
|
||||
|
@ -172,22 +172,6 @@ function updatePlaylist(filepath, playlist) {
|
|||
console.log(`Playlist '${filepath}' has been updated`)
|
||||
}
|
||||
|
||||
function filterPlaylists(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
|
||||
}
|
||||
|
||||
function filterUnsorted() {
|
||||
const urls = items.map((i) => i.url)
|
||||
const unsortedPlaylist = parsePlaylist('channels/unsorted.m3u')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue