package GCPlugins::GCgames::GCJeuxVideoCom; ################################################### # # Copyright 2005-2010 Tian # # This file is part of GCstar. # # GCstar is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # GCstar is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GCstar; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA # ################################################### use strict; use utf8; use GCPlugins::GCgames::GCgamesCommon; { package GCPlugins::GCgames::GCPluginJeuxVideoCom; use base 'GCPlugins::GCgames::GCgamesPluginsBase'; sub start { my ($self, $tagname, $attr, $attrseq, $origtext) = @_; $self->{inside}->{$tagname}++; return if $self->{parsingEnded}; if ($self->{parsingList}) { if (($tagname eq 'div') && (($attr->{id} eq 'new_mc') || ($attr->{id} eq 'old_mc'))) { $self->{inResults} = 1; } elsif ($self->{inResults}) { if ($tagname eq 'img') { $self->{currentPlatform} = $attr->{alt}; } elsif (($tagname eq 'a') && ($attr->{href} =~ /^http/)) { $self->{itemIdx}++; $self->{itemsList}[$self->{itemIdx}]->{url} = $attr->{href}; $self->{itemsList}[$self->{itemIdx}]->{platform} = $self->{currentPlatform}; $self->{isGame} = 1; } } } elsif ($self->{parsingTips}) { if ($tagname eq 'tpfdebuttpf') { $self->{isTip} = 1; } elsif ( ($tagname eq 'h3') && ($attr->{class} eq 'titre_bloc') && ($self->{isTip} ne 4)) { $self->{isTip} = 2; } elsif ( (($tagname eq 'h3') || ($tagname eq 'h4') || ($tagname eq 'h5') ) && ($self->{isTip} ne 3) && ($self->{isTip} ne 4)) { $self->{isTip} = 2; } elsif ( ($tagname eq 'p') && ($self->{isTip} ne 3) && ($self->{isTip} ne 4)) { $self->{isTip} = 1; } elsif ($tagname eq 'tpfstopsolution') { $self->{isTip} = 4; } elsif ($tagname eq 'tpffintpf') { $self->{isTip} = 3; } elsif ($tagname eq 'head') { $self->{isTip} = 0; $self->{urlTips} = ''; } } else { if (($tagname eq 'meta') && ($attr->{property} eq 'og:image')) { my $cover = $attr->{content}; $cover =~ s|(http://[^/]*)/([^i])|$1/images/$2|; if ($self->{bigPics}) { $cover =~ s/-p(-|\.)/-g$1/; $cover =~ s/t(\.jpg)/$1/; } my $back = $cover; if (!($back =~ s/-avant(-|\.)/-arriere$1/)) { $back =~ s/f(t?\.jpg)/r$1/; } $self->{curInfo}->{boxpic} = $cover; $self->{curInfo}->{backpic} = $back; } elsif (($tagname eq 'li') && ($attr->{class} eq 'note_redac')) { $self->{is} = 'ratingpress'; } elsif ( ($tagname eq 'div') && ($attr->{class} eq 'series_images') ) { $self->{inScreenshots} = 1; } elsif ( ($tagname eq 'img') && ($self->{inScreenshots}) ) { if (! $self->{curInfo}->{screenshot1}) { $self->{curInfo}->{screenshot1} = $attr->{src}; $self->{curInfo}->{screenshot1} =~ s/.gif/.jpg/; $self->{curInfo}->{screenshot1} =~ s/_m\.jpg/\.jpg/; } elsif (! $self->{curInfo}->{screenshot2}) { $self->{curInfo}->{screenshot2} = $attr->{src}; $self->{curInfo}->{screenshot2} =~ s/.gif/.jpg/; $self->{curInfo}->{screenshot2} =~ s/_m\.jpg/\.jpg/; $self->{isScreen} = 0; } } elsif (($attr->{href} =~ m^/(etajvhtm|cheats)/^) && ! ($self->{urlTips})) { $self->{urlTips} = $attr->{href}; } elsif (($attr->{href} =~ m/test.htm/) && ! ($self->{curInfo}->{players})) { my $html = $self->loadPage($attr->{href}); my $found = index($html,"
|