summaryrefslogtreecommitdiff
path: root/lib/VNDB
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-06-15 19:00:39 +0200
committerYorhel <git@yorhel.nl>2020-06-15 19:00:41 +0200
commit7f02fd77fd71022712407c78816cc41e75b2fbc0 (patch)
tree4cfe76fad2d9daedf3dbd530e1aebbfc88d53e05 /lib/VNDB
parent1febd87dd16439203ee0de1f1adc6e9be75860e9 (diff)
Releases: Allow custom resolutions to be entered
The resolution field now works much like the engine field.
Diffstat (limited to 'lib/VNDB')
-rw-r--r--lib/VNDB/DB/Releases.pm10
-rw-r--r--lib/VNDB/Handler/VNPage.pm6
-rw-r--r--lib/VNDB/Types.pm23
-rw-r--r--lib/VNDB/Util/Misc.pm9
4 files changed, 8 insertions, 40 deletions
diff --git a/lib/VNDB/DB/Releases.pm b/lib/VNDB/DB/Releases.pm
index d17bfd00..2bfe8032 100644
--- a/lib/VNDB/DB/Releases.pm
+++ b/lib/VNDB/DB/Releases.pm
@@ -24,7 +24,9 @@ sub dbReleaseFilters {
defined $o{date_after} ? ( 'r.released >= ?' => $o{date_after} ) : (),
defined $o{minage} ? ( 'r.minage IN(!l)' => [ ref $o{minage} ? $o{minage} : [$o{minage}] ] ) : (),
defined $o{doujin} ? ( 'NOT r.patch AND r.doujin = ?' => $o{doujin} == 1 ? 1 : 0) : (),
- defined $o{resolution} ? ( 'NOT r.patch AND r.resolution IN(!l)' => [ ref $o{resolution} ? $o{resolution} : [$o{resolution}] ] ) : (),
+ defined $o{resolution} ? ( 'NOT r.patch AND ARRAY[r.reso_x, r.reso_y] IN(!l)' =>
+ [[ map $_ eq 'unknown' ? '{0,0}' : $_ eq 'nonstandard' ? '{0,1}' : '{'.(s/x/,/r).'}',
+ ref $o{resolution} ? $o{resolution}->@* : $o{resolution} ]] ) : (),
defined $o{voiced} ? ( 'NOT r.patch AND r.voiced IN(!l)' => [ ref $o{voiced} ? $o{voiced} : [$o{voiced}] ] ) : (),
defined $o{ani_story} ? ( 'NOT r.patch AND r.ani_story IN(!l)' => [ ref $o{ani_story} ? $o{ani_story} : [$o{ani_story}] ] ) : (),
defined $o{ani_ero} ? ( 'NOT r.patch AND r.ani_ero IN(!l)' => [ ref $o{ani_ero} ? $o{ani_ero} : [$o{ani_ero}] ] ) : (),
@@ -87,7 +89,7 @@ sub dbReleaseGet {
my @select = (
qw|r.id r.title r.original r.website r.released r.minage r.type r.patch|,
$o{what} =~ /extended/ ? qw|
- r.notes r.catalog r.gtin r.resolution r.voiced r.freeware r.doujin r.uncensored r.ani_story r.ani_ero r.engine r.hidden r.locked
+ r.notes r.catalog r.gtin r.reso_x r.reso_y r.voiced r.freeware r.doujin r.uncensored r.ani_story r.ani_ero r.engine r.hidden r.locked
| : (),
$o{pid} ? ('rp.developer', 'rp.publisher') : (),
$o{what} =~ /links/ ? qw|
@@ -99,7 +101,7 @@ sub dbReleaseGet {
title => 'r.title %s, r.released %1$s',
type => 'r.patch %s, r.type %1$s, r.released %1$s, r.title %1$s',
publication => 'r.doujin %s, r.freeware %1$s, r.patch %1$s, r.released %1$s, r.title %1$s',
- resolution => 'r.resolution %s, r.patch %2$s, r.released %1$s, r.title %1$s',
+ resolution => 'r.reso_x %s, r.reso_y %1$s, r.patch %2$s, r.released %1$s, r.title %1$s',
voiced => 'r.voiced %s, r.patch %2$s, r.released %1$s, r.title %1$s',
ani_ero => 'r.ani_story %s, r.ani_ero %1$s, r.patch %2$s, r.released %1$s, r.title %1$s',
released => 'r.released %s, r.id %1$s',
@@ -129,7 +131,7 @@ sub dbReleaseGetRev {
$o{rev} ||= $self->dbRow('SELECT MAX(rev) AS rev FROM changes WHERE type = \'r\' AND itemid = ?', $o{id})->{rev};
my $select = 'c.itemid AS id, r.title, r.original, r.website, r.released, r.minage, r.type, r.patch';
- $select .= ', r.notes, r.catalog, r.gtin, r.resolution, r.voiced, r.freeware, r.doujin, r.uncensored, r.ani_story, r.ani_ero, r.engine, ro.hidden, ro.locked' if $o{what} =~ /extended/;
+ $select .= ', r.notes, r.catalog, r.gtin, r.reso_x, r.reso_y, r.voiced, r.freeware, r.doujin, r.uncensored, r.ani_story, r.ani_ero, r.engine, ro.hidden, ro.locked' if $o{what} =~ /extended/;
$select .= ', extract(\'epoch\' from c.added) as added, c.comments, c.rev, c.ihid, c.ilock, '.VNWeb::DB::sql_user();
$select .= ', c.id AS cid, NOT EXISTS(SELECT 1 FROM changes c2 WHERE c2.type = c.type AND c2.itemid = c.itemid AND c2.rev = c.rev+1) AS lastrev';
$select .= ', r.gtin, r.l_steam, r.l_gog, r.l_gyutto, r.l_digiket, r.l_melon, r.l_getchu, r.l_getchudl, r.l_dmm, r.l_itch, r.l_jastusa, r.l_egs, r.l_erotrail, r.l_mg, r.l_denpa, r.l_jlist, r.l_dlsite, r.l_dlsiteen, r.l_melonjp, r.l_toranoana, r.l_gamejolt, r.l_nutaku' if $o{what} =~ /links/;
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index cc0c7da4..1e11aa7b 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -98,10 +98,8 @@ my @rel_cols = (
na_for_patch => 1,
default => 1,
what => 'extended',
- has_data => sub { $_[0]{resolution} ne 'unknown' },
- draw => sub {
- txt $_[0]{resolution} eq 'unknown' ? 'Unknown' : $RESOLUTION{$_[0]{resolution}}{txt};
- },
+ has_data => sub { !!$_[0]{reso_y} },
+ draw => sub { txt resolution($_[0]) || 'Unknown' },
}, { # Voiced
id => 'voi',
sort_field => 'voiced',
diff --git a/lib/VNDB/Types.pm b/lib/VNDB/Types.pm
index 573562a2..1f8e5867 100644
--- a/lib/VNDB/Types.pm
+++ b/lib/VNDB/Types.pm
@@ -237,29 +237,6 @@ hash MEDIUM =>
-# SQL: ENUM resolution
-hash RESOLUTION =>
- unknown => { txt => 'Unknown / console / handheld', cat => '' }, # hardcoded in many places
- nonstandard => { txt => 'Non-standard', cat => '' }, # hardcoded in VNPage.pm
- '640x480' => { txt => '640x480', cat => '4:3' },
- '800x600' => { txt => '800x600', cat => '4:3' },
- '1024x768' => { txt => '1024x768', cat => '4:3' },
- '1280x960' => { txt => '1280x960', cat => '4:3' },
- '1600x1200' => { txt => '1600x1200', cat => '4:3' },
- '640x400' => { txt => '640x400', cat => 'widescreen' },
- '960x600' => { txt => '960x600', cat => 'widescreen' },
- '960x640' => { txt => '960x640', cat => 'widescreen' },
- '1024x576' => { txt => '1024x576', cat => 'widescreen' },
- '1024x600' => { txt => '1024x600', cat => 'widescreen' },
- '1024x640' => { txt => '1024x640', cat => 'widescreen' },
- '1280x720' => { txt => '1280x720', cat => 'widescreen' },
- '1280x800' => { txt => '1280x800', cat => 'widescreen' },
- '1366x768' => { txt => '1366x768', cat => 'widescreen' },
- '1600x900' => { txt => '1600x900', cat => 'widescreen' },
- '1920x1080' => { txt => '1920x1080', cat => 'widescreen' };
-
-
-
# SQL: ENUM release_type
hash RELEASE_TYPE =>
complete => 'Complete',
diff --git a/lib/VNDB/Util/Misc.pm b/lib/VNDB/Util/Misc.pm
index b314bf08..c08fe1bb 100644
--- a/lib/VNDB/Util/Misc.pm
+++ b/lib/VNDB/Util/Misc.pm
@@ -99,15 +99,6 @@ sub filCompat {
$mod++;
}
- if($type eq 'release' && $fil->{resolution}) {
- $fil->{resolution} = [ map {
- if(/^[0-9]+$/) {
- $mod++;
- (keys %RESOLUTION)[$_] || 'unknown'
- } else { $_ }
- } ref $fil->{resolution} ? @{$fil->{resolution}} : $fil->{resolution} ];
- }
-
$mod;
}