Skip to content
notnac edited this page Feb 19, 2021 · 18 revisions

get_iplayer Web PVR Manager (Server README)

The world's most insecure web-based PVR manager for get_iplayer

WARNING: Never run this in an untrusted environment or facing the internet

Features

Run with standalone web server

  • By default this will run as the logged-in user

  • On Linux start with:

      get_iplayer.cgi -p 1935 [-l 127.0.0.1] [-g /path/to/get_iplayer] [--ffmpeg /path/to/ffmpeg]
    
  • On macOS start with:

      get_iplayer_cgi -p 1935 [-l 127.0.0.1] [-g /path/to/get_iplayer] [--ffmpeg /path/to/ffmpeg]
    
  • On Windows start with:

      get_iplayer_cgi.cmd -p 1935 [-l 127.0.0.1] [-g \path\to\get_iplayer] [--ffmpeg \path\to\ffmpeg]
    
  • Access in web browser using: http://127.0.0.1:1935

Options:
 --listen,-l        Use the built-in web server and listen on this interface address (default: 0.0.0.0)
 --port,-p          Use the built-in web server and listen on this TCP port
 --getiplayer,-g    Path to the get_iplayer script
 --ffmpeg           Path to the ffmpeg binary
 --encodinglocalefs Encoding for file names (default: Linux/Unix/OSX = UTF-8, Windows = cp1252)
 --debug            Debug mode
 --baseurl,-b       Base URL for link generation. Set to full proxy URL if running behind reverse proxy.
 --help,-h          This help text

Installation as Apache CGI script

NOTE: CGI installation is unsupported. This is an example for information purposes only.

Example uses Ubuntu 16.04. Adjust to suit your system.

  • Perform a manual installation of get_iplayer:

  • Install Apache web server:

      sudo apt-get install apache2
    
  • Enable Apache CGI module:

      sudo a2enmod cgi
    
  • Create file /etc/apache2/conf-enabled/webpvr.conf with contents below (adjust as needed for your Apache configuration):

    To run at path /webpvr:

      ScriptAlias /webpvr /usr/local/bin/get_iplayer.cgi
      SetEnv HOME /var/www/webpvr
      SetEnvIfNoCase Request_URI /webpvr no-gzip dont-vary
    

    To run on separate port (e.g., 1935) instead:

      Listen 1935
      <VirtualHost *:1935>
      ScriptAlias / /usr/local/bin/get_iplayer.cgi
      SetEnv HOME /var/www/webpvr
      SetEnv no-gzip dont-vary
      </VirtualHost>
    
  • Restart Apache:

      sudo systemctl restart apache2
    
  • Create dirs in /var/www/webpvr:

      sudo mkdir -p /var/www/webpvr/output /var/www/webpvr/.get_iplayer
    
  • Allow access to Apache user/group:

      sudo chown -R www-data:www-data /var/www/webpvr
    
  • Perform one-off output directory configuration:

      sudo -u www-data get_iplayer --profile-dir=/var/www/webpvr/.get_iplayer --prefs-add --output=/var/www/webpvr/output
    
  • Seed programme index cache:

      sudo -u www-data get_iplayer --profile-dir=/var/www/webpvr/.get_iplayer --refresh --type=all
    
  • Access using http://<hostname>/webpvr or http://<hostname>:1935

  • Recordings will be in /var/www/webpvr/output

Set up crontab for PVR to run (optional)

  • Example assumes Apache user/group is www-data/www-data

  • Add a line in /etc/crontab to run the pvr daily:

      * 0 * * * www-data /usr/local/bin/get_iplayer --profile-dir=/var/www/webpvr/.get_iplayer --pvr 2>/dev/null
    

Usage

  • Where examples below show Web PVR Manager running with CGI script at http://localhost/webpvr, you can also use standalone web server (assuming port 1935) at http://localhost:1935/
  • You can open most of these URLs with vlc <URL> or mplayer -cache=<kb> <URL>
  • Note: Ensure you open the playlist window in VLC

Direct Streaming of Recorded Content

  • Stream pre-recorded <TYPE> programme with <PID> and <MODE> (and optional OUTTYPE format)

      http://localhost/webpvr?ACTION=direct&PROGTYPES=<TYPE>&PID=<PID>&MODES=<MODE>[&OUTTYPE=<OUTTYPE>]
    

    OUTTYPE can be one of:

      none     = Disable Transcoding
      flv      = Flash Video (H.264/MP3)
      mpegts   = MPEG Transport Stream (H.264/MP2)
      matroska = Matroska (H.264/Vorbis)
      asf      = Advanced Systems Format (H.264/WMA)
      mp3      = MP3 (Audio Only)
      adts     = AAC (Audio Only)
      oga      = Vorbis (Audio Only) 
      wav      = WAV (Audio Only) 
      flac     = FLAC (Audio Only)
    

    OUTTYPE=none means use native format (i.e., mp4 or m4a) for streaming (no transcoding). Default OUTTYPE=flv.

  • Example: TV programme with PID=b08c3kjz and MODE=hlshd1 (default OUTTYPE=flv)

      http://localhost/webpvr?ACTION=direct&PROGTYPES=tv&PID=b08c3kjz&MODES=hlshd1
    
  • Example: TV programme with PID= b08c3kjz and MODE=hlshd1 and OUTTYPE=none (use native format: mp4)

      http://localhost/webpvr?ACTION=direct&PROGTYPES=tv&PID=b08c3kjz&MODES=hlshd1&OUTTYPE=none
    
  • Example: Radio programme with PID=b00cb5k4 and MODE=dashhigh1 and transcoded to OUTTYPE=mp3

      http://localhost/webpvr?ACTION=direct&PROGTYPES=radio&PID=b00cb5k4&MODES=dashhigh1&OUTTYPE=mp3
    

Playlists of Recorded Content

Playlists can also be manually constructed in the Recordings tab.

Streaming from local disk:

  • Open an M3U playlist with pre-recorded <TYPE> programmes with <SEARCH> in the name (open this with vlc)

      http://localhost/webpvr?ACTION=playlistfiles&SEARCHFIELDS=name&SEARCH=<SEARCH>&PROGTYPES=<TYPE>
    
  • Example: Pre-recorded TV programmes with 'weather' in the name field:

      http://localhost/webpvr?ACTION=playlistfiles&SEARCHFIELDS=name&SEARCH=weather&PROGTYPES=tv
    

Remote streaming:

  • Open an M3U playlist with pre-recorded <TYPE> programmes with <SEARCH> in the name (open this with vlc)

      http://remotehost/webpvr?ACTION=playlistdirect&SEARCHFIELDS=name&SEARCH=<SEARCH>&PROGTYPES=<TYPE>
    
  • Example: Pre-recorded radio programmes with 'quiz' in the name field:

      http://remotehost/webpvr?ACTION=playlistdirect&SEARCHFIELDS=name&SEARCH=quiz&PROGTYPES=radio
    
Clone this wiki locally