summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/js/filter.js5
-rw-r--r--lib/VNDB/DB/VN.pm7
-rw-r--r--lib/VNDB/Util/Misc.pm2
3 files changed, 11 insertions, 3 deletions
diff --git a/data/js/filter.js b/data/js/filter.js
index 9f7de239..3e4b2371 100644
--- a/data/js/filter.js
+++ b/data/js/filter.js
@@ -574,7 +574,10 @@ function filVN() {
[ 'General',
filFSelect( 'length', 'Length', 6, VARS.vn_lengths),
filFOptions('hasani', 'Anime', [[1, 'Has anime'], [0, 'Does not have anime']]),
- filFOptions('hasshot','Screenshots', [[1, 'Has screenshot'],[0, 'Does not have a screenshot']])
+ filFOptions('hasshot','Screenshots', [[1, 'Has screenshot'],[0, 'Does not have a screenshot']]),
+ [ 'date_after', 'Released after', dateLoad(null, selectField), function (c) { return [c.date_val] }, function(o,v) { o.dateSet(v) } ],
+ [ 'date_before', 'Released before', dateLoad(null, selectField), function (c) { return [c.date_val] }, function(o,v) { o.dateSet(v) } ],
+ filFOptions('released', 'Release date', [ [1, 'Past (already released)'], [0, 'Future (to be released)'] ])
],
ontagpage ? [ 'Tags',
[ '', ' ', tag('Additional tag filters are not available on this page. Use the visual novel browser instead (available from the main menu -> visual novels).') ],
diff --git a/lib/VNDB/DB/VN.pm b/lib/VNDB/DB/VN.pm
index b43ac791..55464728 100644
--- a/lib/VNDB/DB/VN.pm
+++ b/lib/VNDB/DB/VN.pm
@@ -4,6 +4,7 @@ package VNDB::DB::VN;
use strict;
use warnings;
use TUWF 'sqlprint';
+use POSIX 'strftime';
use Exporter 'import';
use VNDB::Func 'gtintype', 'normalize_query';
@@ -11,7 +12,8 @@ our @EXPORT = qw|dbVNGet dbVNGetRev dbVNRevisionInsert dbVNImageId dbScreenshotA
# Options: id, char, search, length, lang, olang, plat, tag_inc, tag_exc, tagspoil,
-# hasani, hasshot, ul_notblack, ul_onwish, results, page, what, sort, reverse, inc_hidden, release
+# hasani, hasshot, ul_notblack, ul_onwish, results, page, what, sort,
+# reverse, inc_hidden, date_before, date_after, released, release
# What: extended anime staff seiyuu relations screenshots relgraph rating ranking wishlist vnlist
# Note: wishlist and vnlist are ignored (no db search) unless a user is logged in
# Sort: id rel pop rating title tagscore rand
@@ -69,6 +71,9 @@ sub dbVNGet {
# optimize fetching random entries (only when there are no other filters present, otherwise this won't work well)
$o{sort} eq 'rand' && $o{results} <= 10 && !grep(!/^(?:results|page|what|sort|tagspoil)$/, keys %o) ? (
'v.id IN(SELECT floor(random() * last_value)::integer FROM generate_series(1,20), (SELECT MAX(id) AS last_value FROM vn) s1 LIMIT 20)' ) : (),
+ defined $o{date_before} ? ( 'v.c_released <= ?' => $o{date_before} ) : (),
+ defined $o{date_after} ? ( 'v.c_released >= ?' => $o{date_after} ) : (),
+ defined $o{released} ? ( 'v.c_released !s ?' => [ $o{released} ? '<=' : '>', strftime('%Y%m%d', gmtime) ] ) : (),
);
if($o{release}) {
diff --git a/lib/VNDB/Util/Misc.pm b/lib/VNDB/Util/Misc.pm
index c84b41d5..6a6496b3 100644
--- a/lib/VNDB/Util/Misc.pm
+++ b/lib/VNDB/Util/Misc.pm
@@ -11,7 +11,7 @@ our @EXPORT = qw|filFetchDB bbSubstLinks|;
our %filfields = (
- vn => [qw|length hasani hasshot tag_inc tag_exc taginc tagexc tagspoil lang olang plat ul_notblack ul_onwish ul_voted ul_onlist|],
+ 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|],
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|],