From 4bba7d38125dfd223f6928c6b0512e69533b0b84 Mon Sep 17 00:00:00 2001
From: Yorhel
Date: Sun, 19 Jun 2016 11:42:17 +0200
Subject: API: Add "tags" filter to "get vn" + increase throttle throttle
---
data/docs/11 | 17 +++++++++++++++++
lib/Multi/API.pm | 12 ++++++++----
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/data/docs/11 b/data/docs/11
index 5e5962c7..17f93186 100644
--- a/data/docs/11
+++ b/data/docs/11
@@ -606,6 +606,22 @@ however still required.
that it can use a different algorithm than the search function on the website.
+
+ tags |
+ int array of ints |
+ = != |
+
+ Find VNs by tag. When providing an array of ints, the '=' filter will return
+ VNs that are linked to any (not all) of the given tags, the '!=' filter will
+ return VNs that are not linked to any of the given tags. You can combine
+ multiple tags filters with 'and' and 'or' to get the exact behavior you
+ need.
+ This filter may used cached data, it may take up to 24 hours
+ before a VN will have its tag updated with respect to this filter.
+ Be warned that this filter ignores spoiler settings, fetch the tags
+ associated with the returned VN to verify the spoiler level.
+ |
+
:SUBSUB:get release
@@ -1492,6 +1508,7 @@ however still required.
2.25
+ - Add "tags" filter to "get vn"
- Increased connection limit per IP from 5 to 10
- Increased command limit from 100 to 200 commands per 10 minutes
- Added support for TLS
diff --git a/lib/Multi/API.pm b/lib/Multi/API.pm
index 2b98b16e..baa8b93d 100644
--- a/lib/Multi/API.pm
+++ b/lib/Multi/API.pm
@@ -36,7 +36,7 @@ my %O = (
default_results => 10,
throttle_cmd => [ 3, 200 ], # interval between each command, allowed burst
throttle_sql => [ 60, 1 ], # sql time multiplier, allowed burst (in sql time)
- throttle_thr => [ 2, 10 ], # interval between "throttled" replies, allowed burst
+ throttle_thr => [ 1, 20 ], # interval between "throttled" replies, allowed burst
tls_options => undef, # Set to AnyEvent::TLS options to enable TLS
);
@@ -537,7 +537,11 @@ my %GET_VN = (
search => [
[ str => '(:value:)', {'~',1}, split => \&normalize_query,
join => ' AND ', serialize => 'v.c_search LIKE :value:', process => \'like' ],
- ]
+ ],
+ tags => [
+ [ int => 'v.id :op:(SELECT vid FROM tags_vn_inherit WHERE tag = :value:)', {'=' => 'IN', '!=' => 'NOT IN'}, range => [1,1e6] ],
+ [ inta => 'v.id :op:(SELECT vid FROM tags_vn_inherit WHERE tag IN(:value:))', {'=' => 'IN', '!=' => 'NOT IN'}, join => ',', range => [1,1e6] ],
+ ],
},
);
@@ -726,7 +730,7 @@ my %GET_PRODUCER = (
filters => {
id => [
[ 'int' => 'p.id :op: :value:', {qw|= = != <> > > < < <= <= >= >=|}, range => [1,1e6] ],
- [ inta => 'p.id :op:(:value:)', {'=' => 'IN', '!= ' => 'NOT IN'}, join => ',', range => [1,1e6] ],
+ [ inta => 'p.id :op:(:value:)', {'=' => 'IN', '!=' => 'NOT IN'}, join => ',', range => [1,1e6] ],
],
name => [
[ str => 'p.name :op: :value:', {qw|= = != <>|} ],
@@ -809,7 +813,7 @@ my %GET_CHARACTER = (
filters => {
id => [
[ 'int' => 'c.id :op: :value:', {qw|= = != <> > > < < <= <= >= >=|}, range => [1,1e6] ],
- [ inta => 'c.id :op:(:value:)', {'=' => 'IN', '!= ' => 'NOT IN'}, range => [1,1e6], join => ',' ],
+ [ inta => 'c.id :op:(:value:)', {'=' => 'IN', '!=' => 'NOT IN'}, range => [1,1e6], join => ',' ],
],
name => [
[ str => 'c.name :op: :value:', {qw|= = != <>|} ],
--
cgit v1.2.3