Add patches from upstream git repo. Fixes another cdn

This commit is contained in:
sthen 2010-05-26 20:24:23 +00:00
parent b9c2edde22
commit 36ffe09c56
2 changed files with 87 additions and 5 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.41 2010/05/26 20:13:06 sthen Exp $
# $OpenBSD: Makefile,v 1.42 2010/05/26 20:24:23 sthen Exp $
COMMENT = download BBC iPlayer and ITV programmes
DISTNAME = get_iplayer-2.77
PKGNAME = ${DISTNAME}p0
CATEGORIES = multimedia
HOMEPAGE = http://linuxcentre.net/get_iplayer/

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-get_iplayer,v 1.34 2010/05/26 20:13:06 sthen Exp $
$OpenBSD: patch-get_iplayer,v 1.35 2010/05/26 20:24:23 sthen Exp $
--- get_iplayer.orig Wed May 26 14:19:02 2010
+++ get_iplayer Wed May 26 21:08:24 2010
+++ get_iplayer Wed May 26 21:23:26 2010
@@ -327,7 +327,7 @@ mkpath $profile_dir if ! -d $profile_dir;
@ -10,7 +10,7 @@ $OpenBSD: patch-get_iplayer,v 1.34 2010/05/26 20:13:06 sthen Exp $
my $plugin_dir_user = "$profile_dir/plugins";
for my $plugin_dir ( ( $plugin_dir_user, $plugin_dir_system ) ) {
if ( opendir( DIR, $plugin_dir ) ) {
@@ -645,12 +645,12 @@ sub init_search {
@@ -645,12 +645,13 @@ sub init_search {
delete $binopts->{vlc};
push @{ $binopts->{vlc} }, '-vv' if $opt->{debug};
@ -22,10 +22,11 @@ $OpenBSD: patch-get_iplayer,v 1.34 2010/05/26 20:13:06 sthen Exp $
- $bin->{flvstreamer} = $opt->{flvstreamer} || 'flvstreamer';
+ $bin->{flvstreamer} = $opt->{flvstreamer} || 'rtmpdump';
+
delete $binopts->{flvstreamer};
push @{ $binopts->{flvstreamer} }, ( '--timeout', 10 );
push @{ $binopts->{flvstreamer} }, '--quiet' if $opt->{quiet};
@@ -4063,7 +4063,7 @@ sub tag_file {
@@ -4063,7 +4064,7 @@ sub tag_file {
my ( $id3_name, $id3_episode, $id3_desc, $id3_channel ) = ( $prog->{name}, $prog->{episode}, $prog->{desc}, $prog->{channel} );
s|"|\\"|g for ($id3_name, $id3_episode, $id3_desc, $id3_channel);
# Only tag if the required tool exists
@ -34,3 +35,83 @@ $OpenBSD: patch-get_iplayer,v 1.34 2010/05/26 20:13:06 sthen Exp $
main::logger "INFO: id3 tagging $prog->{ext} file\n";
my @cmd = (
$bin->{id3v2},
@@ -5611,6 +5612,24 @@ sub get_stream_data_cdn {
my $count = 1;
for my $cattribs ( @{ $mattribs->{connections} } ) {
+
+ # Get authstring from more specific mediaselector if this mode is specified - fails sometimes otherwise
+ if ( $cattribs->{authString} && $cattribs->{kind} =~ /^(limelight|akamai|level3|sis|iplayertok)$/ && (grep /^$mode$/, (split /,/, $mattribs->{modelist})) ) {
+ # Build URL
+ my $media_stream_data_prefix = 'http://www.bbc.co.uk/mediaselector/4/mtis/stream/';
+ my $url = $media_stream_data_prefix."$mattribs->{verpid}/$mattribs->{service}/$cattribs->{kind}?cb=".( sprintf "%05.0f", 99999*rand(0) );
+ my $xml = main::request_url_retry( main::create_ua( 'desktop' ), $url, 3, undef, undef, 1 );
+ main::logger "\n$xml\n" if $opt->{debug};
+ # get new set of connection attributes from the new xml data
+ my $new_mattribs = (parse_metadata( $xml ))[0];
+ my $new_cattribs = $new_mattribs->{connections}[0];
+ # Override elemnts from more specific connection attribs if present
+ for my $element ( keys %{ $new_cattribs } ) {
+ $cattribs->{$element} = $new_cattribs->{$element} if $new_cattribs->{$element};
+ }
+ }
+ decode_entities($cattribs->{authString});
+
# Common attributes
# swfurl = Default iPlayer swf version
my $conn = {
@@ -5643,24 +5662,29 @@ sub get_stream_data_cdn {
$conn->{authstring} = $cattribs->{authString};
}
+ $conn->{playpath} = $cattribs->{identifier};
+ $conn->{streamurl} = "rtmp://$cattribs->{server}:1935/$cattribs->{application}?_fcs_vhost=$cattribs->{server}&undefined";
+ $conn->{application} = "$cattribs->{application}?_fcs_vhost=$cattribs->{server}&undefined";
+
if ( $cattribs->{authString} ) {
+ if ( $cattribs->{authString} !~ /&aifp=/ ) {
+ $cattribs->{authString} .= '&aifp=v001';
+ }
+
+ if ( $cattribs->{authString} !~ /&slist=/ ) {
+ $cattribs->{identifier} =~ s/^mp[34]://;
+ $cattribs->{authString} .= '&slist=&cattribs->{identifier}';
+ }
+
### ??? live and Live TV, Live EMP Video or Non-public EMP video:
- $conn->{playpath} = "$cattribs->{identifier}?$cattribs->{authString}&aifp=v001";
+ $conn->{playpath} .= "?$cattribs->{authString}";
+ $conn->{streamurl} .= "&$cattribs->{authString}";
+ $conn->{application} .= "&$cattribs->{authString}";
} else {
- $conn->{playpath} = $cattribs->{identifier};
+ $conn->{streamurl} .= "&undefined";
+ $conn->{application} .= "&undefined";
}
- if ( $cattribs->{authString} ) {
- $conn->{streamurl} = "rtmp://$cattribs->{server}:1935/$cattribs->{application}?_fcs_vhost=$cattribs->{server}&auth=$cattribs->{authString}&aifp=v001&slist=$cattribs->{identifier}";
- } else {
- $conn->{streamurl} = "rtmp://$cattribs->{server}:1935/$cattribs->{application}?_fcs_vhost=$cattribs->{server}&undefined";
- }
- # Remove offending mp3/mp4: at the start of the identifier (don't remove in stream url)
- $cattribs->{identifier} =~ s/^mp[34]://;
- if ( $cattribs->{authString} ) {
- $conn->{application} = "$cattribs->{application}?_fcs_vhost=$cattribs->{server}&$cattribs->{authString}&aifp=v001&slist=$cattribs->{identifier}";
- } else {
- $conn->{application} = "$cattribs->{application}?_fcs_vhost=$cattribs->{server}&undefined";
- }
+
# Port 1935? for live?
$conn->{tcurl} = "rtmp://$cattribs->{server}:80/$conn->{application}";
@@ -5828,6 +5852,10 @@ sub get_stream_data {
my $mode;
for my $mattribs ( @medias ) {
+ # Put verpid into mattribs
+ $mattribs->{verpid} = $verpid;
+ $mattribs->{modelist} = $prog->modelist;
+
# New iphone stream
if ( $mattribs->{service} eq 'iplayer_streaming_http_mp4' ) {
# Fix/remove some audio stream attribs