summaryrefslogtreecommitdiff
path: root/lib/VNDB
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VNDB')
-rw-r--r--lib/VNDB/ExtLinks.pm21
-rw-r--r--lib/VNDB/Func.pm54
-rw-r--r--lib/VNDB/Schema.pm1
3 files changed, 14 insertions, 62 deletions
diff --git a/lib/VNDB/ExtLinks.pm b/lib/VNDB/ExtLinks.pm
index ddc1cf5d..2c7b8497 100644
--- a/lib/VNDB/ExtLinks.pm
+++ b/lib/VNDB/ExtLinks.pm
@@ -40,7 +40,7 @@ our %WIKIDATA = (
crunchyroll => { type => 'text[]', property => 'P4110', label => undef, fmt => undef },
igdb_game => { type => 'text[]', property => 'P5794', label => 'IGDB', fmt => 'https://www.igdb.com/games/%s' },
giantbomb => { type => 'text[]', property => 'P5247', label => undef, fmt => undef },
- pcgamingwiki => { type => 'text[]', property => 'P6337', label => undef, fmt => undef },
+ pcgamingwiki => { type => 'text[]', property => 'P6337', label => 'PCGamingWiki', fmt => 'https://www.pcgamingwiki.com/wiki/%s' },
steam => { type => 'integer[]', property => 'P1733', label => undef, fmt => undef },
gog => { type => 'text[]', property => 'P2725', label => 'GOG', fmt => 'https://www.gog.com/game/%s' },
pixiv_user => { type => 'integer[]', property => 'P5435', label => 'Pixiv', fmt => 'https://www.pixiv.net/member.php?id=%d' },
@@ -48,7 +48,6 @@ our %WIKIDATA = (
soundcloud => { type => 'text[]', property => 'P3040', label => 'Soundcloud', fmt => 'https://soundcloud.com/%s' },
humblestore => { type => 'text[]', property => 'P4477', label => undef, fmt => undef },
itchio => { type => 'text[]', property => 'P7294', label => undef, fmt => undef },
-
);
@@ -89,11 +88,6 @@ our %LINKS = (
, fmt2 => sub { config->{dlsite_url} && sprintf config->{dlsite_url}, shift->{l_dlsite_shop}||'home' }
, regex => qr{(?:www\.)?dlsite\.com/.*/(?:dlaf/=/link/work/aid/.*/id|work/=/product_id)/([VR]J[0-9]{6}).*}
, patt => 'https://www.dlsite.com/<store>/work/=/product_id/<VJ or RJ-code>' },
- l_dlsiteen => { label => 'DLsite (eng)'
- , fmt => 'https://www.dlsite.com/eng/work/=/product_id/%s.html'
- , fmt2 => sub { config->{dlsite_url} && sprintf config->{dlsite_url}, shift->{l_dlsiteen_shop}||'eng' }
- , regex => qr{(?:www\.)?dlsite\.com/.*/(?:dlaf/=/link/work/aid/.*/id|work/=/product_id)/([VR]E[0-9]{6}).*}
- , patt => 'https://www.dlsite.com/<store>/work/=/product_id/<VE or RE-code>' },
l_gog => { label => 'GOG'
, fmt => 'https://www.gog.com/game/%s'
, regex => qr{(?:www\.)?gog\.com/game/([a-z0-9_]+).*} },
@@ -110,8 +104,9 @@ our %LINKS = (
, fmt2 => sub { config->{ shift->{l_jlist_jbox} ? 'jbox_url' : 'jlist_url' } }
, regex => qr{(?:www\.)?(?:jlist|jbox)\.com/(?:.+/)?([a-z0-9-]*[0-9][a-z0-9-]*)} },
l_jastusa => { label => 'JAST USA'
- , fmt => 'https://jastusa.com/games/%s'
- , regex => qr{(?:www\.)?jastusa\.com/games/([a-z0-9_-]+)} },
+ , fmt => 'https://jastusa.com/games/%s/vndb'
+ , regex => qr{(?:www\.)?jastusa\.com/games/([a-z0-9_-]+)/[^/]+}
+ , patt => 'https://jastusa.com/games/<code>/<title>' },
l_fakku => { label => 'Fakku'
, fmt => 'https://www.fakku.net/games/%s'
, regex => qr{(?:www\.)?fakku\.(?:net|com)/games/([^/]+)(?:[/\?].*)?} },
@@ -127,6 +122,10 @@ our %LINKS = (
l_freem => { label => 'Freem!'
, fmt => 'https://www.freem.ne.jp/win/game/%d'
, regex => qr{(?:www\.)?freem\.ne\.jp/win/game/([0-9]+)} },
+ l_freegame => { label => 'Freegame Mugen'
+ , fmt => 'https://freegame-mugen.jp/%s.html'
+ , regex => qr{(?:www\.)?freegame-mugen\.jp/([^/]+/game_[0-9]+)\.html}
+ , patt => 'https://freegame-mugen.jp/<genre>/game_<id>.html' },
l_novelgam => { label => 'NovelGame'
, fmt => 'https://novelgame.jp/games/show/%d'
, regex => qr{(?:www\.)?novelgame\.jp/games/show/([0-9]+)} },
@@ -168,6 +167,8 @@ our %LINKS = (
l_nutaku => { label => 'Nutaku'
, fmt => 'https://www.nutaku.net/games/%s/'
, regex => qr{(?:www\.)?nutaku\.net/games/(?:mobile/|download/|app/)?([a-z0-9-]+)/?} }, # The section part does sometimes link to different pages, but it's the same game and the non-section link always works.
+ # deprecated
+ l_dlsiteen => { label => 'DLsite (eng)', fmt => 'https://www.dlsite.com/eng/work/=/product_id/%s.html' },
},
s => {
l_site => { label => 'Official website', fmt => '%s' },
@@ -264,6 +265,7 @@ sub enrich_extlinks {
w 'indiedb_game';
w 'howlongtobeat';
w 'igdb_game';
+ w 'pcgamingwiki';
l 'l_renai';
push @links, [ 'VNStat', sprintf('https://vnstat.net/novel/%d', $obj->{id} =~ s/^.//r), undef ] if $obj->{c_votecount}>=20;
}
@@ -286,6 +288,7 @@ sub enrich_extlinks {
l 'l_googplay';
l 'l_animateg';
l 'l_freem';
+ l 'l_freegame';
l 'l_novelgam';
l 'l_gyutto';
l 'l_digiket';
diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm
index 68b76f36..d5692a38 100644
--- a/lib/VNDB/Func.pm
+++ b/lib/VNDB/Func.pm
@@ -5,8 +5,6 @@ use warnings;
use TUWF::Misc 'uri_escape';
use Exporter 'import';
use POSIX 'strftime';
-use Encode 'encode_utf8';
-use Unicode::Normalize 'NFKD', 'compose';
use Socket 'inet_pton', 'inet_ntop', 'AF_INET', 'AF_INET6';
use VNDB::Config;
use VNDB::Types;
@@ -17,7 +15,6 @@ our @EXPORT = ('bb_format', qw|
shorten
resolution
gtintype
- normalize_titles normalize_query
imgsize
norm_ip
minage
@@ -93,55 +90,6 @@ sub gtintype {
}
-# a rather aggressive normalization
-sub normalize {
- local $_ = lc shift;
- use utf8;
- # Remove combining markings, except for kana.
- # This effectively removes all accents from the characters (e.g. é -> e)
- $_ = compose(NFKD($_) =~ s/(?<=[^ア-ンあ-ん])\pM//rg);
- # remove some characters that have no significance when searching
- tr/\r\n\t,_\-.~~〜∼ー῀:[]()%+!?#$"'`♥★☆♪†「」『』【】・‟“”‛’‘‚„«‹»›//d;
- tr/@/a/;
- tr/ı/i/; # Turkish lowercase i
- tr/×/x/;
- s/&/and/;
- # Remove spaces. We're doing substring search, so let it cross word boundary to find more stuff
- tr/ //d;
- # remove commonly used release titles ("x Edition" and "x Version")
- # this saves some space and speeds up the search
- s/(?:
- first|firstpress|firstpresslimited|limited|regular|standard
- |package|boxed|download|complete|popular
- |lowprice|best|cheap|budget
- |special|trial|allages|fullvoice
- |cd|cdr|cdrom|dvdrom|dvd|dvdpack|dvdpg|windows
- |初回限定|初回|限定|通常|廉価|パッケージ|ダウンロード
- )(?:edition|version|版|生産)//xg;
- # other common things
- s/fandisk/fandisc/g;
- s/sempai/senpai/g;
- no utf8;
- return $_;
-}
-
-
-# normalizes each title and returns a concatenated string of unique titles
-sub normalize_titles {
- my %t = map +(normalize($_), 1), @_;
- return join ' ', grep length $_, sort keys %t;
-}
-
-
-sub normalize_query {
- my $q = shift;
- # remove spaces within quotes, so that it's considered as one search word
- $q =~ s/"([^"]+)"/(my $s=$1)=~y{ }{}d;$s/ge;
- # split into search words and normalize
- return map quotemeta($_), grep length $_, map normalize($_), split / /, $q;
-}
-
-
# arguments: <image size>, <max dimensions>
# returns the size of the thumbnail with the same aspect ratio as the full-size
# image, but fits within the specified maximum dimensions
@@ -155,7 +103,7 @@ sub imgsize {
$ow *= $sh/$oh;
$oh = $sh;
}
- return (int $ow, int $oh);
+ return (int ($ow+0.5), int ($oh+0.5));
}
diff --git a/lib/VNDB/Schema.pm b/lib/VNDB/Schema.pm
index 63c0f258..654a08b9 100644
--- a/lib/VNDB/Schema.pm
+++ b/lib/VNDB/Schema.pm
@@ -37,6 +37,7 @@ sub schema {
next if /^\s*--/ || /^\s*$/;
next if /^\s*CREATE\s+TYPE/;
next if /^\s*CREATE\s+SEQUENCE/;
+ next if /^\s*CREATE\s+FUNCTION/;
if(/^\s*CREATE\s+TABLE\s+([^ ]+)/) {
die "Unexpected 'CREATE TABLE $1'\n" if $table;