summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-03-05 20:13:55 +0100
committerYorhel <git@yorhel.nl>2010-03-05 20:13:55 +0100
commit9667c97ca363b2a85a236b5a993561529558053b (patch)
treea58a4e1436454789f1e507e590a049473d4fc830
parent190d97c714c64a4d579a642c8574cde50996a1d3 (diff)
API: Added image field to 'get vn'
-rw-r--r--ChangeLog1
-rw-r--r--data/docs/1112
-rw-r--r--lib/Multi/API.pm3
3 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 5cb103cf..a25bf0e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
2.12 - ?
- !scr command for Multi::IRC
+ - API: Added 'image' field to get vn
2.11 - 2010-02-06
- Added Slovak to the language list
diff --git a/data/docs/11 b/data/docs/11
index e1e49881..144fded1 100644
--- a/data/docs/11
+++ b/data/docs/11
@@ -376,6 +376,16 @@ however still required.<br />
</td>
</tr>
<tr class="odd">
+ <td>image</td>
+ <td>details</td>
+ <td>string</td>
+ <td>yes</td>
+ <td>
+ HTTP link to the VN image. Please note that hotlinking is not allowed, so
+ make sure to leave the HTTP Referer header empty when fetching the image.
+ </td>
+ </tr>
+ <tr>
<td>anime</td>
<td>anime</td>
<td>array of objects</td>
@@ -393,7 +403,7 @@ however still required.<br />
and may not reflect the latest state of their information due to caching.
</td>
</tr>
- <tr>
+ <tr class="odd">
<td>relations</td>
<td>relations</td>
<td>array of objects</td>
diff --git a/lib/Multi/API.pm b/lib/Multi/API.pm
index be1191c6..a30a29b6 100644
--- a/lib/Multi/API.pm
+++ b/lib/Multi/API.pm
@@ -424,7 +424,7 @@ sub get_vn {
my $select = 'v.id, v.latest';
$select .= ', vr.title, vr.original, v.c_released, v.c_languages::text[], v.c_platforms' if grep /basic/, @{$get->{info}};
- $select .= ', vr.alias AS aliases, vr.length, vr.desc AS description, vr.l_wp, vr.l_encubed, vr.l_renai' if grep /details/, @{$get->{info}};
+ $select .= ', vr.image, vr.alias AS aliases, vr.length, vr.desc AS description, vr.l_wp, vr.l_encubed, vr.l_renai' if grep /details/, @{$get->{info}};
my @placeholders;
my $where = encode_filters $get->{filters}, \&filtertosql, $get->{c}, \@placeholders, [
@@ -496,6 +496,7 @@ sub get_vn_res {
encubed => delete($_->{l_encubed})||undef,
renai => delete($_->{l_renai}) ||undef
};
+ $_->{image} = $_->{image} ? sprintf '%s/cv/%02d/%d.jpg', $VNDB::S{url_static}, $_->{image}%100, $_->{image} : undef;
}
}
$get->{more} = pop(@$res)&&1 if @$res > $_[HEAP]{results};