diff options
author | James Bottomley <JBottomley@Parallels.com> | 2013-05-05 08:36:02 -0700 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-05-05 08:36:02 -0700 |
commit | 802bd6d0284d20bddf3f9a68a118e051b8ff902e (patch) | |
tree | b993f8c435d1c5d0e1d522bc7abd59863070c0bd | |
parent | fd82d985f81db5fbb4aa8a70dacd7a3f3b68caca (diff) | |
download | get-flash-videos-802bd6d0284d20bddf3f9a68a118e051b8ff902e.tar.gz |
Channel4: Fix correct selection of series and episode
Channel4 changed the way they display the on demand web page. Now all series
are present and the og:image method of determining the series and episode now
always picks up the latest even if you're downloading an earlier version.
Fix this by taking the series and episode from the dc:relation tags in the
feed instead
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | lib/FlashVideo/Site/Channel4.pm | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/FlashVideo/Site/Channel4.pm b/lib/FlashVideo/Site/Channel4.pm index 0dd7b91..9222b0e 100644 --- a/lib/FlashVideo/Site/Channel4.pm +++ b/lib/FlashVideo/Site/Channel4.pm @@ -28,15 +28,6 @@ sub find_video { my $page_url = $browser->uri->as_string; - # Determine series and episode. Channel 4 sometimes have these backwards, - # but as long as they differ there's less risk of overwriting or - # incorrectly resuming previous episodes from the same series. - my $series_and_episode; - if ($browser->content =~ /<meta\ property="og:image" - \ content="\S+series-(\d+)\/episode-(\d+)/x) { - $series_and_episode = sprintf "S%02dE%02d", $1, $2; - } - # Create a uid my $uid = int(time*1000); @@ -74,7 +65,13 @@ sub find_video { my $xml; - # Check for mp4 if not then try different assetId + # Determine series and episode. Channel 4 sometimes have these backwards, + # but as long as they differ there's less risk of overwriting or incorrectly + # resuming previous episodes from the same series. Currently take this from + # dc:relation.SeriesNumber and sd:relation.EpisodeNumber below + my $series_and_episode; + +# Check for mp4 if not then try different assetId my $lower_id = 0; my $upper_id = 9999999; if ($xml_ref->{assetInfo}->{uriData}->{streamUri} !~ /mp4$/ ) { @@ -107,6 +104,9 @@ sub find_video { ' Episode ' . $entry->{'dc:relation.EpisodeNumber'} . ' ProgrammeId ' . $entry->{'dc:relation.programmeId'} . ' Url ' . $ps3_url; + $series_and_episode = sprintf("S%02dE%02d", + $entry->{'dc:relation.SeriesNumber'}, + $entry->{'dc:relation.EpisodeNumber'}); $raw_xml = $browser->get($ps3_url); if ($browser->success) { my $xml_off = from_xml($raw_xml); @@ -202,7 +202,7 @@ sub find_video { if (@title_components) { $title = join " - ", @title_components; } - + debug("title_to_filename on $title"); my $filename = title_to_filename($title, "flv"); # Get subtitles if necessary. |