#!/usr/bin/env perl # # get_iplayer - Lists, Records and Streams BBC iPlayer TV and Radio programmes and BBC podcasts # # Copyright (C) 2008-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 . # # Author: Phil Lewis # Email: iplayer2 (at sign) linuxcentre.net # Web: https://github.com/get-iplayer/get_iplayer/wiki # License: GPLv3 (see LICENSE.txt) # # package main; my $version = 2.94; my $version_text = "2.95-dev"; $version_text = sprintf("v%.2f", $version) unless $version_text; # # Help: # ./get_iplayer --help | --longhelp # # Changelog: # https://github.com/get-iplayer/get_iplayer/commits/master # # Example Usage and Examples: # https://github.com/get-iplayer/get_iplayer/wiki/documentation # # Todo: # ** all global vars into a class??? # ** Cut down 'use' clauses in each class # * Add PVR search src to recording history # * Fix unicode / wide chars in rdf # # Known Issues: # * CAVEAT: The filenames and modes in the history are comma-separated if there was a multimode download. For now it just uses the first one. # use Env qw[@PATH]; use Fcntl; use File::Copy; use File::Path; use File::stat; use File::Spec; use Getopt::Long; use HTML::Entities; use HTTP::Cookies; use HTTP::Headers; use IO::Seekable; use IO::Socket; use LWP::ConnCache; use LWP::UserAgent; use POSIX qw(mkfifo strftime); use POSIX qw(:termios_h); use strict; #use warnings; use Time::Local; use Unicode::Normalize; use URI; use open qw(:utf8); use Encode qw(:DEFAULT :fallback_all); use PerlIO::encoding; $PerlIO::encoding::fallback = XMLCREF; use constant FB_EMPTY => sub { '' }; my %SIGORIG; # Save default SIG actions $SIGORIG{$_} = $SIG{$_} for keys %SIG; $|=1; # Save proxy env var my $ENV_HTTP_PROXY = $ENV{HTTP_PROXY} || $ENV{http_proxy}; # Hash of where plugin files were found so that the correct ones can be updated my %plugin_files; # Hash of all prog types => Programme class # Add an entry here if another Programme class is added my %prog_types = ( tv => 'Programme::tv', radio => 'Programme::radio', liveradio => 'Programme::liveradio', livetv => 'Programme::livetv', podcast => 'Programme::podcast', localfiles => 'Programme::localfiles', ); # Programme instance data # $prog{$pid} = Programme->new ( # 'index' => , # 'name' => , # 'episode' => , # 'desc' => , # 'available' => , # 'duration' => # 'versions' => # 'thumbnail' => # 'channel => # 'categories' => # 'type' => # 'timeadded' => # 'version' => # 'filename' => # 'dir' => # 'fileprefix' => # 'ext' => #); # Define general 'option names' => ( ,