-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert.php
executable file
·77 lines (54 loc) · 2.19 KB
/
convert.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/*It's simple script to convert .m3u format playlist to .m3u format with
groups formating understandable to kodi + add favourites gruop.
Copyright (C) 2017 gymka
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
header('Content-Type: text/html; charset=utf-8');
//=========sąrašo konvertavimas į kodi suprantamą grupių rašymą=========
$list=file("link8jfakdjf.txt");
$play=file_get_contents(trim($list[0]));
$kanalai = explode("\n", $play);
unset($kanalai[0]);
foreach($kanalai as $n => $line) {
//echo $line."<br>";
if(stristr($line, "EXTGRP:")) {
$grupe=trim(str_replace("#EXTGRP:","",$line));
$pavadinimas=explode(",",$kanalai[$n-1]);
$pavadinimas=trim($pavadinimas[1]);
$kanalai[$n-1]="#EXTINF:0 group-title=\"$grupe\",$pavadinimas";
}
}
//====================mėgstamiausių grupės kūrimas======================
$megstamiausi=file('kanalai.txt');
for ($i=0; $i<count($megstamiausi); $i++)
{
$megstamiausi2=trim($megstamiausi[$i]);
$a=preg_grep("/.*,$megstamiausi2$/i",$kanalai);
foreach($a as $nr =>$nereikalinga) {
$mano_list[]=preg_replace("/group-title=\".*\"/","group-title=\"mano\"",$kanalai[$nr]);
$mano_list[]=$kanalai[$nr+2]; //+2, nes unset() sukuria tuscia elementą
}
}
//=====================sąrašo atvaizdavimas=============================
header("Content-Disposition: attachment; filename=\"edem_list.m3u");
echo "#EXTM3U\n";
for ($i=0; $i<count($kanalai); $i++)
{
if ($kanalai[$i]!="") {
echo $kanalai[$i]."\n"; }
}
for ($i=0; $i<count($mano_list); $i++)
{
echo $mano_list[$i]."\n";
}
?>