aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzakflash <zakflashvideo@gmail.com>2013-01-23 12:43:33 -0800
committerzakflash <zakflashvideo@gmail.com>2013-01-23 12:43:33 -0800
commit2f12e6dc9cd2ee3ecc9df285431ef6f207c0d7df (patch)
treedbb67ccaed9e6d17d6e67f47e6eafa9a428e5712
parent86e726ca274be06fc56e62e142d6446cf1bce878 (diff)
parent4cded99c50b95e0aff2febe68cff183088a68dc1 (diff)
downloadget-flash-videos-2f12e6dc9cd2ee3ecc9df285431ef6f207c0d7df.tar.gz
Merge pull request #87 from karjonas/master
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;