summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2016-06-19 11:42:17 +0200
committerYorhel <git@yorhel.nl>2016-06-19 11:42:17 +0200
commit4bba7d38125dfd223f6928c6b0512e69533b0b84 (patch)
treed5c22b11e38f97f28a3bf9d3ab965aa80df22668
parent45782a3388f2a353948f15af316ef11515026b06 (diff)
API: Add "tags" filter to "get vn" + increase throttle throttle
-rw-r--r--data/docs/1117
-rw-r--r--lib/Multi/API.pm12
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.<br />
that it can use a different algorithm than the search function on the website.
</td>
</tr>
+ <tr>
+ <td>tags</td>
+ <td>int<br />array of ints</td>
+ <td>= !=</td>
+ <td>
+ 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.<br />
+ 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.<br />
+ Be warned that this filter ignores spoiler settings, fetch the tags
+ associated with the returned VN to verify the spoiler level.
+ </td>
+ </tr>
</table>
:SUBSUB:get release
@@ -1492,6 +1508,7 @@ however still required.<br />
</p>
<b>2.25</b>
<ul>
+ <li>Add "tags" filter to "get vn"</li>
<li>Increased connection limit per IP from 5 to 10</li>
<li>Increased command limit from 100 to 200 commands per 10 minutes</li>
<li>Added support for TLS</li>
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|= = != <>|} ],