-
Notifications
You must be signed in to change notification settings - Fork 0
/
HLS Proxy.txt
116 lines (99 loc) · 3.08 KB
/
HLS Proxy.txt
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
Some usefull links
https://hub.docker.com/r/sybdata/hlsproxy/
https://github.com/sybdata/acearm
https://github.com/sybdata/hlsproxy-arm
http://www.hls-proxy.com/docs.php
https://www.hls-proxy.com/downloads/
#-------------------------------------------------------------------------------------
VERSION="5.9.2"
#https://www.hls-proxy.com/downloads/5.5.1/hls-proxy-5.5.1.linux-armv7.zip
cd ~
mv hls-proxy.linux-armv7.zip hls-proxy.linux-armv7-old.zip
wget https://www.hls-proxy.com/downloads/${VERSION}/hls-proxy-${VERSION}.linux-armv7.zip -O hls-proxy-${VERSION}.linux-armv7.zip
sudo unzip -d /opt/hls-proxy-${VERSION} hls-proxy-${VERSION}.linux-armv7.zip
sudo chown -R pi.pi /opt/hls-proxy-${VERSION}
sudo ln -s /opt/hls-proxy-${VERSION} /opt/hls-proxy
cat << "EOF" | sudo tee /etc/systemd/system/hls-proxy.service
[Unit]
Description=Caching HLS proxy for IPTV
After=multi-user.target
[Service]
User=pi
ExecStart=/opt/hls-proxy/hls-proxy
ExecReload=/bin/kill -HUP $MAINPID
ExecStop=/bin/kill -HUP $MAINPID
KillMode=process
Restart=always
ExecStartPre=/bin/sleep 5
[Install]
WantedBy=multi-user.target
Alias=hls-proxy.service
EOF
cp -p /opt/hls-proxy/default.json /opt/hls-proxy/default.json_orig
sed -i '1,/"port"/ s/80/8080/' /opt/hls-proxy/default.json
sed -i '6 s:^://:;8 s:^://:;10 s:^://:;12 s:^://:;13 s:^://:;14 s:^://:;' /opt/hls-proxy/default.json
cat << EOF > /opt/hls-proxy/local.json
{
"playlists": [
{
"name": "mytv",
"type": "file",
"uri": "/media/video/mytv.m3u8",
"localCopy": "",
"isUseLocalAceStreamMediaProxy": false,
"aceStreamMediaProxyURL": ""
}
],
"grouping": {
"isGroupDetectionEnabled": false,
"isAddEXTGRP": false
}
}
EOF
sudo systemctl daemon-reload
sudo systemctl enable hls-proxy
sudo systemctl start hls-proxy
journalctl -u hls-proxy -f
#------------------------------------
sudo apt-get -y install nginx
sudo cp -p /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak
sudo systemctl stop nginx
cat << EOF | sudo tee /etc/nginx/sites-available/default
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location = /epg
{
return 302 http://192.168.11.114:8080/epg.xml.gz;
}
location = /mytv
{
return 302 http://192.168.11.114:8080/playlist.m3u8;
}
location = /playlist.m3u8
{
proxy_pass http://127.0.0.1:8080$request_uri;
proxy_hide_header Content-Type;
add_header Content-Type application/octet-stream;
}
location /m3u8
{
proxy_pass http://127.0.0.1:8080;
proxy_hide_header Content-Type;
add_header Content-Type application/octet-stream;
}
}
EOF
sudo systemctl start nginx
sudo systemctl status nginx