danbooru api: #211 partial compatibility update

git-svn-id: file:///home/shish/svn/shimmie2/trunk@532 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
jjs 2007-10-19 21:59:16 +00:00
parent 98a0154db2
commit b3212c2872

View File

@ -15,6 +15,14 @@ add_post - title and rating are currently ignored because shimmie does not suppo
find_posts - sort of works, filename is returned as the original filename and probably won't help when it comes to actually downloading it find_posts - sort of works, filename is returned as the original filename and probably won't help when it comes to actually downloading it
find_tags - id, name, and after_id all work but the tags parameter is ignored just like danbooru 1.0 ignores it find_tags - id, name, and after_id all work but the tags parameter is ignored just like danbooru 1.0 ignores it
CHANGELOG
19-OCT-07 4:46PM CST - JJS
Add compatibility with danbooru api v1.8.1 style urls
for find_posts and add_post. NOTE: This does not implement
the changes to the parameter names, it is simply a
workaround for the latest danbooruup firefox extension.
Completely compatibility will probably involve a rewrite with a different URL
*/ */
class DanbooruApi extends Extension class DanbooruApi extends Extension
@ -105,7 +113,7 @@ class DanbooruApi extends Extension
Get Get
* Redirected to the newly uploaded post. * Redirected to the newly uploaded post.
*/ */
if($event->get_arg(1) == 'add_post') if(($event->get_arg(1) == 'add_post') || (($event->get_arg(1) == 'post') && ($event->get_arg(2) == 'create.xml')))
{ {
// No XML data is returned from this function // No XML data is returned from this function
$page->set_type("text/plain"); $page->set_type("text/plain");
@ -250,7 +258,7 @@ class DanbooruApi extends Extension
* offset: offset * offset: offset
* after_id: limit results to posts added after this id * after_id: limit results to posts added after this id
*/ */
if($event->get_arg(1) == 'find_posts') if(($event->get_arg(1) == 'find_posts') || (($event->get_arg(1) == 'post') && ($event->get_arg(2) == 'index.xml')))
{ {
if(isset($_GET['md5'])) if(isset($_GET['md5']))
{ {