X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsearchable%2FBasicSearchable.java;h=b943abd25401f426bad456140eea004be06437fb;hb=d66deb8d8b30cff6b54db352eef34a3508939f84;hp=c6394430e6e08c8b34ff49e2a0d2b819f6da47bc;hpb=e66c9078be4348bf9c799470973220d9ab2053cd;p=nikiroo-utils.git diff --git a/src/be/nikiroo/fanfix/searchable/BasicSearchable.java b/src/be/nikiroo/fanfix/searchable/BasicSearchable.java index c639443..b943abd 100644 --- a/src/be/nikiroo/fanfix/searchable/BasicSearchable.java +++ b/src/be/nikiroo/fanfix/searchable/BasicSearchable.java @@ -34,6 +34,38 @@ public abstract class BasicSearchable { support = BasicSupport.getSupport(getType(), null); } + /** + * Find the given tag by its hierarchical IDs. + *
+ * I.E., it will take the tag A, subtag B, subsubtag C...
+ *
+ * @param ids
+ * the IDs to look for
+ *
+ * @return the appropriate tag fully filled, or NULL if not found
+ *
+ * @throws IOException
+ * in case of I/O error
+ */
+ public SearchableTag getTag(Integer... ids) throws IOException {
+ SearchableTag tag = null;
+ List
* URL is guaranteed to be usable, LUID will always be NULL.
*
- * @param tagId
+ * @param tag
* the tag to search for
* @param page
* the page to use for result pagination (see
@@ -159,8 +222,7 @@ public abstract class BasicSearchable {
* in case of I/O error
*/
protected Document load(URL url, boolean stable) throws IOException {
- return DataUtil.load(Instance.getCache().open(url, support, stable),
- "UTF-8", url.toString());
+ return DataUtil.load(Instance.getInstance().getCache().open(url, support, stable), "UTF-8", url.toString());
}
/**
@@ -168,41 +230,44 @@ public abstract class BasicSearchable {
* type, or NULL if it does not exist.
*
* @param type
- * the type, must not be NULL
+ * the type, can be NULL (will just return NULL, since we do not
+ * support it)
*
* @return an implementation that supports it, or NULL
*/
- public static BasicSearchable getSearchable(SupportType type) {
+ static public BasicSearchable getSearchable(SupportType type) {
BasicSearchable support = null;
- switch (type) {
- case FIMFICTION:
- // TODO
- break;
- case FANFICTION:
- support = new Fanfiction(type);
- break;
- case MANGAFOX:
- // TODO
- break;
- case E621:
- // TODO
- break;
- case YIFFSTAR:
- // TODO
- break;
- case E_HENTAI:
- // TODO
- break;
- case MANGA_LEL:
- // TODO
- break;
- case CBZ:
- case HTML:
- case INFO_TEXT:
- case TEXT:
- case EPUB:
- break;
+ if (type != null) {
+ switch (type) {
+ case FIMFICTION:
+ // TODO
+ break;
+ case FANFICTION:
+ support = new Fanfiction(type);
+ break;
+ case MANGAHUB:
+ // TODO
+ break;
+ case E621:
+ // TODO
+ break;
+ case YIFFSTAR:
+ // TODO
+ break;
+ case E_HENTAI:
+ // TODO
+ break;
+ case MANGA_LEL:
+ support = new MangaLel();
+ break;
+ case CBZ:
+ case HTML:
+ case INFO_TEXT:
+ case TEXT:
+ case EPUB:
+ break;
+ }
}
return support;