Author: tpf
Date: Sat May  9 12:16:02 2015
New Revision: 2258

URL: http://svn.gna.org/viewcvs/gcstar?rev=2258&view=rev
Log:
° Minor modifications of the layout of search screen
° BUG solved : G.GEAR and PC ENGINE platforms forgotten if a game is several 
platforms

Modified:
    trunk/gcstar/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoCom.pm

Modified: trunk/gcstar/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoCom.pm
URL: 
http://svn.gna.org/viewcvs/gcstar/trunk/gcstar/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoCom.pm?rev=2258&r1=2257&r2=2258&view=diff
==============================================================================
--- trunk/gcstar/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoCom.pm (original)
+++ trunk/gcstar/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoCom.pm Sat May  9 
12:16:02 2015
@@ -62,7 +62,7 @@
         my @lines = split /\n/, $tabs;
         foreach my $line (@lines)
         {
-            if ($line =~ /href="([^"]*)".*?>(\w*)<\/a>/)
+            if ($line =~ /href="([^"]*)".*?>([0-9a-zA-Z_. ]*)<\/a>/)
             {
                 my $url = $1;
                 my $platform = $2;
@@ -83,7 +83,7 @@
         {
             if ($tagname eq 'span') 
             {
-                if ($attr->{class} =~ /JvCare\s+([0-9A-F]*)\s+lien-jv/)
+                if (($attr->{class} =~ /JvCare\s+([0-9A-F]*)\s+lien-jv/) && 
($attr->{title} ne ""))
                 {
                     my $url = $self->decryptUrl($1);
                     if (! exists $self->{urls}->{$url})
@@ -99,24 +99,33 @@
                             $self->{itemIdx}++;
                             $self->{itemsList}[$self->{itemIdx}]->{url} = $url;
                             $self->{isGame} = 1;
+                            # Note : some game's name contains '-' => not use 
$attr->{title}
+                                       $self->{isName} = 1;
+
+                                                       my @array = 
split(/-/,$attr->{title});
+                                                       if (scalar(@array) ge 3 
)
+                               {
+                                               if (!($array[$#array] =~ 
/date/i))
+                                               {
+                                                                       
$self->{itemsList}[$self->{itemIdx}]->{released} = $array[$#array];
+                                               }
+                           }
+
                             $self->{urls}->{$url} = 1;
                         }
                     }
                 }
                 return if !$self->{isGame};
-                if ($attr->{class} =~ /label-machine\s+label-(\w+)/)
+                if ($attr->{class} =~ /recherche-aphabetique-item-machine/)
                 {
                     $self->{isPlatform} = 1;
                 }
             }
-            elsif (($tagname eq 'h2') && ($attr->{class} =~ /titre-item/))
-            {
-                $self->{isName} = 1;
-            }
         }
         elsif ($self->{parsingTips})
         {
-            if ($attr->{class} eq 'rubrique-asl collapsed')
+#            if ($attr->{class} eq 'rubrique-asl collapsed')
+            if ($attr->{class} eq 'rubrique-asl')
             {
                 $self->{isTip} = 1;
             }
@@ -143,7 +152,7 @@
         {
             if ($tagname eq 'span')
             {
-                if ($attr->{class} eq 'onglet-machine active')
+                if ($attr->{class} =~ 'label-support active')
                 {
                     $self->{is} = 'platform';
                 }
@@ -168,24 +177,24 @@
                     $self->{curInfo}->{$self->{is}} = 
'http:'.$attr->{'data-selector'};
                     $self->{is} = '';
                 }
-                elsif ($attr->{class} =~ /onglet-machine$/)
+            }
+            elsif ($tagname eq 'div')
+            {
+                if ($attr->{class} eq 'titre-meta')
+                {
+                    $self->{is} = 'name';
+                }
+                elsif ($attr->{class} eq 'bloc-note-redac')
+                {
+                    $self->{is} = 'ratingpress';
+                }
+                elsif ($attr->{class} eq 'bloc-img-fiche')
+                {
+                    $self->{is} = 'screenshot1';
+                }
+                elsif ($attr->{class} eq 'bloc-all-support')
                 {
                     $self->{curInfo}->{exclusive} = 0;
-                }
-            }
-            elsif ($tagname eq 'div')
-            {
-                if ($attr->{class} eq 'titre-meta')
-                {
-                    $self->{is} = 'name';
-                }
-                elsif ($attr->{class} eq 'bloc-note-redac')
-                {
-                    $self->{is} = 'ratingpress';
-                }
-                elsif ($attr->{class} eq 'bloc-img-fiche')
-                {
-                    $self->{is} = 'screenshot1';
                 }
             }
             elsif ($tagname eq 'img')
@@ -230,25 +239,24 @@
         if ($self->{parsingList})
         {
             return if !$self->{isGame};
-            if ($origtext eq 'Date de sortie :')
-            {
-                $self->{isReleased} = 1;
-            }
-            elsif ($self->{isPlatform})
-            {
-                $self->{itemsList}[$self->{itemIdx}]->{platform} = $origtext;
+            if ($self->{isPlatform})
+            {
+                if ($self->{itemsList}[$self->{itemIdx}]->{platform} eq "" )
+                       {
+                       # Enleve le " - " présent en début de chaîne
+                           $origtext =~ s/- //;
+                       $self->{itemsList}[$self->{itemIdx}]->{platform} = 
$origtext;
+                       }
                 $self->{isPlatform} = 0;
             }
             elsif ($self->{isName})
             {
+               # Enleve les blancs en debut de chaine
+                   $origtext =~ s/^\s+//;
+               # Enleve les blancs en fin de chaine
+                   $origtext =~ s/\s+$//;
                 $self->{itemsList}[$self->{itemIdx}]->{name} = $origtext;
                 $self->{isName} = 0;
-            }
-            elsif ($self->{isReleased})
-            {
-                return if $origtext =~ /^\s*$/;
-                $self->{itemsList}[$self->{itemIdx}]->{released} = $origtext;
-                $self->{isReleased} = 0;
             }
         }
         elsif ($self->{parsingTips})
@@ -261,7 +269,16 @@
             if ($self->{isTip} eq 1)
             {
                    $origtext =~ s|playstation 3|ps3|gi;
+                   $origtext =~ s|playstation 4|ps4|gi;
+                   $origtext =~ s|playstation|ps1|gi;
                    $origtext =~ s|wii u|wiiu|gi;
+                   $origtext =~ s|playstation portable|PSP|gi;
+                   $origtext =~ s|gameboy advance|GBA|gi;
+                   $origtext =~ s|Super Nintendo|SNES|gi;
+                   $origtext =~ s|n-gage|NGAGE|gi;
+                   $origtext =~ s|Nintendo 64|N64|gi;
+                   $origtext =~ s|Master system|MS|gi;
+                   $origtext =~ s|Game Gear|G.GEAR|gi;
                if ($origtext =~ /$self->{curInfo}->{platform}/i)
                    {
                        $self->{isTip} = 2;
@@ -377,6 +394,7 @@
         {
             $html =~ s|<a data-jvcode="HTMLBLOCK" 
href="(.+)">|$self->RecupTips("http://www.jeuxvideo.com/"; . $1)|ge;
             $html =~ s|Chargement du lecteur vid(.)o...|<p>"Une video est 
disponible"</p>|gi;
+            $html =~ s|<img src="//www.jeuxvideo.com/img/keys/(.+?).gif" 
alt="(.+?)" />|$2|gi;
         }
         else
         {


_______________________________________________
GCstar-commits mailing list
[email protected]
https://mail.gna.org/listinfo/gcstar-commits

Reply via email to