summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2017-05-22 19:02:36 +0200
committerYorhel <git@yorhel.nl>2017-05-22 19:02:36 +0200
commit21cb8873efeee2f833137ea9a242894686389be8 (patch)
tree7f02951ccc2addc3d83e1aebba3a97939d8eed6b
parentaff775ace903d21085c0f17dc446fcbaa326dbb7 (diff)
API: Add some flags to query staff/seiyuu data
-rw-r--r--data/docs/1156
-rw-r--r--lib/Multi/API.pm47
2 files changed, 103 insertions, 0 deletions
diff --git a/data/docs/11 b/data/docs/11
index e9b41299..dd8f9be3 100644
--- a/data/docs/11
+++ b/data/docs/11
@@ -1099,6 +1099,23 @@ however still required.<br />
(string).<br />
Available roles: "main", "primary", "side" and "appears".</td>
</tr>
+ <tr class="odd">
+ <td>voiced</td>
+ <td>voiced</td>
+ <td>array of objects</td>
+ <td>no</td>
+ <td>List of voice actresses (staff) that voiced this character, per VN. Each
+ staff/VN is represented as a object with the following members:<br />
+ "id", integer, staff ID<br />
+ "aid", integer, the staff alias ID being used<br />
+ "vid", integer, VN id<br />
+ "note", string<br />
+ The same voice actor may be listed multiple times if this entry is
+ character to multiple visual novels. Similarly, the same visual novel may
+ be listed multiple times if this character has multiple voice actors in the
+ same VN.
+ </td>
+ </tr>
</table>
<p>Sorting is possible on the 'id' and 'name' fields.</p><br />
@@ -1256,6 +1273,40 @@ Returned members:</p>
<td>no</td>
<td>ID of the alias that is the "primary" name of the entry</td>
</tr>
+ <tr>
+ <td>vns</td>
+ <td>vns</td>
+ <td>array of objects</td>
+ <td>no</td>
+ <td>
+ List of visual novels that this staff entry has been credited in (excluding
+ character voicing). Each vn is represented as an object with the following
+ members:<br />
+ "id", integer, visual novel id<br />
+ "aid", integer, alias ID of this staff entry<br />
+ "role", string<br />
+ "note", string, may be null if unset<br />
+ The same VN entry may appear multiple times if the staff has been credited
+ for multiple roles.
+ </td>
+ </tr>
+ <tr class="odd">
+ <td>voiced</td>
+ <td>voiced</td>
+ <td>array of objects</td>
+ <td>no</td>
+ <td>
+ List of characters that this staff entry has voiced. Each object has the
+ following members:<br />
+ "id", integer, visual novel id<br />
+ "aid", integer, alias ID of this staff entry<br />
+ "cid", integer, character ID<br />
+ "note", string, may be null if unset<br />
+ The same VN entry may appear multiple times if the staff has been credited
+ for multiple characters. Similarly, the same character may appear multiple
+ times if it has been linked to multiple VNs.
+ </td>
+ </tr>
</table>
<p>Sorting is possible on the 'id' field.</p><br />
@@ -1663,6 +1714,11 @@ Returned members:</p>
Check out the <a href="/t/an">announcements board</a> for more information about updates.
<br /><br />
</p>
+<b>2017-05-22</b>
+<ul>
+ <li>Add "vns" and "voiced" flags to "get staff" command</li>
+ <li>Add "voiced" flag to "get character" command</li>
+</ul>
<b>2017-04-28</b> <b class="grayedout">because screw version numbers</b>
<ul>
<li>Add "get staff" command</li>
diff --git a/lib/Multi/API.pm b/lib/Multi/API.pm
index d4732d57..610cb3a0 100644
--- a/lib/Multi/API.pm
+++ b/lib/Multi/API.pm
@@ -822,6 +822,22 @@ my %GET_CHARACTER = (
},
]],
},
+ voiced => {
+ fetch => [[ 'id', 'SELECT vs.cid, sa.id, sa.aid, vs.id AS vid, vs.note FROM vn_seiyuu vs JOIN staff_alias sa ON sa.aid = vs.aid WHERE vs.cid IN(%s)',
+ sub { my($n, $r) = @_;
+ for my $i (@$n) {
+ $i->{voiced} = [ grep $i->{id} == $_->{cid}, @$r ];
+ }
+ for (@$r) {
+ $_->{id}*=1;
+ $_->{aid}*=1;
+ $_->{vid}*=1;
+ $_->{note} ||= undef;
+ delete $_->{cid};
+ }
+ },
+ ]]
+ }
},
filters => {
id => [
@@ -895,6 +911,37 @@ my %GET_STAFF = (
},
]],
},
+ vns => {
+ fetch => [[ 'id', 'SELECT sa.id AS sid, sa.aid, vs.id, vs.role, vs.note FROM staff_alias sa JOIN vn_staff vs ON vs.aid = sa.aid WHERE sa.id IN(%s)',
+ sub { my($n, $r) = @_;
+ for my $i (@$n) {
+ $i->{vns} = [ grep $i->{id} == $_->{sid}, @$r ];
+ }
+ for (@$r) {
+ $_->{id}*=1;
+ $_->{aid}*=1;
+ $_->{note} ||= undef;
+ delete $_->{sid};
+ }
+ },
+ ]]
+ },
+ voiced => {
+ fetch => [[ 'id', 'SELECT sa.id AS sid, sa.aid, vs.id, vs.cid, vs.note FROM staff_alias sa JOIN vn_seiyuu vs ON vs.aid = sa.aid WHERE sa.id IN(%s)',
+ sub { my($n, $r) = @_;
+ for my $i (@$n) {
+ $i->{voiced} = [ grep $i->{id} == $_->{sid}, @$r ];
+ }
+ for (@$r) {
+ $_->{id}*=1;
+ $_->{aid}*=1;
+ $_->{cid}*=1;
+ $_->{note} ||= undef;
+ delete $_->{sid};
+ }
+ },
+ ]]
+ }
},
filters => {
id => [