summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-05-30 17:06:32 +0200
committerYorhel <git@yorhel.nl>2009-05-30 17:06:32 +0200
commit1253d602e9c8c5ef0e8c49c61465332f758e9dd9 (patch)
treea4483a4334c728d3a83239736fcf41f72ce0a9c9 /lib
parentaa2f9e6b013e87c181569ce66c35cf962ea6f739 (diff)
Freeware and doujin filters on /r
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/DB/Releases.pm20
-rw-r--r--lib/VNDB/Handler/Releases.pm8
2 files changed, 17 insertions, 11 deletions
diff --git a/lib/VNDB/DB/Releases.pm b/lib/VNDB/DB/Releases.pm
index 659f8f27..bd5d8fcb 100644
--- a/lib/VNDB/DB/Releases.pm
+++ b/lib/VNDB/DB/Releases.pm
@@ -9,7 +9,8 @@ use Exporter 'import';
our @EXPORT = qw|dbReleaseGet dbReleaseAdd dbReleaseEdit|;
-# Options: id vid rev order unreleased page results what date media platforms languages type minage search resolutions
+# Options: id vid rev order unreleased page results what date media
+# platforms languages type minage search resolutions freeware doujin
# What: extended changes vn producers platforms media
sub dbReleaseGet {
my($self, %o) = @_;
@@ -19,14 +20,13 @@ sub dbReleaseGet {
$o{order} ||= 'rr.released ASC';
my @where = (
- !$o{id} && !$o{rev} ? (
- 'r.hidden = FALSE' => 0 ) : (),
- $o{id} ? (
- 'r.id = ?' => $o{id} ) : (),
- $o{rev} ? (
- 'c.rev = ?' => $o{rev} ) : (),
- $o{vid} ? (
- 'rv.vid = ?' => $o{vid} ) : (),
+ !$o{id} && !$o{rev} ? ( 'r.hidden = FALSE' => 0 ) : (),
+ $o{id} ? ( 'r.id = ?' => $o{id} ) : (),
+ $o{rev} ? ( 'c.rev = ?' => $o{rev} ) : (),
+ $o{vid} ? ( 'rv.vid = ?' => $o{vid} ) : (),
+ $o{patch} ? ( 'rr.patch = ?' => $o{patch} == 1 ? 1 : 0) : (),
+ $o{freeware} ? ( 'rr.freeware = ?' => $o{freeware} == 1 ? 1 : 0) : (),
+ $o{doujin} ? ( 'rr.doujin = ?' => $o{doujin} == 1 ? 1 : 0) : (),
defined $o{unreleased} ? (
q|rr.released !s ?| => [ $o{unreleased} ? '>' : '<=', strftime('%Y%m%d', gmtime) ] ) : (),
$o{date} ? (
@@ -40,8 +40,6 @@ sub dbReleaseGet {
'rr.type = ?' => $o{type} ) : (),
$o{minage} ? (
'(rr.minage !s ? AND rr.minage <> -1)' => [ $o{minage}[0] ? '<=' : '>=', $o{minage}[1] ] ) : (),
- $o{patch} ? (
- 'rr.patch = ?', $o{patch} == 1 ? 1 : 0) : (),
$o{media} ? (
'rr.id IN(SELECT irm.rid FROM releases_media irm JOIN releases ir ON ir.latest = irm.rid WHERE irm.medium IN(!l))' => [ $o{media} ] ) : (),
$o{resolutions} ? (
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index b9ca71a7..1f2b2ac6 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -470,6 +470,8 @@ sub browse {
{ name => 'me', required => 0, multi => 1, default => '', enum => [ keys %{$self->{media}} ] },
{ name => 'tp', required => 0, default => -1, enum => [ -1..$#{$self->{release_types}} ] },
{ name => 'pa', required => 0, default => 0, enum => [ 0..2 ] },
+ { name => 'fw', required => 0, default => 0, enum => [ 0..2 ] },
+ { name => 'do', required => 0, default => 0, enum => [ 0..2 ] },
{ name => 'ma_m', required => 0, default => 0, enum => [ 0, 1 ] },
{ name => 'ma_a', required => 0, default => 0, enum => [ keys %{$self->{age_ratings}} ] },
{ name => 'mi', required => 0, default => 0, template => 'int' },
@@ -488,6 +490,8 @@ sub browse {
$f->{tp} >= 0 ? (type => $f->{tp}) : (),
$f->{ma_a} || $f->{ma_m} ? (minage => [$f->{ma_m}, $f->{ma_a}]) : (),
$f->{pa} ? (patch => $f->{pa}) : (),
+ $f->{fw} ? (freeware => $f->{fw}) : (),
+ $f->{do} ? (doujin => $f->{do}) : (),
);
my($list, $np) = !@filters ? (undef, 0) : $self->dbReleaseGet(
order => $f->{s}.($f->{o}eq'd'?' DESC':' ASC'),
@@ -593,6 +597,10 @@ sub _filters {
options => [ [-1, 'All'], map [ $_, $self->{release_types}[$_] ], 0..$#{$self->{release_types}} ]]);
$self->htmlFormPart($f, [ select => short => 'pa', name => 'Patch status',
options => [ [0, 'All'], [1, 'Only patches'], [2, 'Only standalone releases']]]);
+ $self->htmlFormPart($f, [ select => short => 'fw', name => 'Freeware',
+ options => [ [0, 'All'], [1, 'Freeware only'], [2, 'Only non-free releases']]]);
+ $self->htmlFormPart($f, [ select => short => 'do', name => 'Doujin',
+ options => [ [0, 'All'], [1, 'Only doujin releases'], [2, 'Only commercial releases']]]);
$self->htmlFormPart($f, [ date => short => 'mi', name => 'Released after' ]);
$self->htmlFormPart($f, [ date => short => 'ma', name => 'Released before' ]);
end;