X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsearchable%2FBasicSearchable.java;h=cb0b1712ccb3fc7762354f799a04f65b45d89de8;hb=HEAD;hp=d8076fa7a1b87f99e452cddcef30100305884c7b;hpb=aaeabf3a939ce517e3044a0a8ee782f19f3f930d;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/searchable/BasicSearchable.java b/src/be/nikiroo/fanfix/searchable/BasicSearchable.java index d8076fa..cb0b171 100644 --- a/src/be/nikiroo/fanfix/searchable/BasicSearchable.java +++ b/src/be/nikiroo/fanfix/searchable/BasicSearchable.java @@ -131,6 +131,20 @@ public abstract class BasicSearchable { */ abstract public int searchPages(String search) throws IOException; + /** + * Search for the given tag and return the number of pages of results of + * stories satisfying this tag. + * + * @param tag + * the tag to search for + * + * @return a number of pages + * + * @throws IOException + * in case of I/O error + */ + abstract public int searchPages(SearchableTag tag) throws IOException; + /** * Search for the given term and return a list of stories satisfying this * search term. @@ -208,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()); } /** @@ -217,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 */ 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: - support = new MangaLel(); - break; - case CBZ: - case HTML: - case INFO_TEXT: - case TEXT: - case EPUB: - break; + if (type != null) { + switch (type) { + case FIMFICTION: + // TODO searchable for FIMFICTION + break; + case FANFICTION: + support = new Fanfiction(type); + break; + case MANGAHUB: + // TODO searchable for MANGAHUB + break; + case E621: + // TODO searchable for E621 + break; + case YIFFSTAR: + // TODO searchable for YIFFSTAR + break; + case E_HENTAI: + // TODO searchable for E_HENTAI + break; + case MANGA_LEL: + support = new MangaLel(); + break; + case CBZ: + case HTML: + case INFO_TEXT: + case TEXT: + case EPUB: + break; + } } return support;