[PATCH 3/3] Web PVR: use dynamic discovery of configured ffmpeg

dinkypumpkin dinkypumpkin at gmail.com
Wed Sep 26 14:53:08 EDT 2012


The location of ffmpeg may be changed during update by the Windows
installer and thus should not be hard-coded in get_iplayer.cgi.cmd.
This change enables web pvr to query get_iplayer for configured
ffmpeg if it is not specified on get_iplayer.cgi command line.  This
is probably only relevant on Windows, where ffmpeg will not generally
be in PATH.
---
 get_iplayer.cgi                         |   13 ++++++++++++-
 windows/get_iplayer/get_iplayer.cgi.cmd |    2 +-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/get_iplayer.cgi b/get_iplayer.cgi
index 62da240..d7f9103 100755
--- a/get_iplayer.cgi
+++ b/get_iplayer.cgi
@@ -88,7 +88,6 @@ EOF
 
 # Some defaults
 my $default_modes = 'flashaachigh,flashaacstd,flash,realaudio,flashaaclow';
-$opt_cmdline->{ffmpeg} = 'ffmpeg' if ! $opt_cmdline->{ffmpeg};
 $opt_cmdline->{listen} = '0.0.0.0' if ! $opt_cmdline->{listen};
 # Search for get_iplayer
 if ( ! $opt_cmdline->{getiplayer} ) {
@@ -100,6 +99,18 @@ if ( ( ! $opt_cmdline->{getiplayer} ) || ! -f $opt_cmdline->{getiplayer} ) {
 	print "ERROR: Cannot find get_iplayer, please specify its location using the --getiplayer option.\n";
 	exit 2;
 }
+if ( ! $opt_cmdline->{ffmpeg} ) {
+	chomp(my @ffmpegs = map { s/^\s*ffmpeg\s*=\s*// ? $_ : () } 
+		get_cmd_output(
+			$opt_cmdline->{getiplayer},
+			'--nopurge',
+			'--nocopyright',
+			'--show-options'
+		)
+	);
+	$opt_cmdline->{ffmpeg} = pop @ffmpegs;
+}
+$opt_cmdline->{ffmpeg} = 'ffmpeg' if ! $opt_cmdline->{ffmpeg};
 
 # Path to get_iplayer (+ set HOME env var cos apache seems to not set it)
 my $home = $ENV{HOME};
diff --git a/windows/get_iplayer/get_iplayer.cgi.cmd b/windows/get_iplayer/get_iplayer.cgi.cmd
index 5ebbeb3..613c368 100644
--- a/windows/get_iplayer/get_iplayer.cgi.cmd
+++ b/windows/get_iplayer/get_iplayer.cgi.cmd
@@ -1,2 +1,2 @@
 @echo off
-perl.exe get_iplayer.cgi --port 1935 --listen=127.0.0.1 --ffmpeg .\ffmpeg\bin\ffmpeg.exe --getiplayer .\get_iplayer.cmd
+perl.exe get_iplayer.cgi --port 1935 --listen=127.0.0.1 --getiplayer .\get_iplayer.cmd
-- 
1.7.10.2 (Apple Git-33)




More information about the get_iplayer mailing list