if (searchOn == null) {
Instance.getTraceHandler().error(
"Website not known: <" + args[i] + ">");
- exitCode = 255;
+ exitCode = 41;
+ break;
}
if (BasicSearchable.getSearchable(searchOn) == null) {
Instance.getTraceHandler().error(
"Website not supported: " + searchOn);
- exitCode = 255;
+ exitCode = 42;
+ break;
}
} else if (search == null) {
search = args[i];
}
}
- if (exitCode != 255) {
+ if (exitCode == 0) {
switch (action) {
case IMPORT:
exitCode = imprt(urlString, pg);
break;
}
- if (searchOn == null) {
- // TODO: do on reader!!!
- for (SupportType type : SupportType.values()) {
- if (BasicSearchable.getSearchable(type) != null) {
- System.out.println(type);
- }
- }
- } else if (search != null) {
- try {
+ try {
+ if (searchOn == null) {
+ BasicReader.getReader().search(true);
+ } else if (search != null) {
+
BasicReader.getReader().search(searchOn, search, page,
item, true);
- } catch (IOException e1) {
- Instance.getTraceHandler().error(e1);
+ } else {
+ exitCode = 255;
}
- } else {
- exitCode = 255;
+ } catch (IOException e1) {
+ Instance.getTraceHandler().error(e1);
+ exitCode = 20;
}
break;
*/
public void browse(String source);
+ /**
+ * Display all supports that allow search operations.
+ *
+ * @param sync
+ * execute the process synchronously (wait until it is terminated
+ * before returning)
+ *
+ * @throws IOException
+ * in case of I/O error
+ */
+ public void search(boolean sync) throws IOException;
+
/**
* Search for the given terms and find stories that correspond if possible.
*
}
}
+ @Override
+ public void search(boolean sync) throws IOException {
+ for (SupportType type : SupportType.values()) {
+ if (BasicSearchable.getSearchable(type) != null) {
+ System.out.println(type);
+ }
+ }
+ }
+
@Override
public void search(SupportType searchOn, String keywords, int page,
int item, boolean sync) throws IOException {
}
}
+ @Override
+ public void search(boolean sync) throws IOException {
+ // TODO
+ if (sync) {
+ throw new java.lang.IllegalStateException("Not implemented yet.");
+ }
+ }
+
@Override
public void search(SupportType searchOn, String keywords, int page,
int item, boolean sync) {
reader.setChapter(chapter);
}
+ @Override
+ public void search(boolean sync) throws IOException {
+ reader.search(sync);
+ }
+
@Override
public void search(SupportType searchOn, String keywords, int page,
int item, boolean sync) throws IOException {
}
@Override
- public void search(SupportType searchOn, String keywords, int page,
- int item, boolean sync) {
+ public void search(boolean sync) throws IOException {
// TODO
if (sync) {
throw new java.lang.IllegalStateException("Not implemented yet.");
}
}
+ @Override
+ public void search(SupportType searchOn, String keywords, int page,
+ int item, boolean sync) {
+ // TODO: add parameters!
+ GuiReaderSearch search = new GuiReaderSearch(this);
+ if (sync) {
+ sync(search);
+ } else {
+ search.setVisible(true);
+ }
+ }
+
@Override
public void searchTag(SupportType searchOn, int page, int item,
boolean sync, Integer... tags) {
if (infos != null) {
for (GuiReaderBookInfo info : infos) {
boolean isCached = false;
- if (info.getMeta() != null) {
+ if (info.getMeta() != null && info.getMeta().getLuid() != null) {
isCached = reader.isCached(info.getMeta().getLuid());
}
* 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
+ 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;
+ }
}
return support;