Author: tpf
Date: Sun Mar 16 18:27:18 2014
New Revision: 2248

URL: http://svn.gna.org/viewcvs/gcstar?rev=2248&view=rev
Log:
° Modification of the layout of the website

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

Modified: trunk/gcstar/lib/gcstar/GCPlugins/GCgames/GCGameSpot.pm
URL: 
http://svn.gna.org/viewcvs/gcstar/trunk/gcstar/lib/gcstar/GCPlugins/GCgames/GCGameSpot.pm?rev=2248&r1=2247&r2=2248&view=diff
==============================================================================
--- trunk/gcstar/lib/gcstar/GCPlugins/GCgames/GCGameSpot.pm     (original)
+++ trunk/gcstar/lib/gcstar/GCPlugins/GCgames/GCGameSpot.pm     Sun Mar 16 
18:27:18 2014
@@ -56,159 +56,9 @@
             elsif (($tagname eq 'time') && ($attr->{class} eq 'media-date') && 
($self->{isGame}))
             {
                 $self->{itemsList}[$self->{itemIdx}]->{released} = 
$attr->{datetime};
-            }
-            elsif (($tagname eq 'h3') && ($attr->{class} eq 'media-title') && 
($self->{isGame}))
-            {
-                $self->{isName} = 1;
-            }
-            elsif (($tagname eq 'span') && ($attr->{class} eq 'media-tags ') 
&& ($self->{isGame}))
-            {
-                $self->{isEnd} = 1;
-            }
-            elsif (($tagname eq 'div') && ($attr->{class} eq 'navigation 
navigation--is-top'))
-            {
-                $self->{isGame} = 0;
-            }
-        }
-        elsif ($self->{parsingTips})
-        {
-            if (($tagname eq 'h2') && ($attr->{class} eq 'cheats__title'))
-            {
-                $self->{isSection} = 1;
-            }
-            elsif (($tagname eq 'th') && ($attr->{scope} eq 'row') && 
($attr->{class} eq 'cheats__code') && (($self->{section} eq 'Codes') || 
($self->{section} eq 'Unlockables')))
-            {
-                $self->{isCheat} = 1;
-            }
-            elsif (($tagname eq 'td') && ($attr->{class} eq 'cheats__effect') 
&& ($self->{section} ne ''))
-            {
-                $self->{isDesc} = 1;
-            }
-            elsif (($tagname eq 'li') && ($attr->{class} eq 
'cheats-list__item'))
-            {
-                $self->{section} = '';
-            }
-            elsif ($tagname eq 'head')
-            {
-                $self->{urlTips} = '';
-            }
-        }
-        else
-        {
-            if (($tagname eq 'figure') && ($attr->{'data-embed-type'} eq 
'image'))
-            {
-               if (! $self->{curInfo}->{screenshot1})
-                {
-                       $self->{curInfo}->{screenshot1} = 
$attr->{'data-resize-src'};
-                }
-                elsif (! $self->{curInfo}->{screenshot2})
-                {
-                       $self->{curInfo}->{screenshot2} = 
$attr->{'data-resize-src'};
-                }
-            }
-            elsif (($tagname eq 'img') && ($self->{isBox}))
-            {
-                $self->{curInfo}->{boxpic} = $attr->{src};
-                $self->{curInfo}->{boxpic} =~ s/_medium/_avatar/ if 
!$self->{bigPics} ;
-                $self->{isBox} = 0;
-            }
-            elsif (($tagname eq 'dt') && ($attr->{class} eq 
'pod-objectStats__title'))
-            {
-                $self->{isGame} = 1 if ! $self->{curInfo}->{name};
-            }
-            elsif (($tagname eq 'header') && ($self->{isGame}))
-            {
-                $self->{isGame} = 0;
-                if ($self->{curInfo}->{exclusive} ne 1)
-                {
-                       $self->{curInfo}->{exclusive} = 0;
-                }
-            }
-            elsif (($tagname eq 'h3') && ($self->{isGame}))
-            {
-                $self->{isName} = 1 if ! $self->{curInfo}->{name};
-            }
-            elsif (($tagname eq 'ul') && ($attr->{class} eq 'system-list') && 
($self->{isGame}))
-            {
-                $self->{curInfo}->{exclusive} = 0;
-            }
-            elsif (($tagname eq 'li') && ($attr->{class} =~ m/system /i) && 
($self->{isGame}))
-            {
-                $self->{curInfo}->{exclusive} = $self->{curInfo}->{exclusive} 
+ 1;
-            }
-            elsif (($tagname eq 'div') && ($attr->{class} eq 'media-img 
media-img--boxart') && ($self->{isGame}))
-            {
-                $self->{isBox} = 1;
-            }
-            elsif (($tagname eq 'li') && ($attr->{class} eq 
'pod-objectStats__item') && ($self->{isGame}))
-            {
-                $self->{isEditor} = 0;
-                $self->{isDeveloper} = 0;
-                $self->{isGenre} = 0;
-            }
-            elsif (($tagname eq 'dd') && ($attr->{class} eq 
'pod-objectStats__deck'))
-            {
-                $self->{isDesc} = 1;
-            }
-            elsif (($tagname eq 'span') && ($attr->{itemprop} eq 'rating'))
-            {
-                $self->{isRating} = 1;
-            }
-            elsif (($tagname eq 'a') && ($attr->{href} =~ /\/cheats\//))
-            {
-                $self->{urlTips} = $attr->{href};
-            }
-        }
-    }
-
-    sub end
-    {
-               my ($self, $tagname) = @_;
-               
-        $self->{inside}->{$tagname}--;
-    }
-
-    sub text
-    {
-        my ($self, $origtext) = @_;
-
-        if ($self->{parsingList})
-        {
-            if ($self->{isName} eq 1)
-            {
-                # 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->{isEnd})
-            {
-                       my $html = 
$self->loadPage($self->{itemsList}[$self->{itemIdx}]->{url});
-
-                       my $found = index($html,"<ul class=\"system-list\">");
-                       if ( $found >= 0 )
-                       {
-                           $html = substr($html, $found + length('<ul 
class="system-list">'),length($html)- $found -length('<ul 
class="system-list">') );
-                               $found = index($html,"</ul>");
-                               if ( $found >= 0 )
-                               {
-                                   $html = substr($html, 0, $found);
-                               }
-                               else
-                               {
-                                   $html = '';
-                               }
-                    $html =~ s/<\/li>/,/gi;
-                       }
-                       else
-                       {
-                           $html = '';
-                       }
-
-                my @array = split(/,/,$html);
+                $self->{isPlatform} = 0;
+
+                my @array = 
split(/,/,$self->{itemsList}[$self->{itemIdx}]->{platform});
                 my $element;
 
                 my $SaveName = $self->{itemsList}[$self->{itemIdx}]->{name};
@@ -218,16 +68,6 @@
 
                 foreach $element (@array)
                 {
-                               $found = index($element,">");
-                       if ( $found >= 0 )
-                               {
-                                   $element = substr($element, $found + 
length('>'),length($element)- $found -length('>') );
-                           }
-                    # Enleve les blancs en debut de chaine
-                    $element =~ s/^\s+//;
-                    # Enleve les blancs en fin de chaine
-                    $element =~ s/\s+$//;
-
                                        if ($element ne '')
                                        {
                            $self->{itemIdx}++;
@@ -237,7 +77,161 @@
                                $self->{itemsList}[$self->{itemIdx}]->{url} = 
$SaveUrl . 'tpfplatformtpf' . $self->{itemsList}[$self->{itemIdx}]->{platform}. 
'tpfreleasetpf' . $self->{itemsList}[$self->{itemIdx}]->{released};
                                        }
                 }
-                $self->{isEnd} = 0;
+            }
+            elsif (($tagname eq 'h3') && ($attr->{class} eq 'media-title') && 
($self->{isGame}))
+            {
+                $self->{isName} = 1;
+            }
+            elsif (($tagname eq 'div') && ($attr->{class} eq 'media-byline') 
&& ($self->{isGame}))
+            {
+                $self->{isPlatform} = 1;
+            }
+            elsif (($tagname eq 'span') && ($self->{isPlatform} eq 1))
+            {
+                $self->{isPlatform} = 2;
+            }
+            elsif (($tagname eq 'ul') && ($attr->{class} eq 'paginate'))
+            {
+                $self->{isGame} = 0;
+            }
+        }
+        elsif ($self->{parsingTips})
+        {
+            if (($tagname eq 'h2') && ($attr->{class} eq 'cheats__title'))
+            {
+                $self->{isSection} = 1;
+            }
+            elsif (($tagname eq 'th') && ($attr->{scope} eq 'row') && 
($attr->{class} eq 'cheats__code') && (($self->{section} eq 'Codes') || 
($self->{section} eq 'Unlockables')))
+            {
+                $self->{isCheat} = 1;
+            }
+            elsif (($tagname eq 'td') && ($attr->{class} eq 'cheats__effect') 
&& ($self->{section} ne ''))
+            {
+                $self->{isDesc} = 1;
+            }
+            elsif (($tagname eq 'li') && ($attr->{class} eq 
'cheats-list__item'))
+            {
+                $self->{section} = '';
+            }
+            elsif ($tagname eq 'head')
+            {
+                $self->{urlTips} = '';
+            }
+        }
+        else
+        {
+            if (($tagname eq 'a') && ($self->{isScreen}))
+            {
+               if (! $self->{curInfo}->{screenshot1})
+                {
+                       $self->{curInfo}->{screenshot1} = $attr->{href};
+                }
+                elsif (! $self->{curInfo}->{screenshot2})
+                {
+                       $self->{curInfo}->{screenshot2} = $attr->{href};
+                }
+                $self->{isScreen} = 0;
+            }
+            elsif (($tagname eq 'a') && ($attr->{href} =~ /\/cheats\//))
+            {
+                $self->{urlTips} = $attr->{href};
+            }
+            elsif (($tagname eq 'li') && ($attr->{class} eq 
'pod-images__item'))
+            {
+                $self->{isScreen} = 1;
+            }
+            elsif (($tagname eq 'img') && ($self->{isBox}))
+            {
+                $self->{curInfo}->{boxpic} = $attr->{src};
+                $self->{curInfo}->{boxpic} =~ s/_medium/_avatar/ if 
!$self->{bigPics} ;
+                $self->{isBox} = 0;
+            }
+            elsif (($tagname eq 'dt') && ($attr->{class} eq 
'pod-objectStats__title'))
+            {
+                $self->{isGame} = 1 if ! $self->{curInfo}->{name};
+            }
+            elsif (($tagname eq 'footer') && ($self->{isGame}))
+            {
+                $self->{isGame} = 0;
+                if ($self->{curInfo}->{exclusive} ne 1)
+                {
+                       $self->{curInfo}->{exclusive} = 0;
+                }
+            }
+            elsif (($tagname eq 'h3') && ($self->{isGame}))
+            {
+                $self->{isName} = 1 if ! $self->{curInfo}->{name};
+            }
+            elsif (($tagname eq 'ul') && ($attr->{class} eq 'system-list') && 
($self->{isGame}))
+            {
+                $self->{curInfo}->{exclusive} = 0;
+            }
+            elsif (($tagname eq 'li') && ($attr->{class} =~ m/system /i) && 
($self->{isGame}))
+            {
+                $self->{curInfo}->{exclusive} = $self->{curInfo}->{exclusive} 
+ 1;
+               $self->{isPlatform} = 1 if ($attr->{class} =~ 
m/$self->{curInfo}->{platform}/i);
+            }
+            elsif (($tagname eq 'div') && ($attr->{class} eq 'media-img 
imgflare--boxart') && ($self->{isGame}))
+            {
+                $self->{isBox} = 1;
+            }
+            elsif (($tagname eq 'li') && ($attr->{class} eq 
'pod-objectStats__item') && ($self->{isGame}))
+            {
+                $self->{isEditor} = 0;
+                $self->{isDeveloper} = 0;
+                $self->{isGenre} = 0;
+            }
+            elsif (($tagname eq 'dd') && ($attr->{class} eq 
'pod-objectStats__deck'))
+            {
+                $self->{isDesc} = 1;
+            }
+            elsif (($tagname eq 'div') && ($attr->{class} eq 'gs-score__cell'))
+            {
+                $self->{isRating} = 1 if ! $self->{curInfo}->{ratingpress};
+            }
+        }
+    }
+
+    sub end
+    {
+               my ($self, $tagname) = @_;
+               
+        $self->{inside}->{$tagname}--;
+    }
+
+    sub text
+    {
+        my ($self, $origtext) = @_;
+
+        if ($self->{parsingList})
+        {
+            if ($self->{isName} eq 1)
+            {
+                # 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->{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 '')
+                {
+                       $self->{itemsList}[$self->{itemIdx}]->{platform} = 
$origtext;
+                }
+                else
+                {
+                       $self->{itemsList}[$self->{itemIdx}]->{platform} .= 
','.$origtext;
+                }
+
+                $self->{isPlatform} = 1;
             }
         }
         elsif ($self->{parsingTips})
@@ -249,6 +243,7 @@
                 $self->{section} = 'Unlockables' if $origtext =~ 
/^Unlockables/i;
                 $self->{section} = 'Unlockables' if $origtext =~ 
/^Achievements/i;
                 $self->{section} = 'Unlockables' if $origtext =~ /^Trophies/i;
+                $self->{section} = 'Unlockables' if $origtext =~ /^Steam 
Achievements/i;
                 $self->{section} = 'Secrets' if $origtext =~ /^Secrets/i;
                 $self->{section} = 'Secrets' if $origtext =~ /^Easter Eggs/i;
                 
@@ -256,6 +251,7 @@
                 $self->{section} = '' if $origtext =~ /Walkthrough/i;
                 $self->{section} = '' if $origtext =~ /FAQ/i;
                 $self->{isSection} = 0;
+
             }
             elsif (($self->{section} eq 'Codes') || ($self->{section} eq 
'Unlockables'))
             {
@@ -320,6 +316,11 @@
                 $self->{curInfo}->{released} = $self->{url_release};
                 $self->{isName} = 0;
             }
+            elsif ($self->{isPlatform})
+            {
+                $self->{curInfo}->{platform} = $origtext;
+                $self->{isPlatform} = 0;
+            }
             elsif (($origtext eq 'Published By:') && ($self->{isGame}))
             {
                 $self->{isEditor} = 1;
@@ -334,6 +335,11 @@
             }
             elsif ($self->{isRating})
             {
+                # Enleve les blancs en debut de chaine
+                $origtext =~ s/^\s+//;
+                # Enleve les blancs en fin de chaine
+                $origtext =~ s/\s+$//;
+
                 $self->{curInfo}->{ratingpress} = $origtext;
                 $self->{isRating} = 0;
             }
@@ -415,7 +421,7 @@
 
         $self->{isName} = 0;
         $self->{isGame} = 0;
-        $self->{isEnd} = 0;
+        $self->{isPlatform} = 0;
         $self->{isCheat} = 0;
         $self->{isDesc} = 0;
         $self->{isTip} = 0;
@@ -428,6 +434,7 @@
         $self->{isReleased} = 0;
         $self->{isPlayers} = 0;
         $self->{isBox} = 0;
+        $self->{isScreen} = 0;
         $self->{urlTips} = "";
         $self->{url_plateforme} = '';
         $self->{url_release} = '';
@@ -445,12 +452,13 @@
                        if ( $found >= 0 )
                        {
                            $html = substr($html, $found + length('Cheats For ' 
. $self->{curInfo}->{platform}),length($html)- $found -length('Cheats For ' . 
$self->{curInfo}->{platform}) );
-                               $found = index($html,"\"cheats__header\"");
+                               $found = index($html,"\"tab-pane \"");
                                if ( $found >= 0 )
                                {
                                    $html = substr($html, 0, $found);
                                }
                        }
+                               $html =~ s|</h2>||;
 
 ## It takes too much time
 #            $html =~ s|<li class="guideAct"><a href="(.+)">Go to Online 
Walkthrough|'<tpfdebuttpf>' . $self->RecupSolution($1) . '<tpffintpf>'|ge;


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

Reply via email to