aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas <jonaskarlsson@fripost.org>2013-01-16 22:46:08 +0100
committerJonas <jonaskarlsson@fripost.org>2013-01-20 17:14:03 +0100
commit4cded99c50b95e0aff2febe68cff183088a68dc1 (patch)
tree59a625975d267f9d4157ba41c0f450fcd713aa2b
parent188f1450a2d227d5863a454fdf45222257a5e511 (diff)
downloadget-flash-videos-4cded99c50b95e0aff2febe68cff183088a68dc1.tar.gz
Kanal5play plugin bug: Not a Hash reference
-rw-r--r--lib/FlashVideo/Site/Kanal5play.pm39
1 files changed, 20 insertions, 19 deletions
diff --git a/lib/FlashVideo/Site/Kanal5play.pm b/lib/FlashVideo/Site/Kanal5play.pm
index b750efe..3f9f88c 100644
--- a/lib/FlashVideo/Site/Kanal5play.pm
+++ b/lib/FlashVideo/Site/Kanal5play.pm
@@ -8,21 +8,22 @@ use FlashVideo::JSON;
my $bitrates = {
- "low" => 250000,
- "medium" => 450000,
- "high" => 900000 };
+ low => 250000,
+ medium => 450000,
+ high => 900000
+};
sub find_video {
my ($self, $browser, $embed_url, $prefs) = @_;
- if(!($browser->uri->as_string =~ m/video\/([0-9]*)/)){
- die "No video id found in url";
+ if (!($browser->uri->as_string =~ m/video\/([0-9]*)/)) {
+ die "No video id found in url";
}
my ($video_id) = $1;
my $info_url = "http://www.kanal5play.se/api/getVideo?format=FLASH&videoId=$video_id";
$browser->get($info_url);
-
- if (!$browser->success){
- die "Couldn't download $info_url: " . $browser->response->status_line;
+
+ if (!$browser->success) {
+ die "Couldn't download $info_url: " . $browser->response->status_line;
}
my $jsonstr = $browser->content;
@@ -35,19 +36,19 @@ sub find_video {
my ($rtmp) = "rtmp://fl1.c00608.cdn.qbrick.com:1935/00608";
my ($playpath) = $json->{streams}[0]->{source};
- my $i;
- foreach $i (keys %{ $json->{streams} }) {
- my ($rate) = int($json->{streams}[$i]->{bitrate});
- if($bitrates->{$prefs->{quality}} == $rate){
- $playpath = $json->{streams}[$i]->{source};
- }
+ foreach my $stream ($json->{streams}[0]) {
+ my ($rate) = int($stream->{bitrate});
+ if ($bitrates->{$prefs->{quality}} eq $rate) {
+ $playpath = $stream->{source};
+ last;
+ }
}
+
return {
- flv => title_to_filename($filename, "flv"),
- rtmp => $rtmp,
- playpath => $playpath,
- swfVfy => "http://www.kanal5play.se/flash/StandardPlayer.swf"
+ flv => title_to_filename($filename, "flv"),
+ rtmp => $rtmp,
+ playpath => $playpath,
+ swfVfy => "http://www.kanal5play.se/flash/StandardPlayer.swf"
};
-
}
1;