Author: tian
Date: Mon Feb 29 22:02:35 2016
New Revision: 2261
URL: http://svn.gna.org/viewcvs/gcstar?rev=2261&view=rev
Log:
Patch from Anarky with many fixes:
- Remove trailing white spaces on release date
- Fix Mega-CD platform skipped during searching
- Display full platform name in the search results and game record
- Fix ampersand in video games' name
- Fix no multi-platform games ending with / It was impossible to add Rez
Infinite, The Last of Us 2, Jetpack Fighter...
- Remove unnecessary slash inside urls
- Fix the tips matching with the platform name
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=2261&r1=2260&r2=2261&view=diff
==============================================================================
--- trunk/gcstar/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoCom.pm (original)
+++ trunk/gcstar/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoCom.pm Mon Feb 29
22:02:35 2016
@@ -48,6 +48,41 @@
}
return $res;
}
+
+ sub getPlatformName
+ {
+ my ($self, $platform) = @_;
+ $platform =~ s/^360$/Xbox 360/;
+ $platform =~ s/^32X$/Mega Drive 32X/;
+ $platform =~ s/^3DS$/Nintendo 3DS/;
+ $platform =~ s/^C64$/Commodore 64/;
+ $platform =~ s/^CPC$/Amstrad CPC/;
+ $platform =~ s/^DCAST$/Dreamcast/;
+ $platform =~ s/^DS$/Nintendo DS/;
+ $platform =~ s/^G.GEAR$/Game Gear/;
+ $platform =~ s/^GB$/Game Boy/;
+ $platform =~ s/^GBA$/Game Boy Advance/;
+ $platform =~ s/^Giz$/Gizmondo/;
+ $platform =~ s/^MD$/Mega Drive/;
+ $platform =~ s/^MS$/Master System/;
+ $platform =~ s/^N64$/Nintendo 64/;
+ $platform =~ s/^NEO$/Neo Geo/;
+ $platform =~ s/^New 3DS$/New Nintendo 3DS/;
+ $platform =~ s/^NGAGE$/N-Gage/;
+ $platform =~ s/^NGC$/Gamecube/;
+ $platform =~ s/^ONE$/Xbox One/;
+ $platform =~ s/^PC ENG$/PC Engine/;
+ $platform =~ s/^PS1$/PlayStation/;
+ $platform =~ s/^PS2$/PlayStation 2/;
+ $platform =~ s/^PS3$/PlayStation 3/;
+ $platform =~ s/^PS4$/PlayStation 4/;
+ $platform =~ s/^SNES$/Super Nintendo/;
+ $platform =~ s/^ST$/Atari ST/;
+ $platform =~ s/^V.BOY$/Virtual Boy/;
+ $platform =~ s/^Vita$/PS Vita/;
+ $platform =~ s/^WiiU$/Wii U/;
+ return $platform;
+ }
sub loadMultipleResults
{
@@ -59,19 +94,30 @@
$page =~ /<h1\s+class="highlight">(.*?)<\/h1>/i;
my $name = $1;
$name =~ s/'/'/g;
+ $name =~ s/&/&/g;
my @lines = split /\n/, $tabs;
foreach my $line (@lines)
{
- if ($line =~ /href="([^"]*)".*?>([0-9a-zA-Z_. ]*)<\/a>/)
+ if ($line =~ /href="([^"]*)".*?>([0-9a-zA-Z_. -]*)<\/a>/)
{
my $url = $1;
- my $platform = $2;
+ my $platform = $self->getPlatformName($2);
$self->{itemIdx}++;
- $self->{itemsList}[$self->{itemIdx}]->{url} =
'http://www.jeuxvideo.com/'.$url;
+ $self->{itemsList}[$self->{itemIdx}]->{url} =
'http://www.jeuxvideo.com'.$url;
$self->{itemsList}[$self->{itemIdx}]->{name} = $name;
$self->{itemsList}[$self->{itemIdx}]->{platform} = $platform;
$self->{itemsList}[$self->{itemIdx}]->{released} = $released;
}
+ elsif ($line =~ /<span class="label-support active-mach-version
label-.*" itemprop="device" content=".*">([0-9a-zA-Z_. -]*)<\/span>/)
+ {
+ # for some reason, it ends with a / but it's not a
multi-platform game
+ $self->{itemIdx}++;
+ $name =~ s/ sur $1$//e;
+ $self->{itemsList}[$self->{itemIdx}]->{url} = $url;
+ $self->{itemsList}[$self->{itemIdx}]->{name} = $name;
+ $self->{itemsList}[$self->{itemIdx}]->{platform} =
$self->getPlatformName($1);
+ $self->{itemsList}[$self->{itemIdx}]->{released} = $released;
+ }
}
}
@@ -242,9 +288,9 @@
{
if ($self->{itemsList}[$self->{itemIdx}]->{platform} eq "" )
{
- # Enleve le " - " présent en début de chaîne
+ # Enleve le " - " présent en début de chaîne
$origtext =~ s/- //;
- $self->{itemsList}[$self->{itemIdx}]->{platform} =
$origtext;
+ $self->{itemsList}[$self->{itemIdx}]->{platform} =
$self->getPlatformName($origtext);
}
$self->{isPlatform} = 0;
}
@@ -267,17 +313,11 @@
# There are problems with some texts if ended blanks are removed
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;
+ $origtext =~ s|Gameboy|Game Boy|gi;
+ $origtext =~ s|Megadrive|Mega Drive|gi;
+ $origtext =~ s|PlayStation Portable|PSP|gi;
+ $origtext =~ s|PlayStation Vita|PS Vita|gi;
+
if (($origtext =~ /$self->{curInfo}->{platform}/i) ||
($origtext =~ /astuce/i) || ($origtext =~ /renseignement/i) || ($origtext =~
/campagne/i))
{
$self->{isTip} = 2;
@@ -317,6 +357,8 @@
}
$self->{curInfo}->{$self->{is}} =~ s/Non/1/i if $self->{is} eq
'players';
$self->{curInfo}->{$self->{is}} =
int($self->{curInfo}->{$self->{is}} / 2) if $self->{is} eq 'ratingpress';
+ $self->{curInfo}->{$self->{is}} =~ s/\s+$// if $self->{is} eq
'released';
+ $self->{curInfo}->{$self->{is}} =
$self->getPlatformName($self->{curInfo}->{$self->{is}}) if $self->{is} eq
'platform';
$self->{is} = '';
}
else
@@ -391,7 +433,7 @@
}
elsif ($self->{parsingTips})
{
- $html =~ s|<a data-jvcode="HTMLBLOCK"
href="(.+)">|$self->RecupTips("http://www.jeuxvideo.com/" . $1)|ge;
+ $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|Partager sur :||gi;
$html =~ s|<img src="//www.jeuxvideo.com/img/keys/(.+?).gif"
alt="(.+?)" />|$2|gi;
_______________________________________________
GCstar-commits mailing list
[email protected]
https://mail.gna.org/listinfo/gcstar-commits