Gemorroj / M3uParser

Parser and generator m3u playlists
GNU Lesser General Public License v3.0
81 stars 33 forks source link

Add patch for each entry #14

Closed tschope closed 5 years ago

tschope commented 5 years ago

Some tv player use patch for each entry, IPTV players, each entry is a channel information, break line, channel url. I made a php to rebuild my current list and I made this change. Maybe help some else.

Gemorroj commented 5 years ago

https://github.com/Gemorroj/M3uParser/blob/master/src/M3uEntry.php#L48 Isn't that what you need? You can make a test or attach an example m3u file for which you need your change.

tschope commented 5 years ago

Actually no, I tried to use, but show only at the final of the file and I use this of each entry of my file, like this:

#EXTM3U x-tvg-url="http://"
#EXTINF: -1 tvg-id="SPORTFHD.br" tvg-name="SPORT FHD" tvg-logo="https://4.bp.blogspot.com/-iDygr9PU0yo/XAh6QW80EtI/AAAAAAAACoE/K7zUw7IvW4IEMrJXmqYl94-80m9ANl_gACLcBGAs/s1600/bbb2019.png" group-title="CANAIS GLOBO", BBB FHD AQUECIMENTO
http://srv.test-channel.vip:8880/veLMOIkQ2l/10633
#EXTINF: -1 tvg-id="SPORTHD.br" tvg-name="SPORT HD" tvg-logo="https://4.bp.blogspot.com/-iDygr9PU0yo/XAh6QW80EtI/AAAAAAAACoE/K7zUw7IvW4IEMrJXmqYl94-80m9ANl_gACLcBGAs/s1600/bbb2019.png" group-title="CANAIS GLOBO", BBB HD AQUECIMENTO
http://srv.test-channel.vip:8880/veLMOIkQ2l/10632
#EXTINF: -1 tvg-id="SPORTSD.br" tvg-name="SPORT SD" tvg-logo="https://4.bp.blogspot.com/-iDygr9PU0yo/XAh6QW80EtI/AAAAAAAACoE/K7zUw7IvW4IEMrJXmqYl94-80m9ANl_gACLcBGAs/s1600/bbb2019.png" group-title="CANAIS GLOBO", BBB HD AQUECIMENTO
http://srv.test-channel.vip:8880/veLMOIkQ2l/10634
Gemorroj commented 5 years ago

@tschope I'll take a closer look at your PR, but later. Most likely on new year's holidays. I just don't have time to properly investigate the problem right now.

Gemorroj commented 5 years ago

pr14 i can't reproduce problem

tschope commented 5 years ago

Sorry for my delay. So, I have my data in database and I export the data this way:

php
       $this->entries = new M3uEntry();

        $this->info("Process generating file");

        $channels = Channels::where('to_export', 1)->get();
        foreach ($channels as $channel){
            //$this->info($channel->title);
            $this->entries->addExtTag(
                (new ExtInf())
                    ->setDuration($channel->duration)
                    ->setTitle($channel->title)
                    ->setPatch($channel->patch)
                    ->setAttribute('tvg-id', $channel->{"tvg-id"})
                    ->setAttribute('tvg-name', $channel->{"tvg-name"})
                    ->setAttribute('tvg-logo', $channel->{"tvg-logo"})
                    ->setAttribute('group-title', $channel->{"group-title"})
            );
        }

        $data = new M3uData();
        $data->setAttribute('x-tvg-url', 'http://epglink.co/bAxen');
        $data->append($this->entries);

        Storage::disk('local')->put('channels.m3u', $data);

the result is something like this:

#EXTM3U x-tvg-url="http://"
#EXTINF: -1 tvg-id="SPORTFHD.br" tvg-name="SPORT FHD" tvg-logo="https://4.bp.blogspot.com/-iDygr9PU0yo/XAh6QW80EtI/AAAAAAAACoE/K7zUw7IvW4IEMrJXmqYl94-80m9ANl_gACLcBGAs/s1600/bbb2019.png" group-title="CANAIS GLOBO", BBB FHD AQUECIMENTO
http://srv.test-channel.vip:8880/veLMOIkQ2l/10633
#EXTINF: -1 tvg-id="SPORTHD.br" tvg-name="SPORT HD" tvg-logo="https://4.bp.blogspot.com/-iDygr9PU0yo/XAh6QW80EtI/AAAAAAAACoE/K7zUw7IvW4IEMrJXmqYl94-80m9ANl_gACLcBGAs/s1600/bbb2019.png" group-title="CANAIS GLOBO", BBB HD AQUECIMENTO
http://srv.test-channel.vip:8880/veLMOIkQ2l/10632
#EXTINF: -1 tvg-id="SPORTSD.br" tvg-name="SPORT SD" tvg-logo="https://4.bp.blogspot.com/-iDygr9PU0yo/XAh6QW80EtI/AAAAAAAACoE/K7zUw7IvW4IEMrJXmqYl94-80m9ANl_gACLcBGAs/s1600/bbb2019.png" group-title="CANAIS GLOBO", BBB HD AQUECIMENTO
http://srv.test-channel.vip:8880/veLMOIkQ2l/10634

The main change is this line ->setPatch($channel->patch), this is add a url each line.

For me works like a charm. I did a duplicate repo with this changes only for project. If you accept my MR I will delete mine and keep only with yours. I cannot put here the final result because, well, you know, It's my paid IPTV list.

Anyway, thanks