diff options
author | Yorhel <git@yorhel.nl> | 2019-09-12 11:35:00 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-09-12 11:35:00 +0200 |
commit | 5a62f120bad71b81068fd1d50035effc0fda688c (patch) | |
tree | 9b5b6c183b97fce68a52e1f7178f6140f9989f08 /lib | |
parent | f6851137f4a6f1f9feba51ec5473e743d64a58b2 (diff) |
VNDB::Types: Convert animated & voiced
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VN3/ElmGen.pm | 4 | ||||
-rw-r--r-- | lib/VN3/Release/Page.pm | 6 | ||||
-rw-r--r-- | lib/VN3/Types.pm | 9 | ||||
-rw-r--r-- | lib/VN3/Validation.pm | 4 | ||||
-rw-r--r-- | lib/VNDB/Handler/Releases.pm | 24 | ||||
-rw-r--r-- | lib/VNDB/Handler/VNPage.pm | 12 | ||||
-rw-r--r-- | lib/VNDB/Types.pm | 20 |
7 files changed, 44 insertions, 35 deletions
diff --git a/lib/VN3/ElmGen.pm b/lib/VN3/ElmGen.pm index 3e3f9faf..3e18d70d 100644 --- a/lib/VN3/ElmGen.pm +++ b/lib/VN3/ElmGen.pm @@ -176,8 +176,8 @@ def releaseTypes => 'List String' => list map string($_), release def producerTypes => 'List (String, String)' => list map tuple(string $_, string $PRODUCER_TYPE{$_}), keys %PRODUCER_TYPE; def minAges => 'List (Int, String)' => list map tuple($_, string minage_display_full $_), @MINAGE; def resolutions => 'List (String, String)' => list map tuple(string $_, string resolution_display_full $_), keys %RESOLUTIONS; -def voiced => 'List String' => list map string($_), @VOICED; -def animated => 'List String' => list map string($_), @ANIMATED; +def voiced => 'List (Int, String)' => list map tuple($_, string($VOICED{$_})), keys %VOICED; +def animated => 'List (Int, String)' => list map tuple($_, string($ANIMATED{$_})), keys %ANIMATED; def genders => 'List (String, String)' => list map tuple(string $_, string gender_display $_), keys %GENDER; def bloodTypes => 'List (String, String)' => list map tuple(string $_, string blood_type_display $_), keys %BLOOD_TYPE; def charRoles => 'List (String, String)' => list map tuple(string $_, string char_role_display $_), keys %CHAR_ROLE; diff --git a/lib/VN3/Release/Page.pm b/lib/VN3/Release/Page.pm index 81193183..03d3bd5c 100644 --- a/lib/VN3/Release/Page.pm +++ b/lib/VN3/Release/Page.pm @@ -89,17 +89,17 @@ sub DetailsTable { $e->{voiced} ? sub { Dt 'Voiced'; - Dd $VOICED[$e->{voiced}]; + Dd $VOICED{$e->{voiced}}{txt}; } : (), $e->{ani_story} ? sub { Dt 'Story animation'; - Dd $ANIMATED[$e->{ani_story}]; + Dd $ANIMATED{$e->{ani_story}}{txt}; } : (), $e->{ani_ero} ? sub { Dt 'Ero animation'; - Dd $ANIMATED[$e->{ani_ero}]; + Dd $ANIMATED{$e->{ani_ero}}{txt}; } : (), $e->{minage} && $e->{minage} == 18 ? sub { diff --git a/lib/VN3/Types.pm b/lib/VN3/Types.pm index fa53ea73..a36cc6dd 100644 --- a/lib/VN3/Types.pm +++ b/lib/VN3/Types.pm @@ -28,8 +28,6 @@ our @EXPORT = qw/ release_types @MINAGE minage_display minage_display_full %RESOLUTIONS resolution_display_full - @VOICED - @ANIMATED gender_display gender_icon blood_type_display /; @@ -228,13 +226,6 @@ tie %RESOLUTIONS, 'Tie::IxHash', sub resolution_display_full { my $e = $RESOLUTIONS{$_[0]}; ($e->[1] ? ucfirst "$e->[1]: " : '').$e->[0] } - -our @VOICED = ('Unknown', 'Not voiced', 'Only ero scenes voiced', 'Partially voiced', 'Fully voiced'); - -our @ANIMATED = ('Unknown', 'No animations', 'Simple animations', 'Some fully animated scenes', 'All scenes fully animated'); - - - sub gender_display { $GENDER{$_[0]} } sub gender_icon { +{qw/m ♂ f ♀ mf ♂♀/}->{$_[0]}||'' } diff --git a/lib/VN3/Validation.pm b/lib/VN3/Validation.pm index 5c1c73d7..0ec83514 100644 --- a/lib/VN3/Validation.pm +++ b/lib/VN3/Validation.pm @@ -36,8 +36,8 @@ TUWF::set custom_validations => { blood_type => { enum => \%BLOOD_TYPE }, gtin => { uint => 1, func => sub { $_[0] eq 0 || gtintype($_[0]) } }, minage => { uint => 1, enum => \@MINAGE }, - animated => { uint => 1, range => [ 0, $#ANIMATED ] }, - voiced => { uint => 1, range => [ 0, $#VOICED ] }, + animated => { uint => 1, enum => \%ANIMATED }, + voiced => { uint => 1, enum => \%VOICED }, rdate => { uint => 1, func => \&_validate_rdate }, spoiler => { uint => 1, range => [ 0, 2 ] }, vnlist_status=>{ enum => \%VNLIST_STATUS }, diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm index ff687dec..da1c1554 100644 --- a/lib/VNDB/Handler/Releases.pm +++ b/lib/VNDB/Handler/Releases.pm @@ -86,9 +86,9 @@ sub page { [ platforms => 'Platforms', join => ', ', split => sub { map $PLATFORM{$_}, @{$_[0]} } ], [ media => 'Media', join => ', ', split => sub { map fmtmedia($_->{medium}, $_->{qty}), @{$_[0]} } ], [ resolution => 'Resolution', serialize => sub { $self->{resolutions}{$_[0]}[0]; } ], - [ voiced => 'Voiced', serialize => sub { $self->{voiced}[$_[0]] } ], - [ ani_story => 'Story animation', serialize => sub { $self->{animated}[$_[0]] } ], - [ ani_ero => 'Ero animation', serialize => sub { $self->{animated}[$_[0]] } ], + [ voiced => 'Voiced', serialize => sub { $VOICED{$_[0]}{txt} } ], + [ ani_story => 'Story animation', serialize => sub { $ANIMATED{$_[0]}{txt} } ], + [ ani_ero => 'Ero animation', serialize => sub { $ANIMATED{$_[0]}{txt} } ], [ engine => 'Engine' ], [ producers => 'Producers', join => '<br />', split => sub { map sprintf('<a href="/p%d" title="%s">%s</a> (%s)', $_->{id}, $_->{original}||$_->{name}, shorten($_->{name}, 50), @@ -198,7 +198,7 @@ sub _infotable { if($r->{voiced}) { Tr; td 'Voiced'; - td $self->{voiced}[$r->{voiced}]; + td $VOICED{$r->{voiced}}{txt}; end; } @@ -206,8 +206,8 @@ sub _infotable { Tr; td 'Animation'; td join ', ', - $r->{ani_story} ? "Story: $self->{animated}[$r->{ani_story}]" : (), - $r->{ani_ero} ? "Ero scenes: $self->{animated}[$r->{ani_ero}]" : (); + $r->{ani_story} ? "Story: $ANIMATED{$r->{ani_story}}{txt}" : (), + $r->{ani_ero} ? "Ero scenes: $ANIMATED{$r->{ani_ero}}{txt}" : (); end; } @@ -386,9 +386,9 @@ sub edit { { post => 'platforms', required => 0, default => '', multi => 1, enum => [ keys %PLATFORM ] }, { post => 'media', required => 0, default => '' }, { post => 'resolution',required => 0, default => 0, enum => [ keys %{$self->{resolutions}} ] }, - { post => 'voiced', required => 0, default => 0, enum => [ 0..$#{$self->{voiced}} ] }, - { post => 'ani_story', required => 0, default => 0, enum => [ 0..$#{$self->{animated}} ] }, - { post => 'ani_ero', required => 0, default => 0, enum => [ 0..$#{$self->{animated}} ] }, + { post => 'voiced', required => 0, default => 0, enum => [ keys %VOICED ] }, + { post => 'ani_story', required => 0, default => 0, enum => [ keys %ANIMATED ] }, + { post => 'ani_ero', required => 0, default => 0, enum => [ keys %ANIMATED ] }, { post => 'engine', required => 0, default => '', maxlength => 50 }, { post => 'engine_oth',required => 0, default => '', maxlength => 50 }, { post => 'producers', required => 0, default => '' }, @@ -537,11 +537,11 @@ sub _form { } ], [ static => content => 'Try to use a name from the <a href="/r/engines">engine list</a>.' ], [ select => short => 'voiced', name => 'Voiced', options => [ - map [ $_, $self->{voiced}[$_] ], 0..$#{$self->{voiced}} ] ], + map [ $_, $VOICED{$_}{txt} ], keys %VOICED ] ], [ select => short => 'ani_story', name => 'Story animation', options => [ - map [ $_, $self->{animated}[$_] ], 0..$#{$self->{animated}} ] ], + map [ $_, $ANIMATED{$_}{txt} ], keys %ANIMATED ] ], [ select => short => 'ani_ero', name => 'Ero animation', options => [ - map [ $_, $_ ? $self->{animated}[$_] : 'Unknown / no ero scenes' ], 0..$#{$self->{animated}} ] ], + map [ $_, $_ ? $ANIMATED{$_}{txt} : 'Unknown / no ero scenes' ], keys %ANIMATED ] ], [ static => content => 'Animation in erotic scenes, leave to unknown if there are no ero scenes.' ], [ hidden => short => 'media' ], [ static => nolabel => 1, content => sub { diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm index a7988df8..01c14bce 100644 --- a/lib/VNDB/Handler/VNPage.pm +++ b/lib/VNDB/Handler/VNPage.pm @@ -139,7 +139,7 @@ my @rel_cols = ( default => 1, what => 'extended', has_data => sub { !!$_[0]{voiced} }, - draw => sub { txt $TUWF::OBJ->{voiced}[$_[0]{voiced}] }, + draw => sub { txt $VOICED{$_[0]{voiced}}{txt} }, }, { # Animation id => 'ani', sort_field => 'ani_ero', @@ -151,8 +151,8 @@ my @rel_cols = ( has_data => sub { !!($_[0]{ani_story} || $_[0]{ani_ero}) }, draw => sub { txt join ', ', - $_[0]{ani_story} ? "Story: $TUWF::OBJ->{animated}[$_[0]{ani_story}]" :(), - $_[0]{ani_ero} ? "Ero scenes: $TUWF::OBJ->{animated}[$_[0]{ani_ero}]":(); + $_[0]{ani_story} ? "Story: $ANIMATED{$_[0]{ani_story}}{txt}" :(), + $_[0]{ani_ero} ? "Ero scenes: $ANIMATED{$_[0]{ani_ero}}{txt}":(); txt 'Unknown' if !$_[0]{ani_story} && !$_[0]{ani_ero}; }, }, { # Released @@ -863,14 +863,14 @@ sub _release_icons { # Voice column my $voice = $rel->{voiced}; - _release_icon $self->{icons_voiced}[$voice], $self->{voiced}[$voice], 'voiced' if $voice; + _release_icon $VOICED{$voice}{icon}, $VOICED{$voice}{txt}, 'voiced' if $voice; # Animations columns my $story_anim = $rel->{ani_story}; - _release_icon $self->{icons_story_animated}[$story_anim], "Story: $self->{animated}[$story_anim]", 'story_animated' if $story_anim; + _release_icon $ANIMATED{$story_anim}{story_icon}, "Story: $ANIMATED{$story_anim}{txt}", 'story_animated' if $story_anim; my $ero_anim = $rel->{ani_ero}; - _release_icon $self->{icons_ero_animated}[$ero_anim], "Ero: $self->{animated}[$ero_anim]", 'ero_animated' if $ero_anim; + _release_icon $ANIMATED{$ero_anim}{ero_icon}, "Ero: $ANIMATED{$ero_anim}{txt}", 'ero_animated' if $ero_anim; # Cost column _release_icon 'freeware', 'Freeware', 'free' if $rel->{freeware}; diff --git a/lib/VNDB/Types.pm b/lib/VNDB/Types.pm index f101e68d..6a9aae2e 100644 --- a/lib/VNDB/Types.pm +++ b/lib/VNDB/Types.pm @@ -188,6 +188,24 @@ hash TAG_CATEGORY => +hash ANIMATED => + 0 => { txt => 'Unknown', story_icon => 'unknown', ero_icon => 'unknown' }, + 1 => { txt => 'No animations', story_icon => 'story_not_animated', ero_icon => 'ero_not_animated' }, + 2 => { txt => 'Simple animations', story_icon => 'story_simple_animated', ero_icon => 'ero_simple_animated' }, + 3 => { txt => 'Some fully animated scenes', story_icon => 'story_some_fully_animated', ero_icon => 'ero_some_fully_animated' }, + 4 => { txt => 'All scenes fully animated', story_icon => 'story_all_fully_animated', ero_icon => 'ero_all_fully_animated' }; + + + +hash VOICED => + 0 => { txt => 'Unknown', icon => 'unknown' }, + 1 => { txt => 'Not voiced', icon => 'not_voiced' }, + 2 => { txt => 'Only ero scenes voiced', icon => 'ero_voiced' }, + 3 => { txt => 'Partially voiced', icon => 'partially_voiced' }, + 4 => { txt => 'Fully voiced', icon => 'fully_voiced' }; + + + hash WISHLIST_STATUS => 0 => 'High', 1 => 'Medium', @@ -229,7 +247,7 @@ hash BLOOD_TYPE => b => 'B', ab => 'AB'; -# SQL: ENUM blood_type +# SQL: ENUM gender hash GENDER => unknown => 'Unknown or N/A', m => 'Male', |