summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2022-10-02 14:50:45 +0200
committerYorhel <git@yorhel.nl>2022-10-02 14:50:45 +0200
commit766e2c9b90e1f25ee8b699d3f803b75138a567b4 (patch)
treefb2e39ffbe40fb859b7a9722dcd68ca7dd988cca /lib
parentfab2e0bd5e61099e379a04da6e5214c4514e0957 (diff)
API: Add VN + release titles
Diffstat (limited to 'lib')
-rw-r--r--lib/Multi/API.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/Multi/API.pm b/lib/Multi/API.pm
index 52dfa357..cb2999b7 100644
--- a/lib/Multi/API.pm
+++ b/lib/Multi/API.pm
@@ -495,6 +495,19 @@ my %GET_VN = (
$_[0]{votecount} *= 1;
},
},
+ titles => {
+ fetch => [[ 'id', 'SELECT id, lang, title, latin, official FROM vn_titles WHERE id IN(%s)',
+ sub { my($r, $n) = @_;
+ for my $i (@$r) {
+ $i->{titles} = [ grep $i->{id} eq $_->{id}, @$n ];
+ }
+ for (@$n) {
+ delete $_->{id};
+ $_->{official} = $_->{official} =~ /t/ ? TRUE : FALSE,
+ }
+ }
+ ]],
+ },
anime => {
fetch => [[ 'id', 'SELECT va.id AS vid, a.id, a.year, a.ann_id, a.nfo_id, a.type, a.title_romaji, a.title_kanji
FROM anime a JOIN vn_anime va ON va.aid = a.id WHERE va.id IN(%s)',
@@ -700,6 +713,19 @@ my %GET_RELEASE = (
} ],
]
},
+ lang => {
+ fetch => [[ 'id', 'SELECT id, lang, title, latin, mtl FROM releases_titles WHERE id IN(%s)',
+ sub { my($r, $n) = @_;
+ for my $i (@$r) {
+ $i->{lang} = [ grep $i->{id} eq $_->{id}, @$n ];
+ }
+ for (@$n) {
+ delete $_->{id};
+ $_->{mtl} = $_->{mtl} =~ /t/ ? TRUE : FALSE,
+ }
+ }
+ ]],
+ },
vn => {
fetch => [[ 'id', 'SELECT rv.id AS rid, rv.rtype, v.id, v.title, v.alttitle AS original FROM releases_vn rv JOIN vnt v ON v.id = rv.vid
WHERE NOT v.hidden AND rv.id IN(%s)',