GithubHelp home page GithubHelp logo

pled's Introduction

Overview

Merging and transforming m3u playlists

Installation

npm install pled

Web server for playlists processing

It is the best to use Pled in pair with express.js. Directory sample contains simple web server which returns combined playlist.

var express = require('express');
var app = express();

var Pled = require('../index');


var sources = ['http://iptv.slynet.tv/FreeSlyNet.m3u', 'http://iptv.slynet.tv/FreeBestTV.m3u'];

app.get('/', function (req, res) {
    var pled = new Pled({
        sources: sources
    });

    pled.handleRequest(req, res);
});

app.listen(3000, function () {
    console.log('Example app listening on port 3000!');
});
  • Now enter in browser http://localhost:3000 and you'll get combined playlist in response.
  • If url is http://localhost:3000?force=true then data will be reloaded

Stream filters

You can add filter to transform streams. Streams are transformed by filters sequentially. Each filter is actually a function which accepts three arguments:

  • Old track info
  • Source (string)
  • List of already collected tracks It returns updated track or undefined. undefined means that this track should not outputted to the final result. When a filter processed a track this track will be passed to the next filters. There many examples of preloaded filters. See example
var Pled = require('pled');
var f = Pled.filters;

var filters = [
    f.forStream('http://iptv.proline.net.ua/files/video/notv_vip.wmv', f.remove),
    f.forSource('http://iptv.proline.net.ua/playlist/iptv.m3u', f.setGroup('Інші')),
    f.forSource("http://iptv.slynet.tv/FreeSlyNet.m3u", f.setGroup('FreeSlyNet')),
    
    f.forGroup("Sport", f.setGroup('Action')),
    
    // 1+1
    f.forStream('udp://@226.226.1.1:1234', f.setGroup('Новини')),
    f.forStream('udp://@226.226.1.1:1234', f.setImage('http://iptv.proline.net.ua/images/channel/1plus1.jpg')),
        
    f.udpProxy('http://192.168.0.1:4000/udp/')    
    ];
    
var pled = new Pled({
       sources: ['http://iptv.slynet.tv/FreeSlyNet.m3u', 'http://iptv.slynet.tv/FreeBestTV.m3u'],
       filters: filters
   });

Caching response

A response can be stored in a cache file. If handler finds a existing file and it is up to date it does not regenerate the playlist.

var pled = new Pled({
       sources: ['http://iptv.slynet.tv/FreeSlyNet.m3u', 'http://iptv.slynet.tv/FreeBestTV.m3u'],
       cachePath: '/path/to/file', // Optional
       cacheTime: 7*24*60*60*1000 // Time to cache in milliseconds, by default 5 days
   });

API Documentation

Here

pled's People

Contributors

privatesam avatar solvek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pled's Issues

Problem with slow loading m3u

Thanks for this useful application.

I have an issue with one of my m3u sources which loads the m3u very slowly which i think is making pled error out:

Failed to generate the playlist.m3u. Error: ENOENT: no such file or directory, open 'https://xxxx.com/api/list/?u=xxxx&k=xxxx'

Is there anyway I can change the code to add in a little longer wait time?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.