Android Open Source - norilib Shimmie






From Project

Back to project page norilib.

License

The source code is released under:

Copyright (c) 2013-2014, vomitcuddle <shinku@dollbooru.org> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the a...

If you think the Android project norilib listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * This file is part of nori./*from   w  ww.j a  v a  2s  .c  o  m*/
 * Copyright (c) 2014 vomitcuddle <shinku@dollbooru.org>
 * License: ISC
 */

package com.cuddlesoft.norilib.clients;

import java.util.Locale;

/**
 * Client for the Shimmie2 API.
 * Shimmie2 provides an extension that enables a Danbooru 1.x-based API.
 */
public class Shimmie extends DanbooruLegacy {
  public Shimmie(String name, String endpoint) {
    super(name, endpoint);
  }

  public Shimmie(String name, String endpoint, String username, String password) {
    super(name, endpoint, username, password);
  }

  @Override
  public Settings getSettings() {
    return new Settings(Settings.APIType.SHIMMIE, name, apiEndpoint, username, password);
  }

  @Override
  protected String webUrlFromId(String id) {
    return String.format(Locale.US, "%s/post/view/%s", apiEndpoint, id);
  }

  @Override
  protected String createSearchURL(String tags, int pid, int limit) {
    // Page numbers are 1-indexed for this api.
    final int page = pid + 1;

    return String.format(Locale.US, "%s/api/danbooru/find_posts/index.xml?tags=%s&page=%d&limit=%d", apiEndpoint, tags, page, limit);
  }
}




Java Source Code List

com.cuddlesoft.norilib.Image.java
com.cuddlesoft.norilib.SearchResult.java
com.cuddlesoft.norilib.Tag.java
com.cuddlesoft.norilib.clients.DanbooruLegacy.java
com.cuddlesoft.norilib.clients.Danbooru.java
com.cuddlesoft.norilib.clients.Gelbooru.java
com.cuddlesoft.norilib.clients.SearchClient.java
com.cuddlesoft.norilib.clients.Shimmie.java
com.cuddlesoft.norilib.service.ServiceTypeDetectionService.java