Update sort.js
This commit is contained in:
		| @@ -1,16 +1,18 @@ | ||||
| const parser = require('./helpers/parser') | ||||
| const utils = require('./helpers/utils') | ||||
| const file = require('./helpers/file') | ||||
| const log = require('./helpers/log') | ||||
|  | ||||
| async function main() { | ||||
|   log.start() | ||||
|  | ||||
|   log.print(`Parsing 'index.m3u'...`) | ||||
|   let playlists = parser.parseIndex().filter(i => i.url !== 'channels/unsorted.m3u') | ||||
|   for (const playlist of playlists) { | ||||
|     log.print(`\nProcessing '${playlist.url}'...`) | ||||
|   let files = await file.list() | ||||
|   if (!files.length) log.print(`No files is selected\n`) | ||||
|   files = files.filter(file => file !== 'channels/unsorted.m3u') | ||||
|   for (const file of files) { | ||||
|     log.print(`\nProcessing '${file}'...`) | ||||
|     await parser | ||||
|       .parsePlaylist(playlist.url) | ||||
|       .parsePlaylist(file) | ||||
|       .then(sortChannels) | ||||
|       .then(p => p.save()) | ||||
|   } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user