-
Notifications
You must be signed in to change notification settings - Fork 19
/
playlist.php
103 lines (71 loc) · 2.99 KB
/
playlist.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
78
79
80
81
<?php
include('config.php');
set_time_limit(0);
error_reporting(0);
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$agent = $_SERVER['HTTP_USER_AGENT'];
}
if (empty($_GET['username']) || empty($_GET['password'])) {
$error = "Username or Password is invalid";
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
header('Status: 404 Not Found');
die();
}
$user = User::where('username', '=', $_GET['username'])->where('password', '=', $_GET['password'])->where('active', '=', 1)->first();
if (!$user) {
die();
}
$setting = Setting::first();
if (isset($_GET['e2'])) {
echo "#NAME FOS-Streaming \r\n";
foreach ($user->categories as $category) {
foreach ($category->streams as $stream) {
if ($stream->running == 1) {
echo "#SERVICE 1:0:1:0:0:0:0:0:0:0:http%3A//" . $setting->webip . "%3A" . $setting->webport . "/live/" . $user->username . "/" . $user->password . "/" . $stream->id . "\r\n";
echo "#DESCRIPTION " . $stream->name . "\r\n";
}
}
}
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="userbouquet.favourites.tv"');
die;
}
if (isset($_GET['m3u'])) {
echo "#EXTM3U \r\n";
foreach ($user->categories as $category) {
foreach ($category->streams as $stream) {
if ($stream->running == 1) {
if (strlen(strstr($agent, 'Kodi')) > 0) {
echo "#EXTINF:0 tvg-logo=\"" . $stream->logo . "\" tvg-id=\"" . $stream->tvid . "\" ,[COLOR green]" . $stream->name . "[/COLOR]\r\n";
} else {
echo "#EXTINF:0 tvg-logo=\"" . $setting->logourl . "" . $stream->logo . "\" tvg-id=\"" . $stream->tvid . "\" ," . $stream->name . "\r\n";
}
echo "http://" . $setting->webip . ":" . $setting->webport . "/live/" . $user->username . "/" . $user->password . "/" . $stream->id . "\r\n";
}
}
}
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="tv_user.m3u"');
die;
}
if (isset($_GET['allfrtvwindows'])) {
echo "<?xml version=\"1.0\"?> \r\n";
echo "<channels> \r\n";
foreach ($user->categories as $category) {
foreach ($category->streams as $stream) {
if ($stream->running == 1) {
echo "<channel>\r\n";
echo "<name>" . $stream->name . "</name>\r\n";
echo "<HQ>http://" . $setting->webip . ":" . $setting->webport . "/live/" . $user->username . "/" . $user->password . "/" . $stream->id . "</HQ>\r\n";
echo "<typeHQ>hls</typeHQ>\r\n";
echo "<recordableHQ>true</recordableHQ>\r\n";
echo "<category>IPTV</category>\r\n";
echo "</channels>\r\n";
}
}
}
echo "</channel>\r\n";
header('Content-Type: text/xml');
header('Content-Disposition: attachment; filename="allfrtvwindows.xml"');
die;
}