summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/docs/25
-rw-r--r--data/tpl/vnedit2
-rw-r--r--data/tpl/vnpage4
-rw-r--r--lib/ChangeLog1
-rw-r--r--lib/VNDB/Util/Tools.pm19
5 files changed, 16 insertions, 15 deletions
diff --git a/data/docs/2 b/data/docs/2
index da71b403..35fbc5e2 100644
--- a/data/docs/2
+++ b/data/docs/2
@@ -27,8 +27,9 @@
and instead compare it with other games you've played. It's all relative, after all.
</dd><dt>External links</dt><dd>
Links to external resources about this visual novel. To get the URLs, go to the
- sites (<a href="http://en.wikipedia.org/">Wikipedia</a> and <a href="http://visual-novels.net/">
- Visual-novels.net</a>),
+ sites (<a href="http://en.wikipedia.org/">Wikipedia</a>, <a href="http://novelnews.net/">
+ Novelnews.net</a>, <a href="http://renai.us/">Renai.us</a> and
+ <a href="http://visual-novels.net/">Visual-novels.net</a>),
search for a page about the game, and determine the ID or name of that page to fill
out in the text boxes. Do not specify the full URL, we only need a small part of
it!
diff --git a/data/tpl/vnedit b/data/tpl/vnedit
index 0b5299e8..d99a915b 100644
--- a/data/tpl/vnedit
+++ b/data/tpl/vnedit
@@ -45,7 +45,7 @@
{ type => 'static', text => '<br />' },
{ type => 'input', name => 'External links', short => 'l_wp', pre => 'http://en.wikipedia.org/wiki/' },
{ type => 'input', name => '&nbsp;', short => 'l_encubed', pre => 'http://novelnews.net/tag/', post => '/' },
- { type => 'input', name => '&nbsp;', short => 'l_renai', pre => 'http://www.renai.us/game/', post => '.shtml' },
+ { type => 'input', name => '&nbsp;', short => 'l_renai', pre => 'http://renai.us/game/', post => '.shtml' },
{ type => 'input', name => '&nbsp;', short => 'l_vnn', pre => 'http://visual-novels.net/vn/index.php?option=com_content&amp;task=view&amp;id=', class => 'shortopts' },
{ type => 'static', text => '<br />' },
diff --git a/data/tpl/vnpage b/data/tpl/vnpage
index e8b19dde..9418afc2 100644
--- a/data/tpl/vnpage
+++ b/data/tpl/vnpage
@@ -19,7 +19,7 @@
[ length => 'Length', sub { $VNDB::VNLEN->[$_[0] ][0] } ],
[ l_wp => 'Wikipedia link', sub { $_[0] ? '<a href="http://en.wikipedia.org/wiki/'.$_[0].'">'.$_[0].'</a>' : 'No link' } ],
[ l_encubed => 'Encubed tag', sub { $_[0] ? '<a href="http://novelnews.net/tag/'._huri($_[0]).'/">'.$_[0].'</a>' : 'No link' } ],
- [ l_renai => 'Renai.us link', sub { $_[0] ? '<a href="http://www.renai.us/game/'._huri($_[0]).'.shtml">'.$_[0].'</a>' : 'No link' } ],
+ [ l_renai => 'Renai.us link', sub { $_[0] ? '<a href="http://renai.us/game/'._huri($_[0]).'.shtml">'.$_[0].'</a>' : 'No link' } ],
[ l_vnn => 'V-N.net link', sub { $_[0] ? '<a href="http://visual-novels.net/vn/index.php?option=com_content&amp;task=view&amp;id='.$_[0].'">'.$_[0].'</a>' : 'No link' } ],
[ anime => 'Related anime', sub { join(' ', map qq|<a href="http://anidb.net/a$$_{id}">$$_{id}</a>|, sort { $a->{id} <=> $b->{id} } @{$_[0]}) } ],
[ categories => 'Categories', sub { join(' ', map { $VNDB::CAT->{substr($_->[0],0,1)}[1]{substr($_->[0],1,2)}.'('.$_->[1].')' } sort { $a->[0] cmp $b->[0] } @{$_[0]}) || 'No categories selected' }, 1 ],
@@ -70,7 +70,7 @@
my @links = (
$d{vn}{l_wp} ? [ 'Wikipedia', 'http://en.wikipedia.org/wiki/%s', $d{vn}{l_wp} ] : (),
$d{vn}{l_encubed} ? [ 'Encubed', 'http://novelnews.net/tag/%s/', _huri $d{vn}{l_encubed} ] : (),
- $d{vn}{l_renai} ? [ 'Renai.us', 'http://www.renai.us/game/%s.shtml', _huri $d{vn}{l_renai} ] : (),
+ $d{vn}{l_renai} ? [ 'Renai.us', 'http://renai.us/game/%s.shtml', _huri $d{vn}{l_renai} ] : (),
$d{vn}{l_vnn} ? [ 'V-N.net', 'http://visual-novels.net/vn/index.php?option=com_content&amp;task=view&amp;id=%d', $d{vn}{l_vnn} ] : (),
);
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 263e3f1c..ce648155 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -19,6 +19,7 @@ TODO:
- Dynamic loading, several bugfixes, and code cleanup for Multi
- Added 'School Life' category
- Added GTIN field to releases
+ - Added links to encubed and renai.us
1.16 - 2008-05-22
- Release dates in the current year or month without a specified day will
diff --git a/lib/VNDB/Util/Tools.pm b/lib/VNDB/Util/Tools.pm
index e537d5a2..44e3f588 100644
--- a/lib/VNDB/Util/Tools.pm
+++ b/lib/VNDB/Util/Tools.pm
@@ -71,25 +71,24 @@ sub AddHid {
sub GTINType { # returns 'JAN', 'EAN', 'UPC' or undef
- my $c = $_[0];
- return undef if $c !~ /^[0-9]{12,14}$/; # only GTIN-12, 13 and 14 codes (for now...)
- $c = ('0'x(14-length $c)) . $c; # pad with zeros
+ (my $c = $_[0]) =~ s/^0+//;
+ return undef if $c !~ /^[0-9]{12,13}$/; # only gtin-12 and 13
+ $c = ('0'x(13-length $c)) . $c; # pad with zeros
# calculate check digit according to
# http://www.gs1.org/productssolutions/barcodes/support/check_digit_calculator.html#how
my @n = reverse split //, $c;
- my $n=0;
- $n += $n[$_] * ($_ % 2 == 0 ? 1 : 3) for (1..$#n);
- $n = 10 - ($n % 10);
- return undef if $n != $n[0];
+ my $n = shift @n;
+ $n += $n[$_] * ($_ % 2 != 0 ? 1 : 3) for (0..$#n);
+ return undef if $n % 10 != 0;
# Do some rough guesses based on:
# http://www.gs1.org/productssolutions/barcodes/support/prefix_list.html
# and http://en.wikipedia.org/wiki/List_of_GS1_country_codes
local $_ = $c;
- return 'JAN' if /^04[59]/; # prefix code 450-459 & 490-499
- return 'UPC' if /^0(?:0[01]|0[6-9]|13|75[45])/; # prefix code 000-019 & 060-139 & 754-755
- return undef if /0(?:0[2-5]|2|97[789]|9[6-9])/; # some codes we don't want: 020–059 & 200-299 & 977-999
+ return 'JAN' if /^4[59]/; # prefix code 450-459 & 490-499
+ return 'UPC' if /^(?:0[01]|0[6-9]|13|75[45])/; # prefix code 000-019 & 060-139 & 754-755
+ return undef if /(?:0[2-5]|2|97[789]|9[6-9])/; # some codes we don't want: 020–059 & 200-299 & 977-999
return 'EAN'; # let's just call everything else EAN :)
}