Closed detroitenglish closed 4 years ago
I think it's a great idea and this module can really be very useful.
Also, if you decide to include iptv-playlist-parser
in the future we can just use it as a core for iptv-checker
itself.
So if I were you, I would really make a hard fork and create a separate package based on it. In this way, you will be able to get rid of a lot of unnecessary code at once and make things more straightforward.
Took an initial stab at it: https://github.com/detroitenglish/iptv-checker-module
Taking a second look, though, I see it's probably smarter to include iptv-playlist-parser
, and parse a String
or Buffer
passed in as the first parameter... it was way too late at night when I wrote that code
Taking a second look, though, I see it's probably smarter to include iptv-playlist-parser, and parse a String or Buffer passed in as the first parameter...
Just updated to to v1.0, which now parses a file path, URL or playlist data buffer passed in as first parameter
Yeah, I noticed. I was just starting to investigate your code.
I just tried to install iptv-checker-module
but unfortunately this is not possible at this time.
The point is that the playlist check can often last for hours, but the current version does not allow to monitor the progress of the check. So it's impossible not to display the progress of the bar, or keep a log. Also, in case of some error during the check, all the results will be simply erased.
I thought that the solution might be to use EventEmitter so that the module would trigger events after each verified channel, something like this:
const checker = iptvChecker('path/to/file.m3u')
checker.on('item', item => {
// log result
})
but I just couldn't figure out how to implement it in the current version of code.
Although perhaps you can find some other solution to this problem. If so, then let me know and I'll try again.
Great idea! But I don't believe event listening is the right choice, as the module itself is an async function that's likely to be await
ed. Setting event listeners is unnecessarily complicated in that case.
What do you think about adding an itemCallback
option, which accepts a function to run after each finished item, called with the item
as first parameter?
const logger = item => {
// log result
}
await iptvChecker('path/to/file.m3u', { itemCallback: logger })
Looks great to me 😁👍
@freearhey BTW I just emailed your Gmail account, regarding the module's package maintenance
Version 0.16.0 officially released 🎉
Thank you again for your help!
I'd love to utilize this package as a module in other scripts in addition to its current form as a standalone CMD tool.
My basic idea as a module would be to accept e.g. an array of items from
iptv-playlist-parser
, process them withffprobe
, append status info and metadata to each item, and finally return the array of freshly-checked items.Of course, nothing would change if called via command line. But if it's
require
ed by another script, it'll, for example, disable everything file-system related.Here's a working example branch. Run
npm run module-example
, and a script will pass an array of items, and a URL into two importediptv-checker
instances respectively.I guess the most important question is: do you want to work together on this, or would you rather I forked and created a separate package?
I'm fine with either - your repo, your call! 😎