summaryrefslogtreecommitdiff
path: root/debian/patches/11-fix_gamespot_plugin.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/11-fix_gamespot_plugin.patch')
-rw-r--r--debian/patches/11-fix_gamespot_plugin.patch281
1 files changed, 281 insertions, 0 deletions
diff --git a/debian/patches/11-fix_gamespot_plugin.patch b/debian/patches/11-fix_gamespot_plugin.patch
new file mode 100644
index 0000000..a5827eb
--- /dev/null
+++ b/debian/patches/11-fix_gamespot_plugin.patch
@@ -0,0 +1,281 @@
+Description: fix GameSpot games plugin
+Origin: upstream, http://svn.gna.org/viewcvs/gcstar?view=revision&revision=2241
+
+Caution: this patch contains CRLF terminators,
+be careful when editing.
+
+Index: gcstar-1.7.0/lib/gcstar/GCPlugins/GCgames/GCGameSpot.pm
+===================================================================
+--- gcstar-1.7.0.orig/lib/gcstar/GCPlugins/GCgames/GCGameSpot.pm 2011-11-26 05:46:14.000000000 -0500
++++ gcstar-1.7.0/lib/gcstar/GCPlugins/GCgames/GCGameSpot.pm 2013-08-07 16:51:39.584461692 -0400
+@@ -2,7 +2,7 @@
+
+ ###################################################
+ #
+-# Copyright 2005-2011 Christian Jodar
++# Copyright 2005-2013 Christian Jodar
+ #
+ # This file is part of GCstar.
+ #
+@@ -40,21 +40,30 @@
+ $self->{inside}->{$tagname}++;
+ if ($self->{parsingList})
+ {
+- if ($tagname eq 'div')
++ if (($tagname eq 'div') && ($attr->{class} eq 'result_title'))
+ {
+- $self->{isGame} = 1
+- if $attr->{class} =~ /result_title/;
++ $self->{isGame} = 1;
+ }
+- elsif ($tagname eq 'tpfdatetpf')
+- {
+- $self->{isDate} = 1;
+- }
+- elsif (($tagname eq 'a') && ($self->{isGame}))
++ elsif (($tagname eq 'a') && ($self->{isGame}) && ($self->{isName} eq 0))
+ {
+ $self->{itemIdx}++;
+ $self->{itemsList}[$self->{itemIdx}]->{url} = $attr->{href};
+ $self->{isName} = 1;
+ }
++ elsif (($tagname eq 'span') && ($attr->{class} eq 'release'))
++ {
++ $self->{isDate} = 1;
++ }
++ elsif (($tagname eq 'span') && ($attr->{class} eq 'platforms'))
++ {
++ $self->{isPlatform} = 1;
++ }
++ elsif (($tagname eq 'div') && ($attr->{class} eq 'clear') && ($self->{isGame}))
++ {
++ $self->{isGame} = 0;
++ $self->{isEnd} = 1;
++ $self->{isName} = 0;
++ }
+ }
+ elsif ($self->{parsingTips})
+ {
+@@ -97,17 +106,29 @@
+ {
+ $self->{curInfo}->{boxpic} = $attr->{src};
+ }
+- if ($attr->{src} =~ /thumb/)
++ if ($attr->{src} =~ /thumb([0-9])/)
+ {
+- my $pic = $attr->{src};
+- $pic =~ s/thumb00([0-9])/screen00$1/;
+- if ($1 && ($1 <= 2))
++ if (! $self->{curInfo}->{screenshot1})
++ {
++ $self->{curInfo}->{screenshot1} = $attr->{src};
++ $self->{curInfo}->{screenshot1} =~ s|thumb|screen|;
++ }
++ elsif (! $self->{curInfo}->{screenshot2})
+ {
+- $self->{curInfo}->{'screenshot'.$1} = $pic
+- if ! $self->{curInfo}->{'screenshot'.$1};
++ $self->{curInfo}->{screenshot2} = $attr->{src};
++ $self->{curInfo}->{screenshot2} =~ s|thumb|screen|;
+ }
+ }
+ }
++ elsif ($tagname eq 'tpffiltertpf')
++ {
++ my $found = index($attr->{activefilter},"'site':'");
++ if ( $found >= 0 )
++ {
++ $self->{curInfo}->{platform} = substr($attr->{activefilter}, $found +length('\'site\':\''),length($attr->{activefilter})- $found -length('\'site\':\''));
++ $self->{curInfo}->{platform} = substr($self->{curInfo}->{platform}, 0,index($self->{curInfo}->{platform},"'"));
++ }
++ }
+ elsif (($tagname eq 'div') && ($attr->{class} eq 'boxshot'))
+ {
+ $self->{isBox} = 1;
+@@ -116,6 +137,7 @@
+ {
+ my $html = $self->loadPage($self->getItemUrl($attr->{href}), 0, 1);
+ my $found = index($html,"id=\"main_image\" src=\"");
++ my $found2 = index($html,"img=back");
+ if ( $found >= 0 )
+ {
+ $html = substr($html, $found +length('id="main_image" src="'),length($html)- $found -length('id="main_image" src="'));
+@@ -126,8 +148,11 @@
+ {
+ $self->{curInfo}->{boxpic} = $array[0];
+ }
+- $self->{curInfo}->{backpic} = $array[0];
+- $self->{curInfo}->{backpic} =~ s/_front/_back/;
++ if ( $found2 >= 0 )
++ {
++ $self->{curInfo}->{backpic} = $array[0];
++ $self->{curInfo}->{backpic} =~ s/_front/_back/;
++ }
+ }
+ $self->{isBox} = 0;
+ }
+@@ -135,11 +160,11 @@
+ {
+ $self->{isName} = 1 if ! $self->{curInfo}->{name};
+ }
+- elsif (($tagname eq 'meta') && ($attr->{name} eq 'description'))
++ elsif (($tagname eq 'meta') && ($attr->{property} eq 'og:description'))
+ {
+ $self->{curInfo}->{description} = $attr->{content};
+ }
+- elsif (($tagname eq 'li') && ($attr->{class} =~ /activeFilter/))
++ elsif (($tagname eq 'div') && ($attr->{class} eq 'availPlats'))
+ {
+ $self->{curInfo}->{exclusive} = 0;
+ }
+@@ -188,7 +213,7 @@
+ {
+ $self->{isReleased} = 1;
+ }
+- elsif (($tagname eq 'a') && ($self->{isReleased} eq 1))
++ elsif (($tagname eq 'span') && ($attr->{class} eq 'data') && ($self->{isReleased} eq 1))
+ {
+ $self->{isReleased} = 2;
+ }
+@@ -204,14 +229,6 @@
+ my ($self, $tagname) = @_;
+
+ $self->{inside}->{$tagname}--;
+- if ($self->{parsingList})
+- {
+- $self->{isGame} = 0
+- if ($tagname eq 'div');
+- }
+- elsif ($self->{parsingTips})
+- {
+- }
+ }
+
+ sub text
+@@ -220,20 +237,53 @@
+
+ if ($self->{parsingList})
+ {
+- if ($self->{isName})
++ if ($self->{isName} eq 1)
+ {
+- $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;
++ $self->{itemsList}[$self->{itemIdx}]->{name} = $origtext;
++ $self->{isName} = 2;
++ }
++ elsif ($self->{isPlatform})
++ {
++ $self->{itemsList}[$self->{itemIdx}]->{platform} = $origtext;
++ $self->{isPlatform} = 0;
+ }
+ elsif ($self->{isDate})
+ {
+- $origtext =~ /^\s*Release Date:\s*(.*?)\s*$/ms;
+- $self->{itemsList}[$self->{itemIdx}]->{released} = $1;
++ $self->{itemsList}[$self->{itemIdx}]->{released} = $origtext;
+ $self->{isDate} = 0;
+ }
++ elsif ($self->{isEnd})
++ {
++ my @array = split(/,/,$self->{itemsList}[$self->{itemIdx}]->{platform});
++ my $element;
++
++ my $SaveName = $self->{itemsList}[$self->{itemIdx}]->{name};
++ my $SaveDate = $self->{itemsList}[$self->{itemIdx}]->{released};
++ my $SaveUrl = $self->{itemsList}[$self->{itemIdx}]->{url};
++ $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+$//;
++ # Pb : pas les memes noms de console entre l'affichage et l'url du jeu
++ $element =~ s/X360/XBOX360/i;
++ $element =~ s/WIIU/WII-U/i;
++ $element =~ s/AND/android/i;
++ $element =~ s/WINM/windows-mobile/i;
++ $element =~ s/GC/gamecube/i;
++ $element =~ s/FDS/famicomds/i;
++
++ $self->{itemIdx}++;
++ $self->{itemsList}[$self->{itemIdx}]->{name} = $SaveName;
++ $self->{itemsList}[$self->{itemIdx}]->{released} = $SaveDate;
++ $self->{itemsList}[$self->{itemIdx}]->{url} = $SaveUrl . 'platform/' . $element .'/';
++ $self->{itemsList}[$self->{itemIdx}]->{platform} = $element;
++ }
++ $self->{isEnd} = 0;
++ }
+ }
+ elsif ($self->{parsingTips})
+ {
+@@ -298,7 +348,6 @@
+ {
+ $origtext =~ s/\n//g;
+ $self->{curInfo}->{name} = $origtext;
+- $self->{curInfo}->{platform} = $self->{url_plateforme};
+ $self->{curInfo}->{exclusive} = 1;
+ $self->{isName} = 0;
+ }
+@@ -360,6 +409,8 @@
+ $self->{isName} = 0;
+ $self->{isGame} = 0;
+ $self->{isDate} = 0;
++ $self->{isPlatform} = 0;
++ $self->{isEnd} = 0;
+ $self->{isCheat} = 0;
+ $self->{isDesc} = 0;
+ $self->{isTip} = 0;
+@@ -372,10 +423,7 @@
+ $self->{isReleased} = 0;
+ $self->{isPlayers} = 0;
+ $self->{isBox} = 0;
+- $self->{isExclu} = 0;
+- $self->{url_plateforme} = '';
+ $self->{urlTips} = "";
+- $self->{SaveUrl} = "";
+
+ return $self;
+ }
+@@ -393,11 +441,12 @@
+ }
+ elsif ($self->{parsingList})
+ {
+- $html =~ s|Release Date|<tpfdatetpf>Release Date|g;
+ }
+ else
+ {
+- my $found = index($html,"Similar Games");
++ $html =~ s|Filter activeFilter|"><tpffiltertpf activefilter="|i;
++
++ my $found = index($html,">Games You May Like<");
+ if ( $found >= 0 )
+ {
+ $html = substr($html, 0, $found);
+@@ -440,19 +489,14 @@
+ my ($self, $word) = @_;
+
+ #return 'http://www.gamespot.com/search.html?qs='.$word.'&sub=g&stype=11&type=11';
+- return 'http://www.gamespot.com/pages/search/solr_search_ajax.php?q='.$word.'&type=game&offset=0&tags_only=false&sort=false';
++ #return 'http://www.gamespot.com/pages/search/solr_search_ajax.php?q='.$word.'&type=game&offset=0&tags_only=false&sort=false';
++ return 'http://www.gamespot.com/search/?qs='.$word.'&filter=summary';
+ #return 'http://www.gamespot.com/search.html?qs=' .$word. '&tag=masthead%3Bsearch';
+ }
+
+ 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);
+- }
+
+ return 'http://www.gamespot.com' . $url
+ if $url !~ /gamespot\.com/;