From 21cb8873efeee2f833137ea9a242894686389be8 Mon Sep 17 00:00:00 2001
From: Yorhel
Date: Mon, 22 May 2017 19:02:36 +0200
Subject: API: Add some flags to query staff/seiyuu data
---
data/docs/11 | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
lib/Multi/API.pm | 47 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 103 insertions(+)
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.
(string).
Available roles: "main", "primary", "side" and "appears".
+
+ voiced |
+ voiced |
+ array of objects |
+ no |
+ List of voice actresses (staff) that voiced this character, per VN. Each
+ staff/VN is represented as a object with the following members:
+ "id", integer, staff ID
+ "aid", integer, the staff alias ID being used
+ "vid", integer, VN id
+ "note", string
+ 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.
+ |
+
Sorting is possible on the 'id' and 'name' fields.
@@ -1256,6 +1273,40 @@ Returned members:
no |
ID of the alias that is the "primary" name of the entry |
+
+ vns |
+ vns |
+ array of objects |
+ no |
+
+ 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:
+ "id", integer, visual novel id
+ "aid", integer, alias ID of this staff entry
+ "role", string
+ "note", string, may be null if unset
+ The same VN entry may appear multiple times if the staff has been credited
+ for multiple roles.
+ |
+
+
+ voiced |
+ voiced |
+ array of objects |
+ no |
+
+ List of characters that this staff entry has voiced. Each object has the
+ following members:
+ "id", integer, visual novel id
+ "aid", integer, alias ID of this staff entry
+ "cid", integer, character ID
+ "note", string, may be null if unset
+ 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.
+ |
+
Sorting is possible on the 'id' field.
@@ -1663,6 +1714,11 @@ Returned members:
Check out the announcements board for more information about updates.
+2017-05-22
+
+ - Add "vns" and "voiced" flags to "get staff" command
+ - Add "voiced" flag to "get character" command
+
2017-04-28 because screw version numbers
- Add "get staff" command
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 => [
--
cgit v1.2.3