Skip to content

Commit

Permalink
Vodafone.pt Grabber - Add ranking and images
Browse files Browse the repository at this point in the history
  • Loading branch information
nsenica committed Jan 19, 2025
1 parent e899889 commit 1472a47
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion grab/pt_vodafone/tv_grab_pt_vodafone
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,54 @@ sub get_epg
}

# fetch programme images in 16:9
$prog{icon} = [ { src => $programme->{images}[0]{url}."/height/480/quality/95" } ] if ($programme->{images}[0]{url});
$prog{icon} = [ { src => $programme->{images}[0]{url}."/width/360/height/640/quality/95" } ] if ($programme->{images}[0]{url} && $programme->{images}[0]{imageTypeName} eq "ca" );
$prog{icon} = [ { src => $programme->{images}[0]{url}."/width/640/height/360/quality/95" } ] if ($programme->{images}[0]{url} && $programme->{images}[0]{imageTypeName} eq "cc");

if ( $programme->{tags}{genre} ) {
my @category = map { [ sanitizeUTF8($_->{value}) , 'pt' ] } @{$programme->{tags}{genre}{objects}};
$prog{category} = \@category;
}
$prog{country} = [ [ sanitizeUTF8($programme->{tags}{'country of production'}{objects}[0]{value}), 'pt' ] ] if $programme->{tags}{'country of production'};

if ($programme->{tags}{'parental Rating'}) {
my $rating;
if ($programme->{tags}{'parental Rating'}{objects}[0]{value} == 0) {
$rating = [ [ "All Ages", 'Portuguese Movie Rating' ] ];
} else {
$rating = [ [ "M/".$programme->{tags}{'parental Rating'}{objects}[0]{value}, 'Portuguese Movie Rating' ] ];
}
$prog{rating} = $rating if $rating;
}

my @images;
for my $image (@{$programme->{images}}) {
next if !$image->{url};

my $type = "";
my $orient = "";
my $size = 3;
my $system = "vodafone";
my $width = 640;
my $height = 360;

if ($image->{imageTypeName} eq "cc") {
$orient = "L";
$type = "still";
} elsif ($image->{imageTypeName} eq "ca") {
$orient = "P";
$type = "poster";
$width = 360;
$height = 640;
} elsif ($image->{imageTypeName} eq "bg") {
$orient = "L";
$type = "backdrop";
}

my $url = $image->{url};
push @images, [ $image->{url}."/width/".$width."/height/".$height."/quality/95", { type => $type, size => $size, orient => $orient, system => $system } ];
}
$prog{image} = \@images if scalar @images;

$prog{date} = sanitizeUTF8($programme->{metas}{year}{value}) if $programme->{metas}{year}{value};

if ( $programme->{tags}{actors} ) {
Expand Down

0 comments on commit 1472a47

Please sign in to comment.