From 126bb8cb6b93240bb4d3a2b816b74c286c3d422b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 6 Jul 2014 15:20:38 +0200 Subject: Imported Upstream version 1.7.0 --- lib/gcstar/GCPlugins/GCgames/GCAlapage.pm | 262 ++++++++++ lib/gcstar/GCPlugins/GCgames/GCAmazon.pm | 115 +++++ lib/gcstar/GCPlugins/GCgames/GCAmazonCA.pm | 115 +++++ lib/gcstar/GCPlugins/GCgames/GCAmazonDE.pm | 114 +++++ lib/gcstar/GCPlugins/GCgames/GCAmazonFR.pm | 118 +++++ lib/gcstar/GCPlugins/GCgames/GCAmazonJP.pm | 120 +++++ lib/gcstar/GCPlugins/GCgames/GCAmazonUK.pm | 115 +++++ lib/gcstar/GCPlugins/GCgames/GCDicoDuNet.pm | 291 +++++++++++ lib/gcstar/GCPlugins/GCgames/GCGameSpot.pm | 490 +++++++++++++++++++ lib/gcstar/GCPlugins/GCgames/GCJeuxVideoCom.pm | 447 +++++++++++++++++ lib/gcstar/GCPlugins/GCgames/GCJeuxVideoFr.pm | 425 ++++++++++++++++ lib/gcstar/GCPlugins/GCgames/GCLudus.pm | 367 ++++++++++++++ lib/gcstar/GCPlugins/GCgames/GCMobyGames.pm | 541 +++++++++++++++++++++ lib/gcstar/GCPlugins/GCgames/GCNextGame.pm | 480 ++++++++++++++++++ lib/gcstar/GCPlugins/GCgames/GCTheLegacy.pm | 316 ++++++++++++ .../GCPlugins/GCgames/GCgamesAmazonCommon.pm | 314 ++++++++++++ lib/gcstar/GCPlugins/GCgames/GCgamesCommon.pm | 87 ++++ 17 files changed, 4717 insertions(+) create mode 100644 lib/gcstar/GCPlugins/GCgames/GCAlapage.pm create mode 100644 lib/gcstar/GCPlugins/GCgames/GCAmazon.pm create mode 100644 lib/gcstar/GCPlugins/GCgames/GCAmazonCA.pm create mode 100644 lib/gcstar/GCPlugins/GCgames/GCAmazonDE.pm create mode 100644 lib/gcstar/GCPlugins/GCgames/GCAmazonFR.pm create mode 100644 lib/gcstar/GCPlugins/GCgames/GCAmazonJP.pm create mode 100644 lib/gcstar/GCPlugins/GCgames/GCAmazonUK.pm create mode 100644 lib/gcstar/GCPlugins/GCgames/GCDicoDuNet.pm create mode 100644 lib/gcstar/GCPlugins/GCgames/GCGameSpot.pm create mode 100644 lib/gcstar/GCPlugins/GCgames/GCJeuxVideoCom.pm create mode 100644 lib/gcstar/GCPlugins/GCgames/GCJeuxVideoFr.pm create mode 100644 lib/gcstar/GCPlugins/GCgames/GCLudus.pm create mode 100644 lib/gcstar/GCPlugins/GCgames/GCMobyGames.pm create mode 100644 lib/gcstar/GCPlugins/GCgames/GCNextGame.pm create mode 100644 lib/gcstar/GCPlugins/GCgames/GCTheLegacy.pm create mode 100644 lib/gcstar/GCPlugins/GCgames/GCgamesAmazonCommon.pm create mode 100644 lib/gcstar/GCPlugins/GCgames/GCgamesCommon.pm (limited to 'lib/gcstar/GCPlugins/GCgames') diff --git a/lib/gcstar/GCPlugins/GCgames/GCAlapage.pm b/lib/gcstar/GCPlugins/GCgames/GCAlapage.pm new file mode 100644 index 0000000..0d21a94 --- /dev/null +++ b/lib/gcstar/GCPlugins/GCgames/GCAlapage.pm @@ -0,0 +1,262 @@ +package GCPlugins::GCgames::GCAlapage; + +################################################### +# +# Copyright 2005-2011 Christian Jodar +# +# 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::GCPluginAlapage; + + use base 'GCPlugins::GCgames::GCgamesPluginsBase'; + + sub start + { + my ($self, $tagname, $attr, $attrseq, $origtext) = @_; + + $self->{inside}->{$tagname}++; + + if ($self->{parsingList}) + { + if (($tagname eq 'div') && ($attr->{class} eq 'infosProduit')) + { + $self->{itemIdx}++; + $self->{isGame} = 1 ; + } + elsif (($tagname eq 'a') && ($self->{isGame})) + { + $self->{itemsList}[$self->{itemIdx}]->{url} = $attr->{href}; + $self->{itemsList}[$self->{itemIdx}]->{name} = $attr->{title}; + $self->{isGame} = 0 ; + } + elsif (($tagname eq 'span') && ($attr->{class} eq 'liensAriane') && ($self->{isGame}) && ($self->{itemsList}[$self->{itemIdx}]->{platform} eq '')) + { + $self->{isPlatform} = 1 ; + } + } + elsif ($self->{parsingTips}) + { + } + else + { + + if (($tagname eq 'h1') && ($attr->{id} eq 'zm_name_description')) + { + $self->{isName} = 1 ; + } + elsif (($tagname eq 'div') && ($attr->{id} eq 'zm_description_long')) + { + $self->{isDescription} = 1 ; + } + elsif (($tagname eq 'span') && ($attr->{rel} eq 'images nocount') && ($self->{bigPics})) + { + $self->{curInfo}->{boxpic} = $attr->{href_img} ; + } + elsif (($tagname eq 'img') && ($attr->{id} eq 'zm_main_image') && !($self->{bigPics})) + { + $self->{curInfo}->{boxpic} = $attr->{src} ; + } + } + } + + sub end + { + my ($self, $tagname) = @_; + + $self->{inside}->{$tagname}--; + } + + sub text + { + my ($self, $origtext) = @_; + + if ($self->{parsingList}) + { + if ($self->{isPlatform}) + { + # Enleve les blancs en debut de chaine + $origtext =~ s/^\s+//; + # Enleve les blancs en fin de chaine + $origtext =~ s/\s+$//; + + $origtext =~ s/Sony //i; + $origtext =~ s/Jeux PC/PC/i; + + $self->{itemsList}[$self->{itemIdx}]->{platform} = $origtext; + $self->{Save_plateforme} = $self->{itemsList}[$self->{itemIdx}]->{platform}; + $self->{isPlatform} = 0; + + } + } + elsif ($self->{parsingTips}) + { + } + else + { + # Enleve les blancs en debut de chaine + $origtext =~ s/^\s+//; + if ($self->{isName}) + { + $self->{curInfo}->{name} = $origtext; + $self->{curInfo}->{platform} = $self->{Save_plateforme}; + $self->{isName} = 0 ; + + if ($self->{ean} ne '') + { + $self->{curInfo}->{ean} = $self->{ean}; + } + + } + elsif ($self->{isDescription} eq 1) + { + # Enleve les blancs dans le texte + $origtext =~ s/ / /g; + $self->{curInfo}->{description} = $origtext; + $self->{isDescription} = 0 ; + } + + } + } + + sub getTipsUrl + { + my $self = shift; + + return ; + + } + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless ($self, $class); + + $self->{hasField} = { + name => 1, + platform => 1, + released => 0, + genre => 0 + }; + + $self->{isName} = 0; + $self->{isGame} = 0; + $self->{isPlatform} = 0; + $self->{Save_plateforme} = ''; + $self->{isDescription} = 0; + $self->{ean} = ''; + + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + + if ($self->{parsingList}) + { + } + else + { + $html =~ s|
||gi; + $html =~ s|
||gi; + + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|

|\n|gi; + $html =~ s|

||gi; + $html =~ s|\x{92}|'|gi; + $html =~ s|’|'|gi; + $html =~ s|•|*|gi; + $html =~ s|œ|oe|gi; + $html =~ s|…|...|gi; + $html =~ s|\x{85}|...|gi; + $html =~ s|\x{8C}|OE|gi; + $html =~ s|\x{9C}|oe|gi; + } + return $html; + } + + sub getSearchUrl + { + my ($self, $word) = @_; + + if ($self->{searchField} eq 'ean') + { + $self->{ean} = $word; + } + else + { + $self->{ean} = ''; + } + + return 'http://search.alapage.com/search?a=8584451-0-0&s='.$word; + } + + sub getItemUrl + { + my ($self, $url) = @_; + + return $url; + } + + sub getName + { + return 'Alapage'; + } + + sub getCharset + { + my $self = shift; + #return "UTF-8"; + return "ISO-8859-15"; + } + + sub getAuthor + { + return 'TPF'; + } + + sub getLang + { + return 'FR'; + } + + sub getSearchFieldsArray + { + return ['ean', 'name']; + } + + sub getDefaultPictureSuffix + { + return '.jpg'; + } + +} + +1; diff --git a/lib/gcstar/GCPlugins/GCgames/GCAmazon.pm b/lib/gcstar/GCPlugins/GCgames/GCAmazon.pm new file mode 100644 index 0000000..36b7890 --- /dev/null +++ b/lib/gcstar/GCPlugins/GCgames/GCAmazon.pm @@ -0,0 +1,115 @@ +package GCPlugins::GCgames::GCAmazon; + +################################################### +# +# Copyright 2005-2010 Christian Jodar +# +# 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::GCgamesAmazonCommon; + +{ + package GCPlugins::GCgames::GCPluginAmazon; + + use base 'GCPlugins::GCgames::GCgamesAmazonPluginsBase'; + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless ($self, $class); + + $self->{suffix} = 'com'; + + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + + if ($self->{parsingList}) + { + } + else + { + $html =~ s/>Product Description<\/tpfdescription>"); + if ( $found >= 0 ) + { + my $html2 = substr($html, $found,length($html)- $found); + + $html2 =~ s|||gi; + $html2 =~ s|

|\n\n|gi; + $html2 =~ s|

||gi; + $html2 =~ s||\n\n|gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + + $html = substr($html, 0, $found) . $html2 ; + } + + $html =~ s/Release Date :Platform:<\/b>  <\/tpfplateforme>Platform:<\/b>/<\/tpfplateforme>/gi; + $html =~ s/registerImage\("original_image",/<\/script>||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|
  • |\n*|gi; + $html =~ s|
    |\n|gi; + $html =~ s|
    |\n|gi; + $html =~ s|\x{92}|'|gi; + $html =~ s|’|'|gi; + $html =~ s|•|*|gi; + $html =~ s|œ|oe|gi; + $html =~ s|…|...|gi; + $html =~ s|\x{85}|...|gi; + $html =~ s|\x{8C}|OE|gi; + $html =~ s|\x{9C}|oe|gi; + + } + return $html; + } + + sub getName + { + return 'Amazon (US)'; + } + + sub getLang + { + return 'EN'; + } + +} + +1; diff --git a/lib/gcstar/GCPlugins/GCgames/GCAmazonCA.pm b/lib/gcstar/GCPlugins/GCgames/GCAmazonCA.pm new file mode 100644 index 0000000..a54c4ef --- /dev/null +++ b/lib/gcstar/GCPlugins/GCgames/GCAmazonCA.pm @@ -0,0 +1,115 @@ +package GCPlugins::GCgames::GCAmazonCA; + +################################################### +# +# Copyright 2005-2010 Christian Jodar +# +# 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::GCgamesAmazonCommon; + +{ + package GCPlugins::GCgames::GCPluginAmazonCA; + + use base 'GCPlugins::GCgames::GCgamesAmazonPluginsBase'; + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless ($self, $class); + + $self->{suffix} = 'ca'; + + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + + if ($self->{parsingList}) + { + } + else + { + $html =~ s/>Product Description<\/tpfdescription>"); + if ( $found >= 0 ) + { + my $html2 = substr($html, $found,length($html)- $found); + + $html2 =~ s|
  • ||gi; + $html2 =~ s|

    |\n\n|gi; + $html2 =~ s|

    ||gi; + $html2 =~ s|
      |\n|gi; + $html2 =~ s|
    |\n\n|gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + + $html = substr($html, 0, $found) . $html2 ; + } + + $html =~ s/Release Date :Platform:<\/b>  <\/tpfplateforme>Platform:<\/b>/<\/tpfplateforme>/gi; + $html =~ s/registerImage\("original_image",/<\/script>||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|
  • |\n*|gi; + $html =~ s|
    |\n|gi; + $html =~ s|
    |\n|gi; + $html =~ s|\x{92}|'|gi; + $html =~ s|’|'|gi; + $html =~ s|•|*|gi; + $html =~ s|œ|oe|gi; + $html =~ s|…|...|gi; + $html =~ s|\x{85}|...|gi; + $html =~ s|\x{8C}|OE|gi; + $html =~ s|\x{9C}|oe|gi; + + } + return $html; + } + + sub getName + { + return 'Amazon (CA)'; + } + + sub getLang + { + return 'EN'; + } + +} + +1; diff --git a/lib/gcstar/GCPlugins/GCgames/GCAmazonDE.pm b/lib/gcstar/GCPlugins/GCgames/GCAmazonDE.pm new file mode 100644 index 0000000..1dbc106 --- /dev/null +++ b/lib/gcstar/GCPlugins/GCgames/GCAmazonDE.pm @@ -0,0 +1,114 @@ +package GCPlugins::GCgames::GCAmazonDE; + +################################################### +# +# Copyright 2005-2010 Christian Jodar +# +# 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::GCgamesAmazonCommon; + +{ + package GCPlugins::GCgames::GCPluginAmazonDE; + + use base 'GCPlugins::GCgames::GCgamesAmazonPluginsBase'; + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless ($self, $class); + + $self->{suffix} = 'de'; + + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + + if ($self->{parsingList}) + { + } + else + { + $html =~ s/>Produktbeschreibungen<\/tpfdescription>"); + if ( $found >= 0 ) + { + my $html2 = substr($html, $found,length($html)- $found); + + $html2 =~ s|
  • ||gi; + $html2 =~ s|

    |\n\n|gi; + $html2 =~ s|

    ||gi; + $html2 =~ s|
      |\n|gi; + $html2 =~ s|
    |\n\n|gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + + $html = substr($html, 0, $found) . $html2 ; + } + + $html =~ s/Erscheinungsdatum :Plattform:<\/b>  <\/tpfplateforme>Plattform:<\/b>/<\/tpfplateforme>/gi; + $html =~ s/registerImage\("original_image",/<\/script>||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|
  • |*|gi; + $html =~ s|
    |\n|gi; + $html =~ s|
    |\n|gi; + $html =~ s|\x{92}|'|gi; + $html =~ s|’|'|gi; + $html =~ s|•|*|gi; + $html =~ s|…|...|gi; + $html =~ s|\x{85}|...|gi; + $html =~ s|\x{8C}|OE|gi; + $html =~ s|\x{9C}|oe|gi; + + } + return $html; + } + + sub getName + { + return 'Amazon (DE)'; + } + + sub getLang + { + return 'DE'; + } + +} + +1; diff --git a/lib/gcstar/GCPlugins/GCgames/GCAmazonFR.pm b/lib/gcstar/GCPlugins/GCgames/GCAmazonFR.pm new file mode 100644 index 0000000..1bceb23 --- /dev/null +++ b/lib/gcstar/GCPlugins/GCgames/GCAmazonFR.pm @@ -0,0 +1,118 @@ +package GCPlugins::GCgames::GCAmazonFR; + +################################################### +# +# Copyright 2005-2010 Christian Jodar +# +# 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::GCgamesAmazonCommon; + +{ + package GCPlugins::GCgames::GCPluginAmazonFR; + + use base 'GCPlugins::GCgames::GCgamesAmazonPluginsBase'; + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless ($self, $class); + + $self->{suffix} = 'fr'; + + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + + if ($self->{parsingList}) + { + } + else + { + $html =~ s/>Description du produit<\/tpfdescription>Descriptions du produit<\/tpfdescription>"); + if ( $found >= 0 ) + { + my $html2 = substr($html, $found,length($html)- $found); + + $html2 =~ s|
  • ||gi; + $html2 =~ s|

    |\n\n|gi; + $html2 =~ s|

    ||gi; + $html2 =~ s|
      |\n|gi; + $html2 =~ s|
    |\n\n|gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + + $html = substr($html, 0, $found) . $html2 ; + } + + $html =~ s/Date de parution :Plate-forme:<\/b>  <\/tpfplateforme>Plate-forme:<\/b>/<\/tpfplateforme>/gi; + $html =~ s/registerImage\("original_image",/<\/script>||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|
  • |*|gi; + $html =~ s|
    |\n|gi; + $html =~ s|
    |\n|gi; + $html =~ s|\x{92}|'|gi; + $html =~ s|’|'|gi; + $html =~ s|•|*|gi; + $html =~ s|œ|oe|gi; + $html =~ s|…|...|gi; + $html =~ s|\x{85}|...|gi; + $html =~ s|\x{8C}|OE|gi; + $html =~ s|\x{9C}|oe|gi; + # Bug sur Shadow of Memories pour PS2 + $html =~ s|Actio\)n|Action|gi; + + } + return $html; + } + + sub getName + { + return 'Amazon (FR)'; + } + + sub getLang + { + return 'FR'; + } + +} + +1; diff --git a/lib/gcstar/GCPlugins/GCgames/GCAmazonJP.pm b/lib/gcstar/GCPlugins/GCgames/GCAmazonJP.pm new file mode 100644 index 0000000..80824ec --- /dev/null +++ b/lib/gcstar/GCPlugins/GCgames/GCAmazonJP.pm @@ -0,0 +1,120 @@ +package GCPlugins::GCgames::GCAmazonJP; + +################################################### +# +# Copyright 2005-2010 Christian Jodar +# +# 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::GCgamesAmazonCommon; + +{ + package GCPlugins::GCgames::GCPluginAmazonJP; + + use base 'GCPlugins::GCgames::GCgamesAmazonPluginsBase'; + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless ($self, $class); + + $self->{suffix} = 'co.jp'; + + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + + if ($self->{parsingList}) + { + } + else + { + $html =~ s/>商品の説明<\/tpfdescription>"); + if ( $found >= 0 ) + { + my $html2 = substr($html, $found,length($html)- $found); + + $html2 =~ s|
  • ||gi; + $html2 =~ s|

    |\n\n|gi; + $html2 =~ s|

    ||gi; + $html2 =~ s|
      |\n|gi; + $html2 =~ s|
    |\n\n|gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + + $html = substr($html, 0, $found) . $html2 ; + } + + $html =~ s/発売日 :プラットフォーム:<\/b>  <\/tpfplateforme>プラットフォーム:<\/b>/<\/tpfplateforme>/gi; + $html =~ s/registerImage\("original_image",/<\/script>||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|
  • |*|gi; + $html =~ s|
    |\n|gi; + $html =~ s|
    |\n|gi; + $html =~ s|\x{92}|'|gi; + $html =~ s|’|'|gi; + $html =~ s|•|*|gi; + $html =~ s|…|...|gi; + $html =~ s|\x{85}|...|gi; + $html =~ s|\x{8C}|OE|gi; + $html =~ s|\x{9C}|oe|gi; + + } + return $html; + } + + sub getName + { + return 'Amazon (JP)'; + } + + sub getCharset + { + my $self = shift; + return "SHIFT_JIS"; + } + + sub getLang + { + return 'JP'; + } + +} + +1; diff --git a/lib/gcstar/GCPlugins/GCgames/GCAmazonUK.pm b/lib/gcstar/GCPlugins/GCgames/GCAmazonUK.pm new file mode 100644 index 0000000..5108e8c --- /dev/null +++ b/lib/gcstar/GCPlugins/GCgames/GCAmazonUK.pm @@ -0,0 +1,115 @@ +package GCPlugins::GCgames::GCAmazonUK; + +################################################### +# +# Copyright 2005-2010 Christian Jodar +# +# 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::GCgamesAmazonCommon; + +{ + package GCPlugins::GCgames::GCPluginAmazonUK; + + use base 'GCPlugins::GCgames::GCgamesAmazonPluginsBase'; + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless ($self, $class); + + $self->{suffix} = 'co.uk'; + + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + + if ($self->{parsingList}) + { + } + else + { + $html =~ s/>Product Description<\/tpfdescription>Reviews<\/tpfdescription>"); + if ( $found >= 0 ) + { + my $html2 = substr($html, $found,length($html)- $found); + + $html2 =~ s|
  • ||gi; + $html2 =~ s|

    |\n\n|gi; + $html2 =~ s|

    ||gi; + $html2 =~ s|
      |\n|gi; + $html2 =~ s|
    |\n\n|gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + $html2 =~ s|||gi; + + $html = substr($html, 0, $found) . $html2 ; + } + + $html =~ s/Release Date :Platform:<\/b>  <\/tpfplateforme>Platform:<\/b>/<\/tpfplateforme>/gi; + $html =~ s/registerImage\("original_image",/<\/script>||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|
  • |*|gi; + $html =~ s|
    |\n|gi; + $html =~ s|
    |\n|gi; + $html =~ s|\x{92}|'|gi; + $html =~ s|’|'|gi; + $html =~ s|•|*|gi; + $html =~ s|…|...|gi; + $html =~ s|\x{85}|...|gi; + $html =~ s|\x{8C}|OE|gi; + $html =~ s|\x{9C}|oe|gi; + + } + return $html; + } + + sub getName + { + return 'Amazon (UK)'; + } + + sub getLang + { + return 'EN'; + } + +} + +1; diff --git a/lib/gcstar/GCPlugins/GCgames/GCDicoDuNet.pm b/lib/gcstar/GCPlugins/GCgames/GCDicoDuNet.pm new file mode 100644 index 0000000..fd130cf --- /dev/null +++ b/lib/gcstar/GCPlugins/GCgames/GCDicoDuNet.pm @@ -0,0 +1,291 @@ +package GCPlugins::GCgames::GCDicoDuNet; + +################################################### +# +# Copyright 2005-2010 Christian Jodar +# +# 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::GCPluginDicoDuNet; + + use base 'GCPlugins::GCgames::GCgamesPluginsBase'; + + sub start + { + my ($self, $tagname, $attr, $attrseq, $origtext) = @_; + + $self->{inside}->{$tagname}++; + + if ($self->{parsingList}) + { + if (($tagname eq 'div') && ($attr->{class} eq 'cat_produit')) + { + $self->{isGame} = 1 ; + $self->{isUrl} = 1 ; + } + elsif (($tagname eq 'a') && ($self->{isUrl}) && ($self->{isGame})) + { + $self->{itemIdx}++; + $self->{itemsList}[$self->{itemIdx}]->{url} = $attr->{href}; + $self->{isUrl} = 0 ; + } + elsif (($tagname eq 'strong') && ($self->{isGame})) + { + $self->{isName} = 1 ; + $self->{isGame} = 0 ; + } + } + elsif ($self->{parsingTips}) + { + } + else + { + + if (($tagname eq 'h3') && ($attr->{class} eq 'produits')) + { + $self->{isGame} = 1 ; + } + elsif (($tagname eq 'span') && ($self->{isGame} eq 1) ) + { + $self->{isName} = 1 ; + $self->{isGame} = 2 ; + } + elsif (($tagname eq 'a') && ($self->{isGame} eq 2)) + { + $self->{isEditor} = 1 ; + $self->{isGame} = 0 ; + } + elsif ($tagname eq 'table') + { + $self->{isGame} = 0 ; + } + elsif (($tagname eq 'div') && ($attr->{id} eq 'vous_etes_ici')) + { + $self->{isPlatform} = 1 ; + } + elsif (($tagname eq 'a') && ($attr->{href} ne 'http://www.dicodunet.com/jeux-video/') && ($self->{isPlatform})) + { + $self->{isPlatform} = 2 ; + } + elsif (($tagname eq 'a') && (index($attr->{href},"www.dicodunet.com/jeux-video/img/") >= 0) && ($self->{curInfo}->{boxpic} eq '')) + { + my $html = $self->loadPage($attr->{href}, 0, 1); + my $found = index($html,"

    "); + if ( $found >= 0 ) + { + $html = substr($html, $found +length('

    '),length($html)- $found -length('

    ')); + + my $found = index($html,"= 0 ) + { + $html = substr($html, $found +length('{curInfo}->{boxpic} = $html; + } + } + + } + elsif ($tagname eq 'tpfdateparution') + { + $self->{isDate} = 1 ; + } + elsif ($tagname eq 'tpfean') + { + $self->{isEan} = 1 ; + } + } + } + + sub end + { + my ($self, $tagname) = @_; + + $self->{inside}->{$tagname}--; + } + + sub text + { + my ($self, $origtext) = @_; + + if ($self->{parsingList}) + { + if ($self->{isName}) + { + $self->{itemsList}[$self->{itemIdx}]->{name} = $origtext; + $self->{isName} = 0; + + } + } + elsif ($self->{parsingTips}) + { + } + else + { + # Enleve les blancs en debut de chaine + $origtext =~ s/^\s+//; + if ($self->{isName}) + { + $self->{curInfo}->{name} = $origtext; + $self->{isName} = 0 ; + } + elsif ($self->{isEditor}) + { + $self->{curInfo}->{editor} = $origtext; + $self->{isEditor} = 0 ; + } + elsif ($self->{isPlatform} eq 2) + { + $origtext =~ s/PlayStation 2/Playstation 2/i; + $origtext =~ s/Jeux PC/PC/i; + $origtext =~ s/Jeux Mac/MAC/i; + + if (($self->{curInfo}->{platform} eq '') && ($origtext ne '')) + { + $self->{curInfo}->{platform} = $origtext; + } + elsif ($origtext ne '') + { + $self->{curInfo}->{platform} .= ', '; + $self->{curInfo}->{platform} .= $origtext; + } + $self->{isPlatform} = 0; + } + elsif ($self->{isDate}) + { + $self->{curInfo}->{released} = $origtext; + $self->{curInfo}->{released} =~ s|([0-9]*)-([0-9]*)-([0-9]*)|$3.'/'.$2.'/'.$1|e; + $self->{isDate} = 0 ; + } + elsif ($self->{isEan}) + { + $self->{curInfo}->{ean} = $origtext; + $self->{isEan} = 0 ; + } + + } + } + + sub getTipsUrl + { + my $self = shift; + + return ; + + } + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless ($self, $class); + + $self->{hasField} = { + name => 1, + platform => 0, + genre => 0, + released => 0 + }; + + $self->{isName} = 0; + $self->{isGame} = 0; + $self->{isUrl} = 0; + $self->{isPlatform} = 0; + $self->{isEditor} = 0; + $self->{isDate} = 0; + $self->{isEan} = 0; + + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + + if ($self->{parsingList}) + { + } + else + { + my $found = index($html,"class=\"produits_box\""); + if ( $found >= 0 ) + { + $html = substr($html, 0, $found); + } + + $html =~ s/Version sortie le //gi; + $html =~ s/Code EAN : //gi; + $html =~ s|\x{92}|'|gi; + $html =~ s|’|'|gi; + $html =~ s|•|*|gi; + } + return $html; + } + + sub getSearchUrl + { + my ($self, $word) = @_; + + return ('http://www.dicodunet.com/jeux-video/recherche.php', ["q" => "$word"] ); + } + + sub getItemUrl + { + my ($self, $url) = @_; + return $url if $url; + return 'http://www.dicodunet.com/'; + } + + sub getName + { + return 'DicoDuNet'; + } + + sub getCharset + { + my $self = shift; + #return "UTF-8"; + return "ISO-8859-15"; + } + + sub getAuthor + { + return 'TPF'; + } + + sub getLang + { + return 'FR'; + } + + sub getSearchFieldsArray + { + return ['name']; + } +} + +1; + diff --git a/lib/gcstar/GCPlugins/GCgames/GCGameSpot.pm b/lib/gcstar/GCPlugins/GCgames/GCGameSpot.pm new file mode 100644 index 0000000..c5870b4 --- /dev/null +++ b/lib/gcstar/GCPlugins/GCgames/GCGameSpot.pm @@ -0,0 +1,490 @@ +package GCPlugins::GCgames::GCGameSpot; + +################################################### +# +# Copyright 2005-2011 Christian Jodar +# +# 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::GCPluginGameSpot; + + use base 'GCPlugins::GCgames::GCgamesPluginsBase'; + use Text::Wrap; + + sub start + { + my ($self, $tagname, $attr, $attrseq, $origtext) = @_; + + $self->{inside}->{$tagname}++; + if ($self->{parsingList}) + { + if ($tagname eq 'div') + { + $self->{isGame} = 1 + if $attr->{class} =~ /result_title/; + } + elsif ($tagname eq 'tpfdatetpf') + { + $self->{isDate} = 1; + } + elsif (($tagname eq 'a') && ($self->{isGame})) + { + $self->{itemIdx}++; + $self->{itemsList}[$self->{itemIdx}]->{url} = $attr->{href}; + $self->{isName} = 1; + } + } + elsif ($self->{parsingTips}) + { + if (($tagname eq 'h2') && ($attr->{class} eq 'module_title')) + { + $self->{isSection} = 1; + } + elsif (($tagname eq 'th') && ($attr->{scope} eq 'row') && ($attr->{class} eq 'code') && ($self->{section} ne '')) + { + $self->{isCheat} = 1; + } + elsif (($tagname eq 'td') && ($attr->{class} eq 'effect') && ($self->{section} ne '')) + { + $self->{isDesc} = 1; + } + elsif (($tagname eq 'h3') && ($attr->{class} eq 'cheatCodeTitle') && ($self->{section} eq 'Secrets')) + { + $self->{curInfo}->{secrets} .= "\n" if $self->{curInfo}->{secrets}; + } + elsif ($tagname eq 'tpfdebuttpf') + { + $self->{section} = 'Secrets'; + } + elsif (($tagname eq 'div') && ($attr->{class} eq 'head')) + { + $self->{section} = ''; + } + elsif ($tagname eq 'head') + { + $self->{urlTips} = ''; + } + } + else + { + if ($tagname eq 'img') + { + $self->{curInfo}->{boxpic} = ' ' + if $attr->{src} =~ /no_preview/; + if ((! $self->{curInfo}->{boxpic}) && ($attr->{src} =~ /[^xo]boxs[^c]/)) + { + $self->{curInfo}->{boxpic} = $attr->{src}; + } + if ($attr->{src} =~ /thumb/) + { + my $pic = $attr->{src}; + $pic =~ s/thumb00([0-9])/screen00$1/; + if ($1 && ($1 <= 2)) + { + $self->{curInfo}->{'screenshot'.$1} = $pic + if ! $self->{curInfo}->{'screenshot'.$1}; + } + } + } + elsif (($tagname eq 'div') && ($attr->{class} eq 'boxshot')) + { + $self->{isBox} = 1; + } + elsif (($tagname eq 'a') && ($self->{isBox} eq 1)) + { + my $html = $self->loadPage($self->getItemUrl($attr->{href}), 0, 1); + my $found = index($html,"id=\"main_image\" src=\""); + if ( $found >= 0 ) + { + $html = substr($html, $found +length('id="main_image" src="'),length($html)- $found -length('id="main_image" src="')); + + my @array = split(/"/,$html); + #" + if ($self->{bigPics}) + { + $self->{curInfo}->{boxpic} = $array[0]; + } + $self->{curInfo}->{backpic} = $array[0]; + $self->{curInfo}->{backpic} =~ s/_front/_back/; + } + $self->{isBox} = 0; + } + elsif (($tagname eq 'h1') && ($attr->{class} eq 'productPageTitle')) + { + $self->{isName} = 1 if ! $self->{curInfo}->{name}; + } + elsif (($tagname eq 'meta') && ($attr->{name} eq 'description')) + { + $self->{curInfo}->{description} = $attr->{content}; + } + elsif (($tagname eq 'li') && ($attr->{class} =~ /activeFilter/)) + { + $self->{curInfo}->{exclusive} = 0; + } + elsif (($tagname eq 'span') && ($attr->{class} eq 'reviewer')) + { + $self->{isRating} = 1; + } + elsif (($tagname eq 'a') && ($self->{isRating} eq 1)) + { + $self->{isRating} = 2; + } + elsif (($tagname eq 'li') && ($attr->{class} eq 'moreStat play_info number_of_players')) + { + $self->{isPlayers} = 1; + } + elsif (($tagname eq 'p') && ($self->{isPlayers} eq 1)) + { + $self->{isPlayers} = 2; + } + elsif (($tagname eq 'li') && ($attr->{class} eq 'publisher')) + { + $self->{isEditor} = 1; + } + elsif (($tagname eq 'a') && ($self->{isEditor} eq 1)) + { + $self->{isEditor} = 2; + } + elsif (($tagname eq 'li') && ($attr->{class} eq 'developer')) + { + $self->{isDeveloper} = 1; + } + elsif (($tagname eq 'a') && ($self->{isDeveloper} eq 1)) + { + $self->{isDeveloper} = 2; + } + elsif (($tagname eq 'li') && ($attr->{class} eq 'genre')) + { + $self->{isGenre} = 1; + } + elsif (($tagname eq 'a') && ($self->{isGenre})) + { + $self->{curInfo}->{genre} = $attr->{title}; + $self->{isGenre} = 0; + } + elsif (($tagname eq 'li') && ($attr->{class} eq 'date')) + { + $self->{isReleased} = 1; + } + elsif (($tagname eq 'a') && ($self->{isReleased} eq 1)) + { + $self->{isReleased} = 2; + } + elsif (($tagname eq 'a') && ($attr->{href} =~ /\/cheats\//) && ($attr->{class} eq 'navItemAction')) + { + $self->{urlTips} = $attr->{href}; + } + } + } + + sub end + { + my ($self, $tagname) = @_; + + $self->{inside}->{$tagname}--; + if ($self->{parsingList}) + { + $self->{isGame} = 0 + if ($tagname eq 'div'); + } + elsif ($self->{parsingTips}) + { + } + } + + sub text + { + my ($self, $origtext) = @_; + + if ($self->{parsingList}) + { + if ($self->{isName}) + { + $origtext =~ /^(.*?)\s*\((.*?)\)\s*$/; + $self->{itemsList}[$self->{itemIdx}]->{name} = $1; + $self->{itemsList}[$self->{itemIdx}]->{platform} = $2; + $self->{itemsList}[$self->{itemIdx}]->{url} = $self->{itemsList}[$self->{itemIdx}]->{url} . 'tpfplatformtpf' . $self->{itemsList}[$self->{itemIdx}]->{platform}; + $self->{isName} = 0; + } + elsif ($self->{isDate}) + { + $origtext =~ /^\s*Release Date:\s*(.*?)\s*$/ms; + $self->{itemsList}[$self->{itemIdx}]->{released} = $1; + $self->{isDate} = 0; + } + } + elsif ($self->{parsingTips}) + { + if (($self->{isSection} eq 1) && $self->{inside}->{h2}) + { + $self->{section} = 'Codes' if $origtext =~ /Cheat Codes$/; + $self->{section} = 'Unlockables' if $origtext =~ /Unlockables$/; + $self->{section} = 'Secrets' if $origtext =~ /Secrets$/; + $self->{section} = 'Secrets' if $origtext =~ /Easter Eggs$/; + $self->{isSection} = 0; + } + elsif (($self->{section} eq 'Codes') || ($self->{section} eq 'Unlockables')) + { + $origtext =~ s/^\s*//; + $origtext =~ s/\s*$//; + $Text::Wrap::columns = 80; + $origtext = Text::Wrap::wrap('', '', $origtext); + + if ($self->{isCheat}) + { + if ($self->{section} eq 'Codes') + { + $self->{tmpCheatLine} = []; + push @{$self->{tmpCheatLine}}, $origtext; + } + else + { + $self->{tmpCheatLine} = []; + ${$self->{tmpCheatLine}}[1] = $origtext; + } + $self->{isCheat} = 0; + } + elsif ($self->{isDesc}) + { + if ($self->{section} eq 'Codes') + { + push @{$self->{tmpCheatLine}}, $origtext; + push @{$self->{curInfo}->{code}}, $self->{tmpCheatLine}; + $self->{tmpCheatLine} = []; + } + else + { + ${$self->{tmpCheatLine}}[0] = $origtext; + push @{$self->{curInfo}->{unlockable}}, $self->{tmpCheatLine}; + $self->{tmpCheatLine} = []; + } + $self->{isDesc} = 0; + } + } + elsif ($self->{section} eq 'Secrets') + { + $origtext =~ s/^\s*//; + $origtext =~ s/\s*$//; + return if !$origtext; + $self->{curInfo}->{secrets} .= "\n" if $self->{curInfo}->{secrets}; + $self->{curInfo}->{secrets} .= $origtext; + } + } + else + { + if ($self->{isName}) + { + $origtext =~ s/\n//g; + $self->{curInfo}->{name} = $origtext; + $self->{curInfo}->{platform} = $self->{url_plateforme}; + $self->{curInfo}->{exclusive} = 1; + $self->{isName} = 0; + } + elsif ($self->{isRating} eq 2) + { + $self->{curInfo}->{ratingpress} = $origtext; + $self->{isRating} = 0; + } + else + { + $origtext =~ s/^\s*//; + $origtext =~ s/\s*$//; + return if !$origtext; + if ($self->{isReleased} eq 2) + { + $origtext =~ s/ .$//; + $self->{curInfo}->{released} = $origtext; + $self->{isReleased} = 0; + } + elsif ($self->{isEditor} eq 2) + { + $self->{curInfo}->{editor} = $origtext; + $self->{isEditor} = 0; + } + elsif ($self->{isDeveloper} eq 2) + { + $self->{curInfo}->{developer} = $origtext; + $self->{isDeveloper} = 0; + } + elsif ($self->{isPlayers} eq 2) + { + $origtext =~ s/(Players?)?\s*\(.*?$//; + $self->{curInfo}->{players} = $origtext; + $self->{isPlayers} = 0; + } + } + } + } + + sub getTipsUrl + { + my $self = shift; + return 'http://www.gamespot.com' .$self->{urlTips}; + } + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless ($self, $class); + + $self->{hasField} = { + name => 1, + platform => 1, + released => 1, + }; + + $self->{isName} = 0; + $self->{isGame} = 0; + $self->{isDate} = 0; + $self->{isCheat} = 0; + $self->{isDesc} = 0; + $self->{isTip} = 0; + $self->{isRating} = 0; + $self->{section} = ''; + $self->{isSection} = 0; + $self->{isDeveloper} = 0; + $self->{isGenre} = 0; + $self->{isEditor} = 0; + $self->{isReleased} = 0; + $self->{isPlayers} = 0; + $self->{isBox} = 0; + $self->{isExclu} = 0; + $self->{url_plateforme} = ''; + $self->{urlTips} = ""; + $self->{SaveUrl} = ""; + + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + + if ($self->{parsingTips}) + { + $html =~ s|(.*?)|$1|g; + $html =~ s|(.*?)|$1|g; +## It takes too much time +# $html =~ s|
  • Go to Online Walkthrough|'' . $self->RecupSolution($1) . ''|ge; + } + elsif ($self->{parsingList}) + { + $html =~ s|Release Date|Release Date|g; + } + else + { + my $found = index($html,"Similar Games"); + if ( $found >= 0 ) + { + $html = substr($html, 0, $found); + } + } + + return $html; + } + + sub RecupSolution + { + my ($self, $url) = @_; + + my $html = $self->loadPage($url); + + my $found = index($html,"

    "); + if ( $found >= 0 ) + { + $html = substr($html, $found,length($html)- $found); + } + else + { + $found = index($html,""); + if ( $found >= 0 ) + { + $html = substr($html, $found,length($html)- $found); + } + } + + $html = substr($html, 0, index($html, " rel=\"next\">")); + + $html =~ s|
  • Les astuces d|$self->RecupTips($1)|ge; + $html =~ s|

    La solution d|$self->RecupSolution($1)|ge; + $html =~ s|
    ||gi; + $html =~ s|

    Plus d'infos

    ||gi; + $html =~ s|
    ||gi; + $html =~ s|

    ||gi; + $html =~ s|

    ||gi; + $html =~ s|||gi; + $html =~ s|

    ||gi; + $html =~ s|

    ||gi; + $html =~ s|
    |

    |gi; + $html =~ s||

    |gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s||Cercle|gi; + $html =~ s||Croix|gi; + $html =~ s||Carr.|gi; + $html =~ s||Triangle|gi; + $html =~ s||Cercle|gi; + $html =~ s||Croix|gi; + $html =~ s||Carr.|gi; + $html =~ s||Triangle|gi; + $html =~ s|\x{92}|'|gi; + $html =~ s|’|'|gi; + $html =~ s|•|*|gi; + $html =~ s|œ|oe|gi; + $html =~ s|…|...|gi; + $html =~ s|\x{85}|...|gi; + $html =~ s|\x{8C}|OE|gi; + $html =~ s|\x{9C}|oe|gi; + } + else + { + $self->{is} = ''; + $self->{inScreenshots} = 0; + } + return $html; + } + + sub RecupTips + { + my ($self, $url) = @_; + + my $html = $self->loadPage($url); + my $savenexturl = ''; + + my $found = index($html,"

    = 0 ) + { + $savenexturl = substr($html, $found +length('

    "); + if ( $found >= 0 ) + { + $html = substr($html, $found +length('

    '),length($html)- $found -length('
    ')); + $html = substr($html, 0, index($html, "
    ")); + if ( $savenexturl ne "" ) + { + $html .= $self->RecupTips($savenexturl); + } + } + else + { + $html = ''; + } + return "" . $html . ""; + } + + sub RecupSolution + { + my ($self, $url) = @_; + + my $html = $self->loadPage($url); + my $savenexturl = ''; + + my $found = index($html,"

    = 0 ) + { + $savenexturl = substr($html, $found +length('

    "); + if ( $found >= 0 ) + { + $html = substr($html, $found +length('

    '),length($html)- $found -length('
    ')); + $html = substr($html, 0, index($html, "
    ")); + if ( $savenexturl ne "" ) + { + $html .= $self->RecupSolution($savenexturl); + } + } + else + { + $html = ''; + } + return "" . $html . ""; + } + + sub getSearchUrl + { + my ($self, $word) = @_; + $word =~ s/\+/ /g; + return 'http://www.jeuxvideo.com/recherche/jeux/'.$word.'.htm'; + } + + sub getItemUrl + { + my ($self, $url) = @_; + + return $url if $url; + return 'http://www.jeuxvideo.com/'; + } + + sub getName + { + return 'jeuxvideo.com'; + } + + sub getAuthor + { + return 'Tian & TPF'; + } + + sub getLang + { + return 'FR'; + } + + sub getCharset + { + my $self = shift; + + return "ISO-8859-1"; + } + sub isPreferred + { + return 1; + } +} + +1; diff --git a/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoFr.pm b/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoFr.pm new file mode 100644 index 0000000..bec266f --- /dev/null +++ b/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoFr.pm @@ -0,0 +1,425 @@ +package GCPlugins::GCgames::GCJeuxVideoFr; + +################################################### +# +# Copyright 2005-2011 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::GCPluginJeuxVideoFr; + + use base 'GCPlugins::GCgames::GCgamesPluginsBase'; + + sub start + { + my ($self, $tagname, $attr, $attrseq, $origtext) = @_; + + $self->{inside}->{$tagname}++; + if ($self->{parsingList}) + { + if ($tagname eq 'div') + { + $self->{isGame} = 1 + if $attr->{class} eq "jeuDesc"; + } + if ($self->{isGame}) + { + if ($tagname eq 'a') + { + $self->{itemIdx}++; + $self->{itemsList}[$self->{itemIdx}]->{url} = $attr->{href}; + $self->{itemsList}[$self->{itemIdx}]->{name} = $attr->{title}; + } + elsif ( ($tagname eq 'span') & ($attr->{class} eq "bleu2")) + { + $self->{isPlatform} = 1; + } + elsif ( ($tagname eq 'span') & ($attr->{class} eq "bleu6")) + { + $self->{isGenre} = 1; + } + elsif ( ($tagname eq 'p') & ($attr->{class} eq "jeuNote")) + { + $self->{isGame} = 0; + $self->{isEnd} = 1; + } + } + } + elsif ($self->{parsingTips}) + { + } + else + { + if ( ($tagname eq 'input') && ($attr->{id} eq 'titreJeu')) + { + $self->{curInfo}->{name} = $attr->{value}; + $self->{curInfo}->{platform} = $self->{url_plateforme}; + + my $html = $self->loadPage( $self->{url_screenshot} ); + + my $found = index($html,"div class=\"image_slideshow\">"); + if ( $found >= 0 ) + { + $self->{curInfo}->{screenshot1} = substr($html, $found +length('div class="image_slideshow">'),length($html)- $found -length('div class="image_slideshow">')); + $found = index($self->{curInfo}->{screenshot1},"= 0 ) + { + $self->{curInfo}->{screenshot1} = substr($self->{curInfo}->{screenshot1}, $found +length('{curInfo}->{screenshot1} = substr($self->{curInfo}->{screenshot1}, 0,index($self->{curInfo}->{screenshot1},"\"")); + $found = index($html,"\"imageNumberTotal\""); + if ( $found >= 0 ) + { + $self->{curInfo}->{screenshot2} = substr($html, $found +length('"imageNumberTotal"'),length($html)- $found -length('"imageNumberTotal"')); + $found = index($self->{curInfo}->{screenshot2},"href=\""); + if ( $found >= 0 ) + { + $self->{curInfo}->{screenshot2} = substr($self->{curInfo}->{screenshot2}, $found +length('href="'),length($self->{curInfo}->{screenshot2})- $found -length('href="')); + $self->{curInfo}->{screenshot2} = 'http://www.jeuxvideo.fr/' . substr($self->{curInfo}->{screenshot2}, 0,index($self->{curInfo}->{screenshot2},"\"")); + + $html = $self->loadPage( $self->{curInfo}->{screenshot2} ); + $found = index($html,"div class=\"image_slideshow\">"); + if ( $found >= 0 ) + { + $self->{curInfo}->{screenshot2} = substr($html, $found +length('div class="image_slideshow">'),length($html)- $found -length('div class="image_slideshow">')); + $found = index($self->{curInfo}->{screenshot2},"= 0 ) + { + $self->{curInfo}->{screenshot2} = substr($self->{curInfo}->{screenshot2}, $found +length('{curInfo}->{screenshot2} = substr($self->{curInfo}->{screenshot2}, 0,index($self->{curInfo}->{screenshot2},"\"")); + } + } + } + } + } + } + } + elsif (($tagname eq 'div') && ($attr->{class} eq 'clearer spacer10')) + { + $self->{isInfo} = 0; + $self->{is} = ''; + } + elsif (($tagname eq 'div') && ($attr->{class} eq 'listing_apropos')) + { + $self->{isInfo} = 1; + } + elsif (($self->{isInfo} eq '1') && ($tagname eq 'span') && ($attr->{class} eq 'strong')) + { + $self->{isInfo} = 2; + } + elsif (($self->{is}) && ($tagname eq 'span') && ($attr->{class} eq 'noir')) + { + $self->{isInfo} = 3; + } + elsif (($self->{is}) && ($tagname eq 'div') && ($attr->{class} eq 'clearer')) + { + $self->{isInfo} = 1; + $self->{is} = ''; + } + elsif (($tagname eq 'span') && ($attr->{class} eq 'note-jeux orange1') && ($attr->{property} eq 'v:rating')) + { + $self->{isNote} = 1; + } + elsif (($tagname eq 'div') && ($attr->{class} eq 'contentCommentaire')) + { + $self->{isDesc} = 1; + } + elsif (($self->{isDesc}) && ($tagname eq 'div') && ($attr->{class} eq 'clearer')) + { + $self->{isDesc} = 0; + } + elsif ( ($tagname eq 'img') && ($attr->{class} eq 'imgJeu') && !($attr->{src} =~ /blank/i)) + { + $self->{curInfo}->{boxpic} = $attr->{src}; + } + } + } + + sub end + { + my ($self, $tagname) = @_; + + $self->{inside}->{$tagname}--; + if ($self->{parsingList}) + { + } + elsif ($self->{parsingTips}) + { + } + } + + sub text + { + my ($self, $origtext) = @_; + + if ($self->{parsingList}) + { + # Enleve les blancs en debut de chaine + $origtext =~ s/^\s+//; + # Enleve les blancs en fin de chaine + $origtext =~ s/\s+$//; + + if ($self->{isGenre}) + { + if ($self->{itemsList}[$self->{itemIdx}]->{genre} eq '') + { + $self->{itemsList}[$self->{itemIdx}]->{genre} = $origtext; + $self->{isGenre} = 0; + } + else + { + $self->{itemsList}[$self->{itemIdx}]->{genre} = $self->{itemsList}[$self->{itemIdx}]->{genre} . ' - ' . $origtext; + $self->{isGenre} = 0; + } + } + elsif ($self->{isPlatform}) + { + $origtext =~ s/\|//gi; + if ($self->{itemsList}[$self->{itemIdx}]->{platform} eq '') + { + $self->{itemsList}[$self->{itemIdx}]->{platform} = $origtext; + } + else + { + $self->{itemsList}[$self->{itemIdx}]->{platform} .= ', '; + $self->{itemsList}[$self->{itemIdx}]->{platform} .= $origtext; + } + $self->{isPlatform} = 0; + } + elsif ($self->{isEnd}) + { + my @array = split(/,/,$self->{itemsList}[$self->{itemIdx}]->{platform}); + my $element; + + my $SaveName = $self->{itemsList}[$self->{itemIdx}]->{name}; + my $SaveUrl = $self->{itemsList}[$self->{itemIdx}]->{url}; + my $SaveGenre = $self->{itemsList}[$self->{itemIdx}]->{genre}; + $self->{itemIdx}--; + + foreach $element (@array) + { + # Enleve les blancs en debut de chaine + $element =~ s/^\s+//; + # Enleve les blancs en fin de chaine + $element =~ s/\s+$//; + + $self->{itemIdx}++; + $self->{itemsList}[$self->{itemIdx}]->{name} = $SaveName; + $self->{itemsList}[$self->{itemIdx}]->{url} = $SaveUrl . 'tpfplatformtpf' . $element; + $self->{itemsList}[$self->{itemIdx}]->{platform} = $element; + $self->{itemsList}[$self->{itemIdx}]->{genre} = $SaveGenre; + } + $self->{isEnd} = 0; + } + } + elsif ($self->{parsingTips}) + { + } + else + { + if ($self->{isInfo} eq 2) + { + $self->{is} = 'genre' if $origtext =~ /Genre :/; + $self->{is} = 'editor' if $origtext =~ /Editeur :/; + $self->{is} = 'developer' if $origtext =~ /D.veloppeur :/; + $self->{is} = 'players' if $origtext =~ /Nb joueurs :/; + $self->{is} = 'released' if $origtext =~ /Sortie :/; + $self->{is} = 'exclusive' if $origtext =~ /Plateformes :/; + } + elsif ($self->{isInfo} eq 3) + { + # Enleve le caractere | qui separe les champs + $origtext =~ s/\|//gi; + # Enleve les blancs en debut de chaine + $origtext =~ s/^\s+//; + # Enleve les blancs en fin de chaine + $origtext =~ s/\s+$//; + if ($origtext) + { + if ($self->{is} eq 'players') + { + $origtext =~ s/Exclusivement Solo/1/i; + $origtext =~ s/\s*joueurs?//i; + } + + if ($self->{curInfo}->{$self->{is}} eq '') + { + if ($self->{is} eq 'exclusive') + { + $self->{curInfo}->{$self->{is}} = 'true'; + if ($origtext =~ /$self->{curInfo}->{platform}/i) + { + $self->{curInfo}->{platform} = $origtext; + } + } + else + { + $self->{curInfo}->{$self->{is}} = $origtext; + } + } + else + { + if ($self->{is} eq 'exclusive') + { + $self->{curInfo}->{$self->{is}} = 'false'; + if ($origtext =~ /$self->{curInfo}->{platform}/i) + { + $self->{curInfo}->{platform} = $origtext; + } + } + else + { + $self->{curInfo}->{$self->{is}} = $self->{curInfo}->{$self->{is}} . ', ' . $origtext; + } + } + + } + } + elsif ($self->{isNote} eq 1) + { + $self->{curInfo}->{ratingpress} = $origtext; + $self->{isNote} = 0; + } + elsif ($self->{isDesc} eq 1) + { + # Enleve les blancs en debut de chaine + $origtext =~ s/^\s+//; + # Enleve les blancs en fin de chaine + $origtext =~ s/\s+$//; + $self->{curInfo}->{description} .= $origtext; + } + } + } + + sub getTipsUrl + { + my $self = shift; + + return $self->{url_tips}; + } + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless ($self, $class); + + $self->{hasField} = { + name => 1, + platform => 1, + released => 0, + genre => 1 + }; + + $self->{isGame} = 0; + $self->{isPlatform} = 0; + $self->{isGenre} = 0; + $self->{isEnd} = 0; + $self->{isInfo} = 0; + $self->{isNote} = 0; + $self->{isDesc} = 0; + $self->{isTip} = 0; + $self->{url_plateforme} = ''; + $self->{url_screenshot} = ''; + $self->{url_tips} = ''; + $self->{is} = ''; + + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + + if ($self->{parsingList}) + { + } + elsif ($self->{parsingTips}) + { + } + else + { + $html =~ s|
    |\n|gi; + $html =~ s|||gi; + $html =~ s|||gi; + } + + return $html; + } + + sub getSearchUrl + { + my ($self, $word) = @_; + + return 'http://www.jeuxvideo.fr/r/'.$word.'/'; + } + + sub getItemUrl + { + my ($self, $url) = @_; + + my $found = index($url,"tpfplatformtpf"); + if ( $found >= 0 ) + { + $self->{url_plateforme} = substr($url, $found +length('tpfplatformtpf'),length($url)- $found -length('tpfplatformtpf')); + $url = substr($url, 0,$found); + } + + $self->{url_screenshot} = 'http://www.jeuxvideo.fr' . $url . 'image-photo/'; + $self->{url_tips} = 'http://www.jeuxvideo.fr' . $url . 'astuce-code/'; + + return 'http://www.jeuxvideo.fr' . $url; + } + + sub getName + { + return 'jeuxvideo.fr'; + } + + sub getAuthor + { + return 'Tian'; + } + + sub getLang + { + return 'FR'; + } + + sub getCharset + { + my $self = shift; + + return "ISO-8859-1"; + } + + sub isPreferred + { + return 1; + } + +} + +1; diff --git a/lib/gcstar/GCPlugins/GCgames/GCLudus.pm b/lib/gcstar/GCPlugins/GCgames/GCLudus.pm new file mode 100644 index 0000000..42b42a7 --- /dev/null +++ b/lib/gcstar/GCPlugins/GCgames/GCLudus.pm @@ -0,0 +1,367 @@ +package GCPlugins::GCgames::GCLudus; + +################################################### +# +# Copyright 2005-2010 Christian Jodar +# +# 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::GCPluginLudus; + + use base 'GCPlugins::GCgames::GCgamesPluginsBase'; + + sub start + { + my ($self, $tagname, $attr, $attrseq, $origtext) = @_; + + $self->{inside}->{$tagname}++; + if ($self->{parsingList}) + { + if (($tagname eq 'span') && ( $attr->{class} eq 'titolini' )) + { + $self->{isGame} = 1 ; + } + elsif (($tagname eq 'img') && ($self->{isGame})) + { + $self->{isGame} = 0 ; + $self->{isInfo} = 0 ; + } + elsif (($tagname eq 'a') && ($self->{isGame})) + { + $self->{itemIdx}++; + $self->{itemsList}[$self->{itemIdx}]->{url} = "http://www.ludus.it/" . $attr->{href}; + $self->{isName} = 1 ; + $self->{isInfo} = 1 ; + } + elsif (($tagname eq 'td') && ( $attr->{class} eq 'trat2' ) && ($self->{isInfo} eq '1')) + { + # le deuxieme champs est le type de donnees + $self->{isInfo} = 2 ; + } + elsif (($tagname eq 'td') && ( $attr->{class} eq 'trat2' ) && ($self->{isInfo} eq '2')) + { + # le troisieme champs est la plateforme + $self->{isPlatform} = 1 ; + $self->{isInfo} = 3 ; + } + elsif (($tagname eq 'td') && ( $attr->{class} eq 'trat2' ) && ($self->{isInfo} eq '3')) + { + # le quatrieme champs est la date de sortie + $self->{isDate} = 1 ; + $self->{isInfo} = 0 ; + } + } + elsif ($self->{parsingTips}) + { + } + else + { + if (($tagname eq 'td') && ($attr->{colspan} eq '2') && ($attr->{class} eq 'titoli2')) + { + $self->{isName} = 1 ; + } + elsif (($tagname eq 'span') && ($attr->{class} eq 'testo4')) + { + $self->{isAnalyse} = 1 ; + } + elsif ($self->{isPlatform} eq 1) + { + $self->{isPlatform} = 2 ; + } + elsif ($self->{isEditor} eq 1) + { + $self->{isEditor} = 2 ; + } + elsif ($self->{isDeveloper} eq 1) + { + $self->{isDeveloper} = 2 ; + } + elsif ($self->{isGenre} eq 1) + { + $self->{isGenre} = 2 ; + } + elsif (($tagname eq 'span') && ($attr->{class} eq 'testo') && ($attr->{align} eq '')) + { + $self->{isDescription} = 1 ; + } + elsif (($tagname eq 'tpfsautdeligne') && ($self->{isDescription})) + { + $self->{curInfo}->{description} .= "\n"; + } + elsif (($tagname eq 'table') && ($self->{isDescription})) + { + $self->{isDescription} = 0 ; + } + elsif ( ($tagname eq 'a') && (index($attr->{onclick},"adafl=win") >= 0) && ($self->{curInfo}->{screenshot1} eq '') && ($self->{curInfo}->{screenshot2} eq '')) + { + $self->{isScreen} = 1; + } + elsif ( ($tagname eq 'img') && ($self->{isScreen}) ) + { + if ($self->{curInfo}->{screenshot1} eq '') + { + $self->{curInfo}->{screenshot1} = $attr->{src}; + $self->{curInfo}->{screenshot1} =~ s|//|http://www.ludus.it/|; + my $found = index(reverse($self->{curInfo}->{screenshot1}),"/"); + if ( $found >= 0 ) + { + my $tempscreen = substr(reverse($self->{curInfo}->{screenshot1}), $found +length('/'),length($self->{curInfo}->{screenshot1})- $found -length('/')); + my $tempscreen2 = substr(reverse($self->{curInfo}->{screenshot1}), 0, $found); + $tempscreen2 = "/immagini_grandi/" . reverse($tempscreen2); + $self->{curInfo}->{screenshot1} = reverse($tempscreen) . $tempscreen2; + } + } + elsif ($self->{curInfo}->{screenshot2} eq '') + { + $self->{curInfo}->{screenshot2} = $attr->{src}; + $self->{curInfo}->{screenshot2} =~ s|//|http://www.ludus.it/|; + my $found = index(reverse($self->{curInfo}->{screenshot2}),"/"); + if ( $found >= 0 ) + { + my $tempscreen = substr(reverse($self->{curInfo}->{screenshot2}), $found +length('/'),length($self->{curInfo}->{screenshot2})- $found -length('/')); + my $tempscreen2 = substr(reverse($self->{curInfo}->{screenshot2}), 0, $found); + $tempscreen2 = "/immagini_grandi/" . reverse($tempscreen2); + $self->{curInfo}->{screenshot2} = reverse($tempscreen) . $tempscreen2; + } + $self->{isScreen} = 0; + } + } + elsif (($tagname eq 'a') && (index($attr->{href},"post_form") >= 0)) + { + $self->{curInfo}->{boxpic} = $attr->{href}; + $self->{curInfo}->{boxpic} =~ s|/LINGUA/IT||; + my $found = index(reverse($self->{curInfo}->{boxpic}),"/"); + if ( $found >= 0 ) + { + $self->{curInfo}->{boxpic} = substr(reverse($self->{curInfo}->{boxpic}), 0, $found); + $self->{curInfo}->{boxpic} = "http://www.ludus.it/copertine/giochi/" . reverse($self->{curInfo}->{boxpic}) . ".jpg"; + } + } + } + } + + sub end + { + my ($self, $tagname) = @_; + + $self->{inside}->{$tagname}--; + } + + sub text + { + my ($self, $origtext) = @_; + + if ($self->{parsingList}) + { + # Enleve les blancs en debut de chaine + $origtext =~ s/^\s+//; + # Enleve les blancs en fin de chaine + $origtext =~ s/\s+$//; + if ($self->{isName}) + { + $self->{itemsList}[$self->{itemIdx}]->{name} = $origtext; + $self->{isName} = 0; + } + elsif ($self->{isDate}) + { + $self->{itemsList}[$self->{itemIdx}]->{released} = $origtext; + $self->{isDate} = 0; + } + elsif ($self->{isPlatform}) + { + $origtext =~ s/Pc/PC/; + $self->{itemsList}[$self->{itemIdx}]->{platform} = $origtext; + $self->{isPlatform} = 0; + } + } + elsif ($self->{parsingTips}) + { + } + else + { + # Enleve les blancs en debut de chaine + $origtext =~ s/^\s+//; + if ($self->{isName}) + { + my $found = index(reverse($origtext),"-"); + if ( $found >= 0 ) + { + $origtext = substr(reverse($origtext), $found +length('-'),length($origtext)- $found -length('-')); + $origtext = reverse($origtext); + } + $self->{curInfo}->{name} = $origtext; + $self->{curInfo}->{released} = $self->{itemsList}[$self->{wantedIdx}]->{released}; + $self->{isName} = 0 ; + } + elsif ($self->{isAnalyse}) + { + $self->{isPlatform} = 1 if ($origtext =~ m/Piattaforma:/i); + $self->{isEditor} = 1 if ($origtext =~ m/Software House:/i); + $self->{isDeveloper} = 1 if ($origtext =~ m/Sviluppatore:/i); + $self->{isGenre} = 1 if ($origtext =~ m/Genere:/i); + + $self->{isAnalyse} = 0 ; + } + elsif ($self->{isGenre} eq 2) + { + my @array = split(/\//,$origtext); + my $element; + foreach $element (@array) + { + # Enleve les blancs en debut de chaine + $element =~ s/^\s+//; + $self->{curInfo}->{genre} .= $element; + $self->{curInfo}->{genre} .= ","; + } + $self->{isGenre} = 0; + } + elsif ($self->{isDeveloper} eq 2) + { + $self->{curInfo}->{developer} = $origtext; + $self->{isDeveloper} = 0 ; + } + elsif ($self->{isEditor} eq 2) + { + $self->{curInfo}->{editor} = $origtext; + $self->{isEditor} = 0 ; + } + elsif ($self->{isPlatform} eq 2) + { + $origtext =~ s/Pc/PC/; + $self->{curInfo}->{platform} = $origtext; + $self->{isPlatform} = 0; + } + elsif ($self->{isDescription}) + { + $self->{curInfo}->{description} .= $origtext; + } + } + } + + sub getTipsUrl + { + my $self = shift; + + return ; + } + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless ($self, $class); + + $self->{hasField} = { + name => 1, + platform => 1, + genre => 0, + released => 1 + }; + + $self->{isInfo} = 0; + $self->{isName} = 0; + $self->{isGame} = 0; + $self->{isPlatform} = 0 ; + $self->{isAnalyse} = 0; + $self->{isEditor} = 0; + $self->{isDeveloper} = 0; + $self->{isDate} = 0; + $self->{isGenre} = 0; + $self->{isScreen} = 0; + + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + + if ($self->{parsingList}) + { + } + else + { + $html =~ s|||gi; + $html =~ s|
  • |\n* |gi; + $html =~ s|
    ||gi; + $html =~ s|
    ||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|

    |\n|gi; + $html =~ s|

    ||gi; + $html =~ s|\x{92}|'|gi; + $html =~ s|’|'|gi; + $html =~ s|•|*|gi; + } + return $html; + } + + sub getSearchUrl + { + my ($self, $word) = @_; + + $word =~ s/\+/ /g; + return ('http://www.ludus.it/code/lista_alfabetica_giochi/LINGUA/IT', ["categoria" => "2", "SEARCH_STRING" => "$word"] ); + } + + sub getItemUrl + { + my ($self, $url) = @_; + + return $url; + } + + sub getName + { + return 'Ludus'; + } + + sub getAuthor + { + return 'TPF'; + } + + sub getLang + { + return 'IT'; + } + + sub getCharset + { + my $self = shift; + + return "ISO-8859-1"; + } + + sub getSearchFieldsArray + { + return ['name']; + } +} + +1; diff --git a/lib/gcstar/GCPlugins/GCgames/GCMobyGames.pm b/lib/gcstar/GCPlugins/GCgames/GCMobyGames.pm new file mode 100644 index 0000000..c6650c3 --- /dev/null +++ b/lib/gcstar/GCPlugins/GCgames/GCMobyGames.pm @@ -0,0 +1,541 @@ +package GCPlugins::GCgames::GCMobyGames; + +################################################### +# +# Copyright 2005-2011 Christian Jodar +# +# 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::GCPluginMobyGames; + + use base 'GCPlugins::GCgames::GCgamesPluginsBase'; + use HTML::Entities; + + sub extractTips + { + my ($self, $html_ini) = @_; + my $answer = ""; + my @tmpAnswer = (); + my $html = $self->loadPage($html_ini, 0, 1); + $html =~ s|
    ||gi;
    +        $html =~ s|
    ||gi; + $html =~ s|||gi; + $html =~ s|||gi; + my $found = index($html,"class=\"sbL sbB sbT\">"); + if ( $found >= 0 ) + { + $answer = substr($html, $found + length("class=\"sbL sbB sbT\">"),length($html)- $found -length("class=\"sbL sbB sbT\">") ); + $answer = substr($answer, 0, index($answer,"

    "); + if ( $found >= 0 ) + { + my $html2 = substr($html, $found + length("class=\"sbR sbL sbB\">

    "),length($html)- $found -length("class=\"sbR sbL sbB\">

    ") ); + $html2 = substr($html2, 0, index($html2,"

    ")); + $html2 =~ s/
    /\n/gi; + $html2 =~ s|

    |\n|gi; + $html2 =~ s|

    ||gi; + + $tmpAnswer[1] = decode_entities($html2); + } + + } + + return @tmpAnswer; + } + + sub extractPlayer + { + my ($self, $html_ini, $word) = @_; + my $html = 0; + my $found = index($html_ini,$word); + if ( $found >= 0 ) + { + $html = substr($html_ini, $found + length($word),length($html_ini)- $found -length($word) ); + $html = substr($html,0, index($html,"
    ") ); + $html = reverse($html); + $html = substr($html,0, index($html,">") ); + $html = reverse($html); + $html =~ s/ / /g; + $html =~ s/1 Player/1/; + } + return $html; + } + + sub start + { + my ($self, $tagname, $attr, $attrseq, $origtext) = @_; + + $self->{inside}->{$tagname}++; + if ($self->{parsingList}) + { + if ( !$self->{insideSearchImage} + && ($tagname eq 'a') + && ( substr($attr->{href},0,6) eq '/game/' ) ) + { + # Test if there is a platform name in it + # (i.e. if we can find a second slash after game/ ) + if ($attr->{href} =~ m|/game/[^/]*/|) + { + if ($self->{currentName}) + { + $self->{itemIdx}++; + $self->{itemsList}[$self->{itemIdx}]->{url} = 'http://www.mobygames.com'.$attr->{href}.''; + $self->{itemsList}[$self->{itemIdx}]->{name} = $self->{currentName}; + $self->{isPlatform} = 1; + } + else + { + # This is a game we want to add + $self->{isGame} = 1; + $self->{itemIdx}++; + $self->{itemsList}[$self->{itemIdx}]->{url} = 'http://www.mobygames.com'.$attr->{href}.''; + $self->{isName} = 1 ; + } + } + else + { + # We will need the name later + $self->{isGameName} = 1; + } + } + elsif ( ($tagname eq 'a') && ( substr($attr->{href},0,7) eq '/search' ) ) + { + $self->{isGame} = 0; + } + elsif ($tagname eq 'div') + { + if ($attr->{class} eq 'searchResult') + { + $self->{currentName} = ''; + } + elsif ($attr->{class} eq 'searchImage') + { + $self->{insideSearchImage} = 1; + } + } + elsif ($tagname eq 'em') + { + $self->{isDate} = 1; + } + } + elsif ($self->{parsingTips}) + { + if (($tagname eq 'table') && ($attr->{summary} eq 'List of Tips and Tricks')) + { + $self->{isSectionTips} = 2; + } + elsif ( ($tagname eq 'b') && ($self->{isSectionTips} eq '2') ) + { + $self->{isSectionTips} = 1; + } + elsif ( ($tagname eq 'tr') && (($attr->{class} eq 'mb1') || ($attr->{class} eq 'mb2')) ) + { + $self->{isTip} = 1 if ($self->{isTip} eq 2); + $self->{isCode} = 1 if ($self->{isCode} eq 2); + } + elsif ( ($tagname eq 'a') && ($self->{isTip} eq 1)) + { + my @tips = $self->extractTips('http://www.mobygames.com'.$attr->{href}.''); + if ($tips[0] =~ m/unlock/i) + { + $Text::Wrap::columns = 80; + $tips[1] = Text::Wrap::wrap('', '', $tips[1]); + #$self->{tmpCheatLine} = []; + #push @{$self->{tmpCheatLine}}, @tips; + push @{$self->{curInfo}->{unlockable}}, \@tips; + } + else + { + my $answer = $tips[0]; + $answer .= "\n"; + $answer .= $tips[1]; + if ( ($self->{curInfo}->{secrets}) && ($answer ne "") ) + { + $self->{curInfo}->{secrets} .= "\n\n\n" + } + $self->{curInfo}->{secrets} .= $answer; + } + $self->{isTip} = 2; + } + elsif ( ($tagname eq 'a') && ($self->{isCode} eq 1)) + { + my @tips = $self->extractTips('http://www.mobygames.com'.$attr->{href}.''); + @tips = reverse(@tips); + $Text::Wrap::columns = 80; + $tips[1] = Text::Wrap::wrap('', '', $tips[1]); + #$self->{tmpCheatLine} = []; + #push @{$self->{tmpCheatLine}}, @tips; + push @{$self->{curInfo}->{code}}, \@tips; + + $self->{isCode} = 2; + + } + elsif ($tagname eq 'br') + { + $self->{isTip} = 3; + $self->{isCode} = 3; + $self->{isSectionTips} = 0; + } + elsif ($tagname eq 'head') + { + $self->{isTip} = 0; + $self->{isCode} = 0; + $self->{isSectionTips} = 0; + } + + } + else + { + + if ($tagname eq 'div') + { + for ($attr->{id}) + { + /^gameTitle$/ && ($self->{isName} = 1, last); + /^gamePlatform/ && ($self->{isPlatform} = 1, last); + #/^coreGameCover/ && ($self->{isBox} = 1, last); + /^coreGameRelease/ && ($self->{isEditor} = 1, last); + } + + if ($attr->{class} =~ m/scoreBoxBig/) + { + $self->{isRating} = 1; + } + + if ($self->{curInfo}->{genre}) + { + $self->{isGenre} = 0; + } + + $self->{isDescription} = 0; + + } + elsif ( ($tagname eq 'a') && ($self->{isName}) ) + { + $self->{is} = 'name'; + $self->{curInfo}->{exclusive} = 1; + $self->{isName} = 0; + } + elsif ( ($tagname eq 'a') && ($self->{isPlatform}) ) + { + $self->{is} = 'platform'; + $self->{isPlatform} = 0; + } + elsif ( ($tagname eq 'a') && ($self->{isEditor}) ) + { + $self->{is} = 'editor'; + $self->{isEditor} = 0; + } + elsif ( ($tagname eq 'a') && ($self->{isDeveloper}) ) + { + $self->{is} = 'developer'; + $self->{isDeveloper} = 0; + } + elsif ( ($tagname eq 'a') && ($self->{isDate}) ) + { + $self->{is} = 'released'; + $self->{isDate} = 0; + } + elsif ( ($tagname eq 'a') && ($self->{isGenre}) ) + { + $self->{is} = 'genre'; + } + elsif ($tagname eq 'img') + { + if ($attr->{src} =~ m|covers/small|) + { + $attr->{src} =~ s|/small/|/large/| + if $self->{bigPics}; + $self->{curInfo}->{boxpic} = $attr->{src}; + # From here we try to get back cover + my $covers = $self->loadPage($self->{rootUrl}.'/cover-art', 0, 1); + $covers =~ m|.*?Back Cover{curInfo}->{backpic} = $1; + $self->{curInfo}->{backpic} =~ s|/small/|/large/| + if $self->{bigPics}; + } + } + elsif ($tagname eq 'html') + { + my $html = $self->loadPage($self->{curInfo}->{$self->{urlField}}.'/techinfo', 0, 1); + my $player_offline = $self->extractPlayer($html, "Number of Players: Offline" ); + my $player_online = $self->extractPlayer($html, "Number of Players: Online" ); + my $player_total = $self->extractPlayer($html, "Number of Players Supported" ); + + if ($player_total) + { + $self->{curInfo}->{players} = $player_total; + } + else + { + if ($player_offline) + { + $self->{curInfo}->{players} = 'Offline: '.$player_offline; + } + if ($player_online) + { + if ( $self->{curInfo}->{players} ) + { + $self->{curInfo}->{players} .= '; Online: '.$player_online; + } + else + { + $self->{curInfo}->{players} = 'Online: '.$player_online; + } + } + } + + $html = $self->loadPage($self->{curInfo}->{$self->{urlField}}.'/screenshots', 0, 1); + my $screen = 1; + while ($html =~ m|src="(/images/shots/[^"]*?)"|g) + { + $self->{curInfo}->{'screenshot'.$screen} = 'http://www.mobygames.com' . $1; + $self->{curInfo}->{'screenshot'.$screen} =~ s|/images/shots/s/|/images/shots/l/| + if $self->{bigPics}; + $screen++; + last if $screen > 2; + } + } + elsif ( ($tagname eq 'br') && ($self->{isDescription}) ) + { + $self->{curInfo}->{description} .= "\n"; + } + } + } + + sub end + { + my ($self, $tagname) = @_; + $self->{inside}->{$tagname}--; + if ($self->{parsingList} && ($tagname eq 'div')) + { + $self->{insideSearchImage} = 0; + } + } + + sub text + { + my ($self, $origtext) = @_; + + if ($self->{parsingList}) + { + if ($self->{isName}) + { + #$self->{itemsList}[$self->{itemIdx}]->{name} = $origtext; + if ($origtext !~ /^Game:/) + { + if (!$self->{currentName}) + { + $self->{itemsList}[$self->{itemIdx}]->{name} = $origtext; + } + $self->{isName} = 0; + } + } + elsif ($self->{isPlatform}) + { + $self->{itemsList}[$self->{itemIdx}]->{platform} = $origtext; + $self->{isPlatform} = 0; + } + elsif ($self->{isGameName}) + { + $self->{currentName} = $origtext; + $self->{isGameName} = 0; + } + elsif ($self->{isDate}) + { + # tags enclose both dates and the 'a.k.a.' text, so make sure we + # ignore the aka ones + if ($origtext !~ /^a\.k\.a\./) + { + $self->{itemsList}[$self->{itemIdx}]->{released} = $origtext; + if (! $self->{itemsList}[$self->{itemIdx}]->{platform}) + { + $self->{previous} =~ s/[\s\(]*$//g; + $self->{itemsList}[$self->{itemIdx}]->{platform} = $self->{previous}; + } + } + $self->{isDate} = 0; + } + $self->{previous} = $origtext; + } + elsif ($self->{parsingTips}) + { + if ($self->{isSectionTips} eq 1) + { + if ($origtext =~ m/General Hints\/Tips/i) + { + $self->{isTip} = 2; + $self->{isCode} = 0; + } + elsif ($origtext =~ m/Cheats\/Codes/i) + { + $self->{isTip} = 0; + $self->{isCode} = 2; + } + $self->{isSectionTips} = 2; + } + } + else + { + if ($self->{is}) + { + $origtext =~ s/^\s*//; + + if ($self->{is} eq 'platform') + { + $self->{curInfo}->{$self->{is}} = $origtext; + $self->{curInfo}->{platform} =~ s/DOS/PC/; + $self->{curInfo}->{platform} =~ s/Windows/PC/; + } + elsif ($self->{is} eq 'genre') + { + push @{$self->{curInfo}->{genre}}, [ $origtext ]; + } + else + { + $self->{curInfo}->{$self->{is}} = $origtext; + } + + $self->{is} = ''; + } + elsif ($self->{isRating}) + { + $self->{curInfo}->{ratingpress} = int($origtext/10+0.5); + $self->{isRating} = 0; + } + elsif ($self->{isDescription}) + { + $self->{curInfo}->{description} .= $origtext; + } + elsif ($origtext eq 'Developed by') + { + $self->{isDeveloper} = 1 + } + elsif ( ($origtext eq 'Also For') || (($origtext eq 'Platforms'))) + { + $self->{curInfo}->{exclusive} = 0; + } + elsif ($origtext eq 'Released') + { + $self->{isDate} = 1 + } + elsif ($origtext eq 'Genre') + { + $self->{isGenre} = 1 + } + elsif ($origtext eq 'Description') + { + $self->{isDescription} = 1 + } + } + } + + sub getTipsUrl + { + my $self = shift; + my $url = $self->{curInfo}->{$self->{urlField}}.'/hints'; + $url =~ s/##MobyGames//; + return $url; + } + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless ($self, $class); + + $self->{hasField} = { + name => 1, + platform => 1, + released => 1 + }; + + $self->{isName} = 0; + $self->{isGame} = 0; + $self->{isGameName} = 0; + $self->{isPlatform} = 0; + $self->{isEditor} = 0; + $self->{isDeveloper} = 0; + $self->{isDate} = 0; + $self->{isGenre} = 0; + $self->{isDescription} = 0; + $self->{isBox} = 0; + $self->{isSectionTips} = 0; + $self->{isTip} = 0; + $self->{isCode} = 0; + $self->{is} = ''; + + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + $self->{rootUrl} = $self->{loadedUrl}; + return $html; + } + + sub getSearchUrl + { + my ($self, $word) = @_; + return 'http://www.mobygames.com/search/quick?q='.$word.'&p=-1&search=Go&sFilter=1&sG=on'; + } + + sub getItemUrl + { + my ($self, $url) = @_; + + return $url if $url; + return 'http://www.mobygames.com/'; + } + + sub getName + { + return 'MobyGames'; + } + + sub getAuthor + { + return 'TPF'; + } + + sub getLang + { + return 'EN'; + } + + sub getCharset + { + my $self = shift; + + return "ISO-8859-1"; + } +} + +1; diff --git a/lib/gcstar/GCPlugins/GCgames/GCNextGame.pm b/lib/gcstar/GCPlugins/GCgames/GCNextGame.pm new file mode 100644 index 0000000..b884b54 --- /dev/null +++ b/lib/gcstar/GCPlugins/GCgames/GCNextGame.pm @@ -0,0 +1,480 @@ +package GCPlugins::GCgames::GCNextGame; + +################################################### +# +# Copyright 2005-2010 Christian Jodar +# +# 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::GCPluginNextGame; + + use base 'GCPlugins::GCgames::GCgamesPluginsBase'; + + sub start + { + my ($self, $tagname, $attr, $attrseq, $origtext) = @_; + + $self->{inside}->{$tagname}++; + + if ($self->{parsingList}) + { + if ($self->{isGenre} eq '1') + { + $self->{isGenre} = 2 ; + } + elsif (($tagname eq 'div') && ($attr->{class} eq 'box_searchresult')) + { + $self->{isGame} = 1 ; + $self->{itemIdx}++; + } + elsif (($tagname eq 'ul') && ($attr->{class} eq 'platforms')) + { + $self->{isPlatform} = 1 ; + } + elsif (($tagname eq 'li') && ($self->{isPlatform} eq 1)) + { + $self->{isPlatform} = 2 ; + } + elsif (($tagname eq 'hr') && ($attr->{class} eq 'clear')) + { + $self->{isPlatform} = 0 ; + } + elsif (($tagname eq 'a') && ($attr->{class} eq 'blu')) + { + return if $self->{alreadyRetrieved}->{$attr->{href}}; + $self->{alreadyRetrieved}->{$attr->{href}} = 1; + $self->{itemsList}[$self->{itemIdx}]->{url} = $attr->{href}; + $self->{isName} = 1 ; + } + elsif (($tagname eq 'dt') && ($self->{isGame} eq '1')) + { + $self->{isAnalyse} = 1 ; + } + } + elsif ($self->{parsingTips}) + { + } + else + { + + if ($self->{isDeveloper} eq 1) + { + $self->{isDeveloper} = 2; + } + elsif ($self->{isGenre} eq 1) + { + $self->{isGenre} = 2; + } + elsif ($self->{isEditor} eq 1) + { + $self->{isEditor} = 2 ; + } + elsif ($self->{isDate} eq 1) + { + $self->{isDate} = 2 ; + } + elsif ($self->{isPlayer} eq 1) + { + $self->{isPlayer} = 2; + } + elsif ($self->{isPlatform} eq 1) + { + $self->{isPlatform} = 2; + } + elsif (($tagname eq 'div') && ($attr->{class} eq 'box_liquid')) + { + $self->{isDescription} = 0 ; + } + elsif ($tagname eq 'head') + { + $self->{isDescription} = 0 ; + } + elsif (($tagname eq 'h1') && ($attr->{class} eq 'blu')) + { + $self->{isName} = 1 ; + } + elsif (($tagname eq 'hr') && ($attr->{class} eq 'clear')) + { + $self->{isAnalyse} = 0 ; + } + elsif (($tagname eq 'dl') && ($attr->{class} eq 'datasheet_column')) + { + $self->{isAnalyse} = 1 ; + } + elsif (($tagname eq 'dt') && ($self->{isAnalyse} eq '1')) + { + $self->{isAnalyse} = 2 ; + } + elsif (($tagname eq 'td') && ($attr->{class} eq 'active current')) + { + $self->{isPlatform} = 1 ; + } + elsif (($tagname eq 'img') && ($attr->{id} eq 'datasheet_packshot')) + { + $self->{curInfo}->{boxpic} = $attr->{src}; + if ($self->{bigPics}) + { + $self->{curInfo}->{boxpic} =~ s|.T160.|.|gi; + } + } + elsif ( ($tagname eq 'img') && ($attr->{class} eq 'thumb') ) + { + if ($self->{curInfo}->{screenshot1} eq '') + { + $self->{curInfo}->{screenshot1} = $attr->{src}; + if ($self->{bigPics}) + { + $self->{curInfo}->{screenshot1} =~ s|.T200.|.|gi; + } + } + elsif ($self->{curInfo}->{screenshot2} eq '') + { + $self->{curInfo}->{screenshot2} = $attr->{src}; + if ($self->{bigPics}) + { + $self->{curInfo}->{screenshot2} =~ s|.T200.|.|gi; + } + } + } + elsif (($tagname eq 'a') && ($attr->{name} eq 'REVIEW')) + { + $self->{isDescription} = 1 ; + } + elsif (($tagname eq 'ul') && ($attr->{class} eq 'platforms') && ($self->{isDescription} eq 1)) + { + $self->{isDescription} = 2 ; + } + elsif (($tagname eq 'a') && ($attr->{class} eq 'blu') && ($self->{isDescription} eq 3)) + { + my $html = $self->loadPage( $attr->{href}, 0, 1 ); + $html =~ s|&|&|gi; + my $found = index($html,"
    "); + if ( $found >= 0 ) + { + $html = "<>" . substr($html, $found +length('
    '),length($html)- $found -length('
    ')); + + $found = index($html,"
    "); + if ( $found >= 0 ) + { + $html = substr($html, 0, $found); + } + + my @array = split(/"); + if ( $found >= 0 ) + { + $self->{curInfo}->{description} .= substr($element, $found +length('>'),length($element)- $found -length('>')); + } + } + } + } + } + } + + sub end + { + my ($self, $tagname) = @_; + + $self->{inside}->{$tagname}--; + } + + sub text + { + my ($self, $origtext) = @_; + + if ($self->{parsingList}) + { + if ($self->{isName}) + { + $self->{itemsList}[$self->{itemIdx}]->{name} = $origtext; + $self->{isName} = 0; + } + elsif ($self->{isPlatform} eq 2) + { + # Enleve les blancs en debut de chaine + $origtext =~ s/^\s+//; + # Enleve les blancs en fin de chaine + $origtext =~ s/\s+$//; + + if (($self->{itemsList}[$self->{itemIdx}]->{platform} eq '') && ($origtext ne '')) + { + $self->{itemsList}[$self->{itemIdx}]->{platform} = $origtext; + } + elsif ($origtext ne '') + { + $self->{itemsList}[$self->{itemIdx}]->{platform} .= ', '; + $self->{itemsList}[$self->{itemIdx}]->{platform} .= $origtext; + } + + $self->{isPlatform} = 1 ; + } + elsif ($self->{isAnalyse}) + { + $self->{isGenre} = 1 if ($origtext =~ m/Genere/i); + + $self->{isAnalyse} = 0 ; + } + elsif ($self->{isGenre} eq 2) + { + $self->{itemsList}[$self->{itemIdx}]->{genre} = $origtext; + + my @array = split(/,/,$self->{itemsList}[$self->{itemIdx}]->{platform}); + my $element; + + my $SaveName = $self->{itemsList}[$self->{itemIdx}]->{name}; + my $SaveUrl = $self->{itemsList}[$self->{itemIdx}]->{url}; + my $SaveGenre = $self->{itemsList}[$self->{itemIdx}]->{genre}; + $self->{itemIdx}--; + + if ($SaveName ne "") + { + foreach $element (@array) + { + # Enleve les blancs en debut de chaine + $element =~ s/^\s+//; + # Enleve les blancs en fin de chaine + $element =~ s/\s+$//; + + $self->{itemIdx}++; + $self->{itemsList}[$self->{itemIdx}]->{name} = $SaveName; + $self->{itemsList}[$self->{itemIdx}]->{url} = $SaveUrl . $element .'/'; + $self->{itemsList}[$self->{itemIdx}]->{platform} = $element; + $self->{itemsList}[$self->{itemIdx}]->{genre} = $SaveGenre; + } + } + else + { + $self->{itemIdx}++; + delete $self->{itemsList}[$self->{itemIdx}]; + $self->{itemIdx}--; + } + + $self->{isGenre} = 0; + } + } + elsif ($self->{parsingTips}) + { + } + else + { + # Enleve les blancs en debut de chaine + $origtext =~ s/^\s+//; + if ($self->{isName}) + { + $self->{curInfo}->{name} = $origtext; + $self->{isName} = 0 ; + + if ($self->{ean} ne '') + { + $self->{curInfo}->{ean} = $self->{ean}; + } + + } + elsif ($self->{isPlatform} eq 2) + { + $self->{curInfo}->{platform} = $origtext; + $self->{isPlatform} = 0; + } + elsif ($self->{isAnalyse} eq 2) + { + $self->{isEditor} = 1 if ($origtext =~ m/Produttore/i); + $self->{isDeveloper} = 1 if ($origtext =~ m/Sviluppatore/i); + $self->{isGenre} = 1 if ($origtext =~ m/Genere/i); + $self->{isDate} = 1 if ($origtext =~ m/Disponibile/i); + $self->{isPlayer} = 1 if ($origtext =~ m/Giocatori/i); + + $self->{isAnalyse} = 1 ; + } + elsif ($self->{isDeveloper} eq 2) + { + $self->{curInfo}->{developer} = $origtext; + $self->{isDeveloper} = 0; + } + elsif ($self->{isGenre} eq 2) + { + $self->{curInfo}->{genre} = $origtext; + $self->{isGenre} = 0; + } + elsif ($self->{isEditor} eq 2) + { + $self->{curInfo}->{editor} = $origtext; + $self->{isEditor} = 0 ; + } + elsif ($self->{isDate} eq 2) + { + $self->{curInfo}->{released} = $origtext; + $self->{isDate} = 0 ; + } + elsif ($self->{isPlayer} eq 2) + { + $self->{curInfo}->{players} = $origtext; + $self->{isPlayer} = 0 ; + } + elsif ($self->{isDescription} eq 2) + { + if ($origtext =~ m/$self->{curInfo}->{platform}/i) + { + $self->{isDescription} = 3; + } + else + { + $self->{isDescription} = 1; + } + } + + } + } + + sub getTipsUrl + { + my $self = shift; + + return ; + + } + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless ($self, $class); + + $self->{hasField} = { + name => 1, + platform => 1, + genre => 1, + released => 0 + }; + + $self->{isName} = 0; + $self->{isGame} = 0; + $self->{isPlatform} = 0; + $self->{isAnalyse} = 0 ; + $self->{isGenre} = 0; + $self->{isEditor} = 0; + $self->{isDeveloper} = 0; + $self->{isDate} = 0; + $self->{isPlayer} = 0; + $self->{isDescription} = 0; + $self->{ean} = ''; + + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + + if ($self->{parsingList}) + { + } + else + { + $html =~ s|
  • |
      |gi; + $html =~ s|
    • |\n* |gi; + $html =~ s|
      |\n|gi; + $html =~ s|
      |\n|gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|

      |\n|gi; + $html =~ s|

      ||gi; + $html =~ s|\x{92}|'|gi; + $html =~ s|’|'|gi; + $html =~ s|•|*|gi; + $html =~ s|œ|oe|gi; + $html =~ s|…|...|gi; + $html =~ s|\x{85}|...|gi; + $html =~ s|\x{8C}|OE|gi; + $html =~ s|\x{9C}|oe|gi; + } + $self->{alreadyRetrieved} = {}; + return $html; + } + + sub getSearchUrl + { + my ($self, $word) = @_; + + if ($self->{searchField} eq 'ean') + { + $self->{ean} = $word; + } + else + { + $self->{ean} = ''; + } + + return 'http://next.videogame.it/magazine/review/?name='.$word; + } + + sub getItemUrl + { + my ($self, $url) = @_; + + return $url if $url; + return 'http://next.videogame.it/'; + } + + sub getName + { + return 'NextGame'; + } + + sub getCharset + { + my $self = shift; + return "ISO-8859-1"; + } + + sub getAuthor + { + return 'TPF'; + } + + sub getLang + { + return 'IT'; + } + + sub getSearchFieldsArray + { + return ['name']; + } + + sub getDefaultPictureSuffix + { + return '.jpg'; + } +} + +1; + diff --git a/lib/gcstar/GCPlugins/GCgames/GCTheLegacy.pm b/lib/gcstar/GCPlugins/GCgames/GCTheLegacy.pm new file mode 100644 index 0000000..c0759a4 --- /dev/null +++ b/lib/gcstar/GCPlugins/GCgames/GCTheLegacy.pm @@ -0,0 +1,316 @@ +package GCPlugins::GCgames::GCTheLegacy; + +################################################### +# +# Copyright 2005-2010 Christian Jodar +# +# 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::GCPluginTheLegacy; + + use base 'GCPlugins::GCgames::GCgamesPluginsBase'; + + sub start + { + my ($self, $tagname, $attr, $attrseq, $origtext) = @_; + + $self->{inside}->{$tagname}++; + if ($self->{parsingList}) + { + if (($tagname eq 'a') && ( $attr->{class} eq 'aa' )) + { + $self->{itemIdx}++; + $self->{itemsList}[$self->{itemIdx}]->{url} = "http://www.thelegacy.de/Museum/" . $attr->{href}; + $self->{isName} = 1 ; + } + } + elsif ($self->{parsingTips}) + { + } + else + { + if (($tagname eq 'div') && ($attr->{style} eq 'font-size:14pt; color:#990000; padding-top:0.5em;')) + { + $self->{isName} = 1 ; + } + elsif (($tagname eq 'div') && ($attr->{class} eq 'description') && ($self->{curInfo}->{platform} eq '')) + { + $self->{isPlatform} = 1 ; + } + elsif (($tagname eq 'a') && ($attr->{target} eq 'ListGames') && ($attr->{class} eq 'a') && ($attr->{style} eq '')) + { + $self->{isGenre} = 1 ; + } + elsif (($tagname eq 'img') && ($attr->{src} =~ m|/pics/cover/Thumb|i)) + { + $self->{curInfo}->{boxpic} = "http://www.thelegacy.de" . $attr->{src}; + } + elsif (($tagname eq 'img') && ($attr->{src} =~ m|/pics/backcover/Thumb|i)) + { + $self->{curInfo}->{backpic} = "http://www.thelegacy.de" . $attr->{src}; + } + elsif (($tagname eq 'img') && ($attr->{src} =~ m|/pics/screen|i)) + { + if ($self->{curInfo}->{screenshot1} eq '') + { + $self->{curInfo}->{screenshot1} = "http://www.thelegacy.de" . $attr->{src}; + } + elsif ($self->{curInfo}->{screenshot2} eq '') + { + $self->{curInfo}->{screenshot2} = "http://www.thelegacy.de" . $attr->{src}; + } + } + elsif ( (($tagname eq 'span') ||($tagname eq 'div')) && ($attr->{class} eq 'category')) + { + $self->{isAnalyse} = 1 ; + } + elsif (($self->{isEditor} eq 1) && ($tagname eq 'a') && ($attr->{target} eq 'ListGames') && ($attr->{class} eq 'aa') && ($self->{curInfo}->{editor} eq '')) + { + $self->{isEditor} = 2 ; + } + elsif (($self->{isDeveloper} eq 1) && ($tagname eq 'a') && ($attr->{target} eq 'ListGames') && ($attr->{class} eq 'aa') && ($self->{curInfo}->{developer} eq '')) + { + $self->{isDeveloper} = 2 ; + } + elsif (($self->{isDate} eq 1) && ($tagname eq 'div') && ($attr->{class} eq 'description') && ($self->{curInfo}->{released} eq '')) + { + $self->{isDate} = 2 ; + } + elsif (($tagname eq 'a') && ($attr->{name} =~ m|review_|i)) + { + $self->{isDescription} = 1 ; + } + elsif (($self->{isDescription} eq 1) && ($tagname eq 'a') && ($attr->{class} eq 'aa')) + { + $self->{isDescription} = 2 ; + } + elsif (($tagname eq 'span') && ( $attr->{id} =~ m|review_|i) && ( $attr->{id} =~ m|_less|i)) + { + $self->{isDescription} = 0 ; + } + } + } + + sub end + { + my ($self, $tagname) = @_; + + $self->{inside}->{$tagname}--; + } + + sub text + { + my ($self, $origtext) = @_; + + if ($self->{parsingList}) + { + # Enleve les blancs en debut de chaine + $origtext =~ s/^\s+//; + # Enleve les blancs en fin de chaine + $origtext =~ s/\s+$//; + if ($self->{isName}) + { + $self->{itemsList}[$self->{itemIdx}]->{name} = $origtext; + $self->{isName} = 0; + } + } + elsif ($self->{parsingTips}) + { + } + else + { + # Enleve les blancs en debut de chaine + $origtext =~ s/^\s+//; + # Enleve les blancs en fin de chaine + $origtext =~ s/\s+$//; + if ($self->{isName}) + { + $self->{curInfo}->{name} = $origtext; + $self->{isName} = 0 ; + } + elsif ($self->{isAnalyse}) + { + $self->{isDate} = 0; + $self->{isDeveloper} = 0; + $self->{isEditor} = 0; + + $self->{isDate} = 1 if ($origtext =~ m/ffentlichung/i); + $self->{isDate} = 1 if ($origtext =~ m/Publishing/i); + $self->{isDeveloper} = 1 if ($origtext =~ m/Entwickler/i); + $self->{isDeveloper} = 1 if ($origtext =~ m/developer/i); + $self->{isEditor} = 1 if ($origtext =~ m/Publisher/i); + + $self->{isAnalyse} = 0 ; + } + elsif ($self->{isDate} eq 2) + { + $origtext =~ s/://; + $self->{curInfo}->{released} = $origtext; + $self->{isDate} = 0 ; + } + elsif ($self->{isGenre}) + { + $self->{curInfo}->{genre} .= $origtext; + $self->{curInfo}->{genre} .= ","; + $self->{isGenre} = 0; + } + elsif ($self->{isDeveloper} eq 2) + { + $self->{curInfo}->{developer} = $origtext; + $self->{isDeveloper} = 0 ; + } + elsif ($self->{isEditor} eq 2) + { + $self->{curInfo}->{editor} = $origtext; + $self->{isEditor} = 0 ; + } + elsif ($self->{isPlatform}) + { + $origtext =~ s/PC \(Windows\)/PC/; + my @array = split(/-/,$origtext); + $self->{curInfo}->{platform} = $array[0]; + # Enleve les blancs en fin de chaine + $self->{curInfo}->{platform} =~ s/\s+$//; + $self->{isPlatform} = 0; + } + elsif ($self->{isDescription} eq 1) + { + $self->{curInfo}->{description} .= $origtext; + } + elsif ($self->{isDescription} eq 2) + { + $self->{isDescription} = 1; + } + } + } + + sub getTipsUrl + { + my $self = shift; + + return ; + } + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless ($self, $class); + + $self->{hasField} = { + name => 1, + platform => 0, + genre => 0, + released => 0 + }; + + $self->{isInfo} = 0; + $self->{isName} = 0; + $self->{isPlatform} = 0 ; + $self->{isAnalyse} = 0; + $self->{isEditor} = 0; + $self->{isDeveloper} = 0; + $self->{isDate} = 0; + $self->{isGenre} = 0; + $self->{isDescription} = 0; + + return $self; + } + + sub preProcess + { + my ($self, $html) = @_; + + if ($self->{parsingList}) + { + } + else + { + $html =~ s|||gi; + $html =~ s|
    • |\n* |gi; + $html =~ s|
      |\n|gi; + $html =~ s|
      |\n|gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|||gi; + $html =~ s|

      |\n|gi; + $html =~ s|

      ||gi; + $html =~ s|\x{92}|'|gi; + $html =~ s|’|'|gi; + $html =~ s|•|*|gi; + $html =~ s|œ|oe|gi; + $html =~ s|…|...|gi; + $html =~ s|\x{85}|...|gi; + $html =~ s|\x{8C}|OE|gi; + $html =~ s|\x{9C}|oe|gi; + } + return $html; + } + + sub getSearchUrl + { + my ($self, $word) = @_; + + return "http://www.thelegacy.de/Museum/SQLlist_games.php3?logicalSearchConnection[]=AND&SearchValue=" . $word. "&searchEntity=TITLE&Review=&Forum=&type=&changed=&TopTen=&titel_id=&game_id=&titel=&first_letter=&misc=yes&quick=yes"; + } + + sub getItemUrl + { + my ($self, $url) = @_; + + return $url; + } + + sub getName + { + return 'TheLegacy'; + } + + sub getAuthor + { + return 'TPF'; + } + + sub getLang + { + return 'DE'; + } + + sub getCharset + { + my $self = shift; + + return "ISO-8859-15"; + } + + sub getSearchFieldsArray + { + return ['name']; + } +} + +1; diff --git a/lib/gcstar/GCPlugins/GCgames/GCgamesAmazonCommon.pm b/lib/gcstar/GCPlugins/GCgames/GCgamesAmazonCommon.pm new file mode 100644 index 0000000..ce3b52c --- /dev/null +++ b/lib/gcstar/GCPlugins/GCgames/GCgamesAmazonCommon.pm @@ -0,0 +1,314 @@ +package GCPlugins::GCgames::GCgamesAmazonCommon; + +################################################### +# +# 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; +use GCPlugins::GCstar::GCAmazonCommon; + +{ + package GCPlugins::GCgames::GCgamesAmazonPluginsBase; + + use base ('GCPlugins::GCgames::GCgamesPluginsBase', 'GCPlugins::GCstar::GCPluginAmazonCommon'); + + sub start + { + my ($self, $tagname, $attr, $attrseq, $origtext) = @_; + + $self->{inside}->{$tagname}++; + + if ($self->{parsingList}) + { + if ( ($tagname eq 'div') && ($attr->{class} eq 'buying') && ($self->{isGame} ne 2) ) + { + $self->{itemIdx}++; + $self->{itemsList}[$self->{itemIdx}]->{url} = $self->{loadedUrl}; + $self->{isGame} = 2 ; + } + elsif ( ($tagname eq 'h1') && ($attr->{class} eq 'headerblocktitle') && ($self->{isGame} ne 2) ) + { + $self->{isGame} = 1 ; + $self->{isUrl} = 1 ; + } + elsif ( ($tagname eq 'td') && ($attr->{class} eq 'imageColumn') && ($self->{isGame} ne 2) ) + { + $self->{isGame} = 1 ; + $self->{isUrl} = 1 ; + } + elsif ( ($tagname eq 'a') && ($self->{isGame} eq 1) && ($self->{isUrl}) ) + { + $self->{itemIdx}++; + $self->{itemsList}[$self->{itemIdx}]->{url} = $attr->{href}; + $self->{isUrl} = 0 ; + } + elsif ( ($tagname eq 'span') && ($attr->{class} eq 'srTitle') && ($self->{isGame} eq 1) ) + { + $self->{isName} = 1 ; + } + elsif ( ($tagname eq 'span') && ($attr->{class} eq 'binding') && ($self->{isGame} eq 1) ) + { + $self->{isPlatform} = 1 ; + } + elsif ( ($tagname eq 'span') && ($attr->{class} eq 'avail') ) + { + $self->{isGame} = 0 ; + } + elsif ( ($tagname eq 'div') && ($attr->{class} eq 'usedPrice') ) + { + $self->{isGame} = 0 ; + } + elsif ( ($tagname eq 'input') && ($attr->{name} eq 'sdp-sai-asin') ) + { + $self->{isCodeEAN} = 1 ; + } + elsif ( ($tagname eq 'a') && ($self->{isCodeEAN})) + { + $self->{SaveUrl} = $attr->{href}; + $self->{isCodeEAN} = 0 ; + } + elsif ( ($tagname eq 'b') && ($attr->{class} eq 'sans') ) + { + $self->{itemIdx}++; + $self->{itemsList}[$self->{itemIdx}]->{url} = $self->{SaveUrl}; + } + } + elsif ($self->{parsingTips}) + { + } + else + { + + if ( ($tagname eq 'meta') && ($attr->{name} eq 'keywords') ) + { + my ($name, $editor, @genre) = split(/,/,$attr->{content}); + $self->{curInfo}->{name} = $name; + $self->{curInfo}->{editor} = $editor; + my $element; + foreach $element (@genre) + { + $element =~ s/^\s+//; + if ( !($element =~ m/console/i) && !($element =~ m/cartouche/i) && !($element =~ m/video games/i) && !($element =~ /([0-9])/)) + { + $self->{curInfo}->{genre} .= $element; + $self->{curInfo}->{genre} .= ","; + } + } + + # Sur Amazon.com et amazon.co.jp je n ai pas reussi a trouver un critere pertinent pour la recherche des genres + if (($self->{suffix} eq 'com') || ($self->{suffix} eq 'co.jp') ) + { + $self->{curInfo}->{genre} = ''; + } + + if ($self->{ean} ne '') + { + $self->{curInfo}->{ean} = $self->{ean}; + } + } + elsif ($tagname eq 'tpfdateparution') + { + $self->{isDate} = 1 ; + } + elsif ($tagname eq 'tpfplateforme') + { + $self->{isPlatform} = 1 ; + } + elsif ($tagname eq 'tpfcouverture') + { + $self->{curInfo}->{boxpic} = $self->extractImage($attr); + } + elsif ($tagname eq 'tpfscreenshot1') + { + $self->{curInfo}->{screenshot1} = $self->extractImage($attr); + } + elsif ($tagname eq 'tpfscreenshot2') + { + $self->{curInfo}->{screenshot2} = $self->extractImage($attr); + } + elsif (($tagname eq 'tpfdescription') ) + { + $self->{isDesc} = 1; + } + elsif ( ($tagname eq 'div') && ($attr->{class} eq 'bucket') && ($self->{isDesc} eq 1)) + { + $self->{isDesc} = 0; + } + + } + } + + sub end + { + my ($self, $tagname) = @_; + + $self->{inside}->{$tagname}--; + } + + sub text + { + my ($self, $origtext) = @_; + + if ($self->{parsingList}) + { + if ($self->{isPlatform}) + { + $self->{itemsList}[$self->{itemIdx}]->{platform} = $self->transformPlatform($origtext); + $self->{isPlatform} = 0; + } + elsif ($self->{isName}) + { + $self->{itemsList}[$self->{itemIdx}]->{name} = $origtext; + $self->{isName} = 0; + } + } + elsif ($self->{parsingTips}) + { + } + else + { + # Enleve les blancs en debut de chaine + $origtext =~ s/^\s+//; + # Enleve les blancs en fin de chaine + $origtext =~ s/\s+$//; + + if ($self->{isDate}) + { + $self->{curInfo}->{released} = $origtext; + $self->{isDate} = 0; + } + elsif ($self->{isPlatform}) + { + if ($origtext ne '' ) + { + $self->{curInfo}->{platform} = $self->transformPlatform($origtext); + $self->{isPlatform} = 0; + } + } + elsif (($self->{isDesc}) && ($origtext ne "")) + { + $self->{curInfo}->{description} .= $origtext ."\n"; + } + } + } + + sub transformPlatform + { + my ($self, $platform) = @_; + + $platform =~ s/^([\w ]*)\W{2}.*$/$1/ms; + $platform =~ s/SONY //i; + if ($platform =~ m/windows/i) + { + $platform = 'PC'; + } + return $platform; + } + + sub getTipsUrl + { + my $self = shift; + + return; + } + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless ($self, $class); + + $self->{hasField} = { + name => 1, + platform => 1 + }; + + $self->{isCodeEAN} = 0; + $self->{SaveUrl} = ''; + $self->{isName} = 0; + $self->{isGame} = 0; + $self->{isUrl} = 0; + $self->{isPlatform} = 0; + $self->{isDate} = 0; + $self->{isDesc} = 0; + $self->{ean} = ''; + + return $self; + } + + sub getSearchUrl + { + my ($self, $word) = @_; + + if ($self->{searchField} eq 'ean') + { + $self->{ean} = $word; + return "http://s1.amazon." . $self->{suffix} . "/exec/varzea/sdp/sai-condition/" . $word; + } + else + { + $self->{ean} = ''; + } + + return 'http://www.amazon.' . $self->{suffix} . '/gp/search/?redirect=true&search-alias=videogames&keywords=' .$word; + } + + sub getItemUrl + { + my ($self, $url) = @_; + + return $url if $url; + return 'http://www.amazon.' . $self->{suffix}; + } + + sub getName + { + return 'Amazon'; + } + + sub getAuthor + { + return 'TPF'; + } + + sub getLang + { + return 'FR'; + } + + sub getCharset + { + my $self = shift; + + return "ISO-8859-1"; + } + + sub getSearchFieldsArray + { + return ['ean', 'name']; + } +} + +1; diff --git a/lib/gcstar/GCPlugins/GCgames/GCgamesCommon.pm b/lib/gcstar/GCPlugins/GCgames/GCgamesCommon.pm new file mode 100644 index 0000000..9403652 --- /dev/null +++ b/lib/gcstar/GCPlugins/GCgames/GCgamesCommon.pm @@ -0,0 +1,87 @@ +package GCPlugins::GCgames::GCgamesCommon; + +################################################### +# +# Copyright 2005-2010 Christian Jodar +# +# 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; + +our $MAX_ACTORS = 6; +our $MAX_DIRECTORS = 4; + +use GCPlugins::GCPluginsBase; + +{ + package GCPlugins::GCgames::GCgamesPluginsBase; + + use base qw(GCPluginParser); + use HTML::Entities; + + sub new + { + my $proto = shift; + my $class = ref($proto) || $proto; + my $self = $class->SUPER::new(); + bless ($self, $class); + return $self; + } + + sub getSearchFieldsArray + { + return ['name']; + } + + sub getTipsUrl + { + my $self = shift; + + return ''; + } + + sub getTips + { + my $self = shift; + my $url = $self->getTipsUrl; + if ($url) + { + $self->{parsingTips} = 1; + my $html = $self->loadPage($url, 0, 1); + $html = $self->preProcess($html); + decode_entities($html); + $self->{inside} = undef; + $self->parse($html); + $self->{parsingTips} = 0; + } + } + + sub getItemInfo + { + my $self = shift; + + $self->SUPER::getItemInfo; + $self->getTips; + + return $self->{curInfo}; + } + +} + +1; \ No newline at end of file -- cgit v1.2.3