diff options
author | Yorhel <git@yorhel.nl> | 2019-09-13 16:13:24 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-09-13 16:13:26 +0200 |
commit | ed70099d2cea6f33b3b9951f6d05e207f652bd2a (patch) | |
tree | e7404e5d5c9c7f48eb410623b063211f00df1c90 /lib | |
parent | 29623a73b19c95381a0796858456b79a7ef34a1c (diff) |
Remove the VN length examples (+ some cruft I forgot earlier)
The original intention was that this list of common VNs most people have
played would be used for comparison to determine the length. But
nowadays there barely any such "well-read" VNs and even then it hasn't
been a very reliable approach anyway. Let's just stick with the time
indication.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VN3/ElmGen.pm | 2 | ||||
-rw-r--r-- | lib/VN3/Types.pm | 25 | ||||
-rw-r--r-- | lib/VN3/Validation.pm | 2 | ||||
-rw-r--r-- | lib/VNDB/Func.pm | 6 | ||||
-rw-r--r-- | lib/VNDB/Handler/VNEdit.pm | 4 | ||||
-rw-r--r-- | lib/VNDB/Types.pm | 12 |
6 files changed, 18 insertions, 33 deletions
diff --git a/lib/VN3/ElmGen.pm b/lib/VN3/ElmGen.pm index c3d12ed9..7dc28ff4 100644 --- a/lib/VN3/ElmGen.pm +++ b/lib/VN3/ElmGen.pm @@ -166,7 +166,7 @@ my $perms = VN3::Auth::listPerms(); def urlStatic => String => string tuwf->conf->{url_static}; def userPerms => 'List (Int, String)' => list map tuple($perms->{$_}, string $_), sort keys %$perms; -def vnLengths => 'List (Int, String)' => list map tuple($_, string vn_length_display $_), 0..$#VN_LENGTHS; +def vnLengths => 'List (Int, String)' => list map tuple($_, string vn_length_display $_), keys %VN_LENGTH; def vnRelations => 'List (String, String)' => list map tuple(string $_, string vn_relation_display $_), keys %VN_RELATION; def producerRelations => 'List (String, String)' => list map tuple(string $_, string producer_relation_display $_), keys %PRODUCER_RELATION; def creditType => 'List (String, String)' => list map tuple(string $_, string $CREDIT_TYPE{$_}), keys %CREDIT_TYPE; diff --git a/lib/VN3/Types.pm b/lib/VN3/Types.pm index 15b23010..86f6a996 100644 --- a/lib/VN3/Types.pm +++ b/lib/VN3/Types.pm @@ -18,7 +18,7 @@ our @EXPORT = qw/ Platform media_display ReleaseDate - @VN_LENGTHS vn_length_time vn_length_display + vn_length_time vn_length_display char_roles char_role_display vote_display vote_string date_display @@ -88,25 +88,14 @@ sub ReleaseDate { } - -our @VN_LENGTHS = ( - # name time examples - [ 'Unknown', '', '' ], - [ 'Very short', '< 2 hours', 'OMGWTFOTL, Jouka no Monshou, The world to reverse' ], - [ 'Short', '2 - 10 hours', 'Narcissu, Saya no Uta, Planetarian' ], - [ 'Medium', '10 - 30 hours', 'Yume Miru Kusuri, Cross†Channel, Crescendo' ], - [ 'Long', '30 - 50 hours', 'Tsukihime, Ever17, Demonbane' ], - [ 'Very long', '> 50 hours', 'Clannad, Umineko, Fate/Stay Night' ], -); - sub vn_length_time { - my $l = $VN_LENGTHS[$_[0]]; - $l->[1] || $l->[0]; + my $l = $VN_LENGTH{$_[0]}; + $l->{time} || $l->{txt}; } sub vn_length_display { - my $l = $VN_LENGTHS[$_[0]]; - $l->[0].($l->[1] ? " ($l->[1])" : '') + my $l = $VN_LENGTH{$_[0]}; + $l->{txt}.($l->{time} ? " ($l->{time})" : '') } @@ -161,9 +150,7 @@ sub spoil_display { -my @RELEASE_TYPES = qw/complete partial trial/; - -sub release_types { @RELEASE_TYPES } +sub release_types { keys %RELEASE_TYPE } sub minage_display { $AGE_RATING{$_[0]}{txt} } diff --git a/lib/VN3/Validation.pm b/lib/VN3/Validation.pm index 844ff49f..4dca4335 100644 --- a/lib/VN3/Validation.pm +++ b/lib/VN3/Validation.pm @@ -23,7 +23,7 @@ TUWF::set custom_validations => { username => { regex => qr/^[a-z0-9-]{2,15}$/ }, password => { length => [ 4, 500 ] }, editsum => { required => 1, length => [ 2, 5000 ] }, - vn_length => { required => 0, default => 0, uint => 1, range => [ 0, $#VN_LENGTHS ] }, + vn_length => { required => 0, default => 0, uint => 1, enum => \%VN_LENGTH }, vn_relation => { enum => \%VN_RELATION }, producer_relation => { enum => \%PRODUCER_RELATION }, staff_role => { enum => \%CREDIT_TYPE }, diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm index 9827a584..11e3dfee 100644 --- a/lib/VNDB/Func.pm +++ b/lib/VNDB/Func.pm @@ -203,13 +203,11 @@ sub fmtmedia { $med->{ $med->{qty} && $qty > 1 ? 'plural' : 'txt' }; } -# Formats a VN length (xtra = 1 for time indication, 2 for examples) +# Formats a VN length (xtra = time indication) sub fmtvnlen { my($len, $xtra) = @_; $len = $VN_LENGTH{$len}; - $len->{txt}. - ($xtra && $xtra == 1 && $len->{time} ? " ($len->{time})" : ''). - ($xtra && $xtra == 2 && $len->{example} ? " ($len->{example})" : ''); + $len->{txt}.($xtra && $len->{time} ? " ($len->{time})" : ''); } # Formats a UNIX timestamp as a '<number> <unit> ago' string diff --git a/lib/VNDB/Handler/VNEdit.pm b/lib/VNDB/Handler/VNEdit.pm index 98b4221e..932a07f9 100644 --- a/lib/VNDB/Handler/VNEdit.pm +++ b/lib/VNDB/Handler/VNEdit.pm @@ -269,8 +269,8 @@ sub _form { [ static => content => 'Short description of the main story. Please do not include spoilers, and don\'t forget to list' .' the source in case you didn\'t write the description yourself. Formatting codes are allowed.' ], - [ select => short => 'length', name => 'Length', width => 450, options => - [ map [ $_ => fmtvnlen $_, 2 ], keys %VN_LENGTH ] ], + [ select => short => 'length', name => 'Length', options => + [ map [ $_ => fmtvnlen $_, 1 ], keys %VN_LENGTH ] ], [ input => short => 'l_wikidata',name => 'Wikidata ID', pre => 'https://www.wikidata.org/wiki/', diff --git a/lib/VNDB/Types.pm b/lib/VNDB/Types.pm index 0a233b8e..9bf54822 100644 --- a/lib/VNDB/Types.pm +++ b/lib/VNDB/Types.pm @@ -146,12 +146,12 @@ hash CREDIT_TYPE => hash VN_LENGTH => - 0 => { txt => 'Unknown', time => '', example => '' }, - 1 => { txt => 'Very short', time => '< 2 hours', example => 'OMGWTFOTL, Jouka no Monshou, The world to reverse' }, - 2 => { txt => 'Short', time => '2 - 10 hours', example => 'Narcissu, Saya no Uta, Planetarian' }, - 3 => { txt => 'Medium', time => '10 - 30 hours', example => 'Yume Miru Kusuri, Cross†Channel, Crescendo' }, - 4 => { txt => 'Long', time => '30 - 50 hours', example => 'Tsukihime, Ever17, Demonbane' }, - 5 => { txt => 'Very long', time => '> 50 hours', example => 'Clannad, Umineko, Fate/Stay Night' }; + 0 => { txt => 'Unknown', time => '' }, + 1 => { txt => 'Very short', time => '< 2 hours' }, + 2 => { txt => 'Short', time => '2 - 10 hours' }, + 3 => { txt => 'Medium', time => '10 - 30 hours' }, + 4 => { txt => 'Long', time => '30 - 50 hours' }, + 5 => { txt => 'Very long', time => '> 50 hours' }; |