diff options
author | Yorhel <git@yorhel.nl> | 2020-12-16 11:29:12 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2020-12-16 11:29:28 +0100 |
commit | 590dc058575065967194f54e725fdda55f7ab13c (patch) | |
tree | 1b7b3337d4a023d705bbd51740d9bebff0fb87ab | |
parent | e0ca7c028500b984b0f08dea96a081bc147cf9e1 (diff) |
ExtLinks/cleanup: Remove dependency on duplicated urls in VNDB::Config
The duplication has tripped me up before, in
f3420b701aa033c90678216bd36d374c10e3ac9f
-rw-r--r-- | lib/VNDB/Config.pm | 7 | ||||
-rw-r--r-- | lib/VNDB/ExtLinks.pm | 6 |
2 files changed, 3 insertions, 10 deletions
diff --git a/lib/VNDB/Config.pm b/lib/VNDB/Config.pm index 12c01509..c6be4ceb 100644 --- a/lib/VNDB/Config.pm +++ b/lib/VNDB/Config.pm @@ -29,13 +29,6 @@ my $config = { graphviz_path => '/usr/bin/dot', trace_log => 0, - dlsite_url => 'https://www.dlsite.com/%s/work/=/product_id/%%s.html', - denpa_url => 'https://denpasoft.com/product/%s/', - jlist_url => 'https://www.jlist.com/%s', - jbox_url => 'https://www.jbox.com/%s', - mg_r18_url => 'https://www.mangagamer.com/r18/detail.php?product_code=%d', - mg_main_url => 'https://www.mangagamer.com/detail.php?product_code=%d', - Multi => { Core => {}, Maintenance => {}, diff --git a/lib/VNDB/ExtLinks.pm b/lib/VNDB/ExtLinks.pm index fcfa2f56..f361f5c4 100644 --- a/lib/VNDB/ExtLinks.pm +++ b/lib/VNDB/ExtLinks.pm @@ -81,12 +81,12 @@ our %LINKS = ( , regex => qr{(?:www\.)?(?:store\.steampowered\.com/app/([0-9]+)(?:/.*)?|steamcommunity\.com/(?:app|games)/([0-9]+)(?:/.*)?|steamdb\.info/app/([0-9]+)(?:/.*)?)} }, l_dlsite => { label => 'DLsite (jpn)' , fmt => 'https://www.dlsite.com/home/work/=/product_id/%s.html' - , fmt2 => sub { sprintf config->{dlsite_url}, shift->{l_dlsite_shop}||'home' } + , 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 { sprintf config->{dlsite_url}, shift->{l_dlsiteen_shop}||'eng' } + , 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' @@ -241,7 +241,7 @@ sub enrich_extlinks { my sub l { my($f, $price) = @_; my($v, $fmt, $fmt2, $label) = ($obj->{$f}, $l->{$f} ? @{$l->{$f}}{'fmt', 'fmt2', 'label'} : ()); - push @links, map [ $label, sprintf(ref $fmt2 ? $fmt2->($obj) : $fmt2 || $fmt, $_), $price ], ref $v ? @$v : $v ? $v : () + push @links, map [ $label, sprintf((ref $fmt2 ? $fmt2->($obj) : $fmt2) || $fmt, $_), $price ], ref $v ? @$v : $v ? $v : () } l 'l_site'; |