summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2018-05-25 16:11:01 +0200
committerYorhel <git@yorhel.nl>2018-05-25 16:11:03 +0200
commitb0f7086211dd326ef612d30561ddc69e7abf98fb (patch)
tree6a076efdfbe348d95e8a9c2893a130814f549589 /lib
parent0a39d801c10fd644bbfd4c9c4f3e357e3c522788 (diff)
Add uncensored flag to release entries
As discussed in https://vndb.org/t10665
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/DB/Releases.pm13
-rw-r--r--lib/VNDB/Handler/Releases.pm19
-rw-r--r--lib/VNDB/Util/Misc.pm2
3 files changed, 23 insertions, 11 deletions
diff --git a/lib/VNDB/DB/Releases.pm b/lib/VNDB/DB/Releases.pm
index c54ea1a3..1a01f712 100644
--- a/lib/VNDB/DB/Releases.pm
+++ b/lib/VNDB/DB/Releases.pm
@@ -16,8 +16,9 @@ sub dbReleaseFilters {
$o{plat} = [ $o{plat} ] if $o{plat} && !ref $o{plat};
$o{med} = [ $o{med} ] if $o{med} && !ref $o{med};
return (
- defined $o{patch} ? ( 'r.patch = ?' => $o{patch} == 1 ? 1 : 0) : (),
- defined $o{freeware} ? ( 'r.freeware = ?' => $o{freeware} == 1 ? 1 : 0) : (),
+ defined $o{patch} ? ( 'r.patch = ?' => $o{patch} == 1 ? 1 : 0) : (),
+ defined $o{freeware} ? ( 'r.freeware = ?' => $o{freeware} == 1 ? 1 : 0) : (),
+ defined $o{uncensored} ? ( 'r.uncensored = ?' => $o{uncensored} == 1 ? 1 : 0) : (),
defined $o{type} ? ( 'r.type = ?' => $o{type} ) : (),
defined $o{date_before} ? ( 'r.released <= ?' => $o{date_before} ) : (),
defined $o{date_after} ? ( 'r.released >= ?' => $o{date_after} ) : (),
@@ -45,7 +46,7 @@ sub dbReleaseFilters {
# Options: id vid pid released page results what med sort reverse date_before date_after
-# plat lang olang type minage search resolution freeware doujin voiced ani_story ani_ero hidden_only
+# plat lang olang type minage search resolution freeware doujin voiced uncensored ani_story ani_ero hidden_only
# What: extended vn producers platforms media affiliates
# Sort: title released minage
sub dbReleaseGet {
@@ -83,7 +84,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.ani_story r.ani_ero r.hidden r.locked| : (),
+ $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.hidden r.locked| : (),
$o{pid} ? ('rp.developer', 'rp.publisher') : (),
);
@@ -121,7 +122,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.ani_story, r.ani_ero, ro.hidden, ro.locked' if $o{what} =~ /extended/;
+ $select .= ', r.notes, r.catalog, r.gtin, r.resolution, r.voiced, r.freeware, r.doujin, r.uncensored, r.ani_story, r.ani_ero, ro.hidden, ro.locked' if $o{what} =~ /extended/;
$select .= ', extract(\'epoch\' from c.added) as added, c.requester, c.comments, u.username, c.rev, c.ihid, c.ilock';
$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';
@@ -212,7 +213,7 @@ sub dbReleaseRevisionInsert {
my %set = map exists($o->{$_}) ? ("$_ = ?", $o->{$_}) : (),
qw|title original gtin catalog website released notes minage type
- patch resolution voiced freeware doujin ani_story ani_ero|;
+ patch resolution voiced freeware doujin uncensored ani_story ani_ero|;
$self->dbExec('UPDATE edit_releases !H', \%set) if keys %set;
if($o->{languages}) {
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index 073ea82d..d69d20af 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -50,6 +50,7 @@ sub page {
[ patch => 'Patch', serialize => sub { $_[0] ? 'Yes' : 'No' } ],
[ freeware => 'Freeware', serialize => sub { $_[0] ? 'Yes' : 'No' } ],
[ doujin => 'Doujin', serialize => sub { $_[0] ? 'Yes' : 'No' } ],
+ [ uncensored => 'Uncensored', serialize => sub { $_[0] ? 'Yes' : 'No' } ],
[ title => 'Title (romaji)', diff => 1 ],
[ original => 'Original title', diff => 1 ],
[ gtin => 'JAN/UPC/EAN', serialize => sub { $_[0]||'[empty]' } ],
@@ -200,6 +201,13 @@ sub _infotable {
end;
}
+ if($r->{minage} == 18) {
+ Tr;
+ td 'Censoring';
+ td $r->{uncensored} ? 'No optical censoring (e.g. mosaics)' : 'May include optical censoring (e.g. mosaics)';
+ end;
+ }
+
for my $t (qw|developer publisher|) {
my @prod = grep $_->{$t}, @{$r->{producers}};
if(@prod) {
@@ -286,7 +294,7 @@ sub edit {
my $vn = $rid ? $r->{vn} : [{ vid => $vid, title => $v->{title} }];
my %b4 = !$rid ? () : (
(map { $_ => $r->{$_} } qw|type title original gtin catalog languages website released minage
- notes platforms patch resolution voiced freeware doujin ani_story ani_ero ihid ilock|),
+ notes platforms patch resolution voiced freeware doujin uncensored ani_story ani_ero ihid ilock|),
media => join(',', sort map "$_->{medium} $_->{qty}", @{$r->{media}}),
producers => join('|||', map
sprintf('%d,%d,%s', $_->{id}, ($_->{developer}?1:0)+($_->{publisher}?2:0), $_->{name}),
@@ -304,6 +312,7 @@ sub edit {
{ post => 'patch', required => 0, default => 0 },
{ post => 'freeware', required => 0, default => 0 },
{ post => 'doujin', required => 0, default => 0 },
+ { post => 'uncensored',required => 0, default => 0 },
{ post => 'title', maxlength => 250 },
{ post => 'original', required => 0, default => '', maxlength => 250 },
{ post => 'gtin', required => 0, default => '0', template => 'gtin' },
@@ -335,10 +344,11 @@ sub edit {
$producers = [ map { /^([0-9]+),([1-3])/ ? [ $1, $2&1?1:0, $2&2?1:0] : () } split /\|\|\|/, $frm->{producers} ];
$new_vn = [ map { /^([0-9]+)/ ? $1 : () } split /\|\|\|/, $frm->{vn} ];
$frm->{platforms} = [ grep $_, @{$frm->{platforms}} ];
- $frm->{$_} = $frm->{$_} ? 1 : 0 for (qw|patch freeware doujin ihid ilock|);
+ $frm->{$_} = $frm->{$_} ? 1 : 0 for (qw|patch freeware doujin uncensored ihid ilock|);
# reset some fields when the patch flag is set
$frm->{doujin} = $frm->{resolution} = $frm->{voiced} = $frm->{ani_story} = $frm->{ani_ero} = 0 if $frm->{patch};
+ $frm->{uncensored} = 0 if $frm->{minage} != 18;
my $same = $rid &&
(join(',', sort @{$b4{platforms}}) eq join(',', sort @{$frm->{platforms}})) &&
@@ -353,7 +363,7 @@ sub edit {
if(!$frm->{_err}) {
my $nrev = $self->dbItemEdit(r => !$copy && $rid ? ($r->{id}, $r->{rev}) : (undef, undef),
(map { $_ => $frm->{$_} } qw| type title original gtin catalog languages website released minage
- notes platforms resolution editsum patch voiced freeware doujin ani_story ani_ero ihid ilock|),
+ notes platforms resolution editsum patch voiced freeware doujin uncensored ani_story ani_ero ihid ilock|),
vn => $new_vn,
producers => $producers,
media => $media,
@@ -403,10 +413,11 @@ sub _form {
[ static => content => 'Leave month or day blank if they are unknown' ],
[ select => short => 'minage', name => 'Age rating',
options => [ map [ $_, minage $_, 1 ], @{$self->{age_ratings}} ] ],
+ [ check => short => 'uncensored',name => 'No mosaic or other optical censoring (only check if this release has erotic content)' ],
[ textarea => short => 'notes', name => 'Notes<br /><b class="standout">English please!</b>' ],
[ static => content =>
'Miscellaneous notes/comments, information that does not fit in the above fields.'
- .' E.g.: Censored/uncensored or for which releases this patch applies.' ],
+ .' E.g.: Types of censoring or for which releases this patch applies.' ],
],
rel_format => [ 'Format',
diff --git a/lib/VNDB/Util/Misc.pm b/lib/VNDB/Util/Misc.pm
index efecbb64..660818a2 100644
--- a/lib/VNDB/Util/Misc.pm
+++ b/lib/VNDB/Util/Misc.pm
@@ -13,7 +13,7 @@ our @EXPORT = qw|filFetchDB bbSubstLinks|;
our %filfields = (
vn => [qw|date_before date_after released length hasani hasshot tag_inc tag_exc taginc tagexc tagspoil lang olang plat ul_notblack ul_onwish ul_voted ul_onlist|],
- release => [qw|type patch freeware doujin date_before date_after released minage lang olang resolution plat med voiced ani_story ani_ero|],
+ release => [qw|type patch freeware doujin uncensored date_before date_after released minage lang olang resolution plat med voiced ani_story ani_ero|],
char => [qw|gender bloodt bust_min bust_max waist_min waist_max hip_min hip_max height_min height_max weight_min weight_max trait_inc trait_exc tagspoil role|],
staff => [qw|gender role truename lang|],
);