forked from get-iplayer/get_iplayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README-get_iplayer.cgi.txt
253 lines (141 loc) · 7.65 KB
/
README-get_iplayer.cgi.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
get_iplayer Web PVR Manager
-----------------------
The world's most insecure web-based PVR manager and streaming proxy for get_iplayer
** WARNING ** Never run this in an untrusted environment or facing the internet
Copyright (C) 2009-2010 Phil Lewis
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/>.
Author: Phil Lewis
Email: iplayer2 (at sign) linuxcentre.net
License: GPLv3 (see LICENSE.txt)
Features
--------
* Search for programmes
* List/Add/Remove PVR entries
* Acts as a proxy to stream any programme over HTTP
* Automatically generates playlists for any programme type
* See web site:
http://www.infradead.org/get_iplayer/html/get_iplayer.html
Run with embedded web server
----------------------------
* By default this will run as the user you start the script with
* Start with:
./get_iplayer.cgi -p 1935 [-g /path/to/get_iplayer] [-l 127.0.0.1] [--ffmpeg /path/to/ffmpeg]
* On Win32 start with:
perl.exe .\get_iplayer.cgi -p 1935 [-g \path\to\get_iplayer] [-l 127.0.0.1] [--ffmpeg \path\to\ffmpeg]
* Access using:
http://localhost:1935/
Installation as Apache CGI script
---------------------------------
* Run the below commands as root
* Create dirs in /var/www/get_iplayer/:
mkdir -p /var/www/get_iplayer/output /var/www/get_iplayer/.get_iplayer
* Allow apache user to write to these dirs:
chown apache.apache /var/www/get_iplayer/output /var/www/get_iplayer/.get_iplayer
* Copy get_iplayer.cgi and get_iplayer into /var/www/get_iplayer/
cp -p get_iplayer.cgi get_iplayer /var/www/get_iplayer/
* Ensure they are executable:
chmod 755 /var/www/get_iplayer/get_iplayer.cgi /var/www/get_iplayer/get_iplayer
* Perform one-off plugins setup:
/var/www/get_iplayer/get_iplayer --profile-dir /var/www/get_iplayer/.get_iplayer --plugins-update
* Ensure you have the following lines in Apache's httpd.conf:
ScriptAlias /iplayer "/var/www/get_iplayer/get_iplayer.cgi"
SetEnv HOME /var/www/get_iplayer/
* This will run as apache's user/group and save all settings files in /var/www/get_iplayer/.get_iplayer
* Ensure that ffmpeg is in the default system PATH that apache exports such as /usr/bin/
* Ensure that rtmpdump (and other binaries) are in the default system PATH that apache exports such as /usr/bin/ or
specify their locations in /var/www/get_iplayer/.get_iplayer/options, and specify a default output directory in
/var/www/get_iplayer/.get_iplayer/options, e.g.:
output /var/www/get_iplayer/output
ffmpeg /usr/bin/ffmpeg
rtmpdump /path/to/rtmpdump
mplayer /path/to/mplayer
atomicparsley /path/to/atomicparsley
id3v2 /path/to/id3v2
* Make sure that apache user can see and execute the binaries
* Access using http://<your web server>/iplayer
* Recordings will be in /var/www/get_iplayer/output/
Usage
------
* Assumes web server is running with script at 'http://localhost/iplayer'
* Embedded web server can be accessed (assuming port 1935) as 'http://localhost:1935/' or 'http://localhost:1935/iplayer'
* Valid OUTTYPE values are: wav,mp3,rm,flv,mov
* You can open most of these URLs as 'vlc <URL>' or 'mplayer -cache=<kb> <URL>'
* Note: Ensure you open the playlist window in VLC
Streaming URLs
--------------
* Stream flash AAC liveradio as 320k mp3 stream:
mplayer -cache 1024 "http://localhost/iplayer?ACTION=stream&PROGTYPES=liveradio&PID=<PID>&BITRATE=320&MODES=flashaac&OUTTYPE=nnn.mp3"
* Stream flash livetv as flv stream:
mplayer -cache 1024 "http://localhost/iplayer?ACTION=stream&PROGTYPES=livetv&PID=<PID>&MODES=flashnormal&OUTTYPE=nnn.flv"
* Stream flash AAC liveradio as an uncompressed wav stream:
mplayer -cache 1024 "http://localhost/iplayer?ACTION=stream&PROGTYPES=liveradio&PID=<PID>&MODES=flashaac&OUTTYPE=nnn.wav"
* Stream flash mp3 radio as http mp3 stream:
mplayer -cache 1024 "http://localhost/iplayer?ACTION=stream&PROGTYPES=radio&PID=<PID>&MODES=flashaudio&OUTTYPE=nnn.mp3"
* Stream flash mp3 radio as http flac stream:
mplayer -cache 1024 "http://localhost/iplayer?ACTION=stream&PROGTYPES=radio&PID=<PID>&MODES=flashaudio&OUTTYPE=nnn.flac"
Direct Streaming of Recorded Content
------------------------------------
* Stream Pre-recorded <TYPE> Programme with <PID> and <MODE>
http://localhost/?ACTION=direct&PROGTYPES=<TYPE>&PID=<PID>&MODES=<MODE>
Playlists of Recorded Content
-----------------------------
* Create an M3U playlist with pre-recorded <TYPE> programmes with <SEARCH> in the PID (open this in vlc)
http://localhost/?ACTION=playlistfiles&SEARCHFIELDS=pid&SEARCH=<SEARCH>&PROGTYPES=<TYPE>
* Create an M3U playlist with pre-recorded 'tv' programmes with 'news' in the 'name' field (open this in vlc)
http://localhost/?ACTION=playlistfiles&SEARCHFIELDS=name&SEARCH=news&PROGTYPES=tv
Automatic Playlists
-------------------
* All radio programmes - all modes (flashaac,flashaudio,wma):
http://127.0.0.1/iplayer?ACTION=playlist&PROGTYPES=radio
* All TV programmes - all modes (flashhigh,flashstd,flashnormal,flashlow):
http://127.0.0.1/iplayer?ACTION=playlist&PROGTYPES=tv
* All livetv channels:
http://127.0.0.1/iplayer?ACTION=playlist&PROGTYPES=livetv
* All liveradio channels:
http://127.0.0.1/iplayer?ACTION=playlist&PROGTYPES=liveradio
More specific examples:
* All live radio channels (e.g. flashaac as flv):
http://127.0.0.1/iplayer?ACTION=playlist&PROGTYPES=liveradio&MODES=flashaac&OUTTYPE=flv
* All live radio channels (e.g. flashaac as wav):
http://127.0.0.1/iplayer?ACTION=playlist&PROGTYPES=liveradio&MODES=flashaac&OUTTYPE=wav
* All radio programmes (e.g. flash):
http://127.0.0.1/iplayer?ACTION=playlist&PROGTYPES=radio&MODES=flash&OUTTYPE=flv
* All live radio channels with a single digit in their name
http://127.0.0.1/iplayer?ACTION=playlist&PROGTYPES=liveradio&SEARCH=\d
* All TV programmes with the word 'news' in their name:
http://127.0.0.1/iplayer?ACTION=playlist&PROGTYPES=tv&SEARCH=news
Automatic OPML Playlists (works with Squeezebox)
------------------------------------------------
See: http://wiki.slimdevices.com/index.php/OPMLSupport for details on syntax
In Squeezecenter, Add this URL to 'Favourites' and you will be able to navigate the programmes:
* BBC iPlayer Listen Again:
http://<SERVER IP>/iplayer?ACTION=opml&PROGTYPES=radio&LIST=channel
* BBC iPlayer Live Flash AAC:
http://<SERVER IP>/iplayer?ACTION=opml&PROGTYPES=liveradio&OUTTYPE=wav
* BBC iPlayer Live Flash AAC (Numbered Channels only)
http://<SERVER IP>/iplayer?ACTION=opml&PROGTYPES=liveradio&MODES=flash&SEARCH=%20\d&OUTTYPE=wav
Set up crontab for PVR to run
----------------------------
* Add a line in /etc/crontab to run the pvr:
0 * * * * apache /usr/bin/get_iplayer --pvr 2>/dev/null
Caveats
--------
* Sometimes takes a while to load page while refreshing caches
* If a boolean param is in the cookies then it overrides the unchecked status on
the form regardless
* When using the stream, playlist or play links directly, cookies are not sent
and the settings are not applied
Todo
-----
* Manual flush of indices (maybe normally set --expiry to 99999999 and warn that indices are out of date)
* in general, take presentation data out of the html and into css, take scripting out of the html and into the js
* Add a button to save the playlist in M3U or OPML (playlist of selected progs?)