- [x] New API on FimFiction.net (faster)
- [ ] Others? Any ideas? I'm open for requests
- [x] [e-Hentai](https://e-hentai.org/) requested
+ - [ ] Fix "content warning" access
- [x] A GUI library
- [x] Make one
- [x] Make it run when no args passed
- [x] Use a version number
- [x] Show it in UI
- [x] A check-update feature
+- [x] Fix "redownload also reset the source" bug
## Version WIP
- New option (disabled by default) to show one item per source type in GUI instead of one item per story when showing ALL sources (which is also the start page)
+- Fix source/type reset when redownloading
+- Show the number of images instead of the number of words for images documents
## Version 1.6.0
ImageIO.write(ImageUtils.fromStream(in), Instance.getConfig()
.getString(Config.IMAGE_FORMAT_CONTENT).toLowerCase(),
target);
+ } catch (IOException e) {
+ throw new IOException("Cannot write image " + url, e);
} finally {
in.close();
}
}
/**
- * The number of words in this {@link Chapter}.
+ * The number of words (or images) in this {@link Chapter}.
*
* @return the number of words
*/
}
/**
- * The number of words in this {@link Chapter}.
+ * The number of words (or images) in this {@link Chapter}.
*
* @param words
* the number of words to set
* the image as an URL
*/
public Paragraph(URL imageUrl) {
- this(ParagraphType.IMAGE, imageUrl.toString(), 0);
+ this(ParagraphType.IMAGE, imageUrl.toString(), 1);
}
/**
* @param content
* the content of this paragraph
* @param words
- * the number of words
+ * the number of words (or images)
*/
public Paragraph(ParagraphType type, String content, long words) {
this.type = type;
}
/**
- * The number of words in this {@link Paragraph}.
+ * The number of words (or images) in this {@link Paragraph}.
*
* @return the number of words
*/
}
/**
- * The number of words in this {@link Paragraph}.
+ * The number of words (or images) in this {@link Paragraph}.
*
* @param words
* the number of words to set
String optSecondary = meta.getAuthor();
if (seeWordCount) {
if (meta.getWords() >= 4000) {
- optSecondary = (meta.getWords() / 1000) + "k words";
+ optSecondary = "" + (meta.getWords() / 1000) + "k";
} else if (meta.getWords() > 0) {
- optSecondary = meta.getWords() + " words";
+ optSecondary = "" + meta.getWords();
} else {
optSecondary = "";
}
+
+ if (!optSecondary.isEmpty()) {
+ if (meta.isImageDocument()) {
+ optSecondary += " images";
+ } else {
+ optSecondary += " words";
+ }
+ }
}
if (optSecondary != null && !optSecondary.isEmpty()) {
private GuiReaderBook selectedBook;
private boolean words; // words or authors (secondary info on books)
+ /**
+ * A {@link Runnable} with a {@link Story} parameter.
+ *
+ * @author niki
+ */
+ private interface StoryRunnable {
+ /**
+ * Run the action.
+ *
+ * @param story
+ * the story
+ */
+ public void run(Story story);
+ }
+
/**
* Create a new {@link GuiReaderFrame}.
*
public void actionPerformed(ActionEvent e) {
if (selectedBook != null) {
final MetaData meta = selectedBook.getMeta();
- imprt(meta.getUrl(), new Runnable() {
+ imprt(meta.getUrl(), new StoryRunnable() {
@Override
- public void run() {
+ public void run(Story story) {
reader.delete(meta.getLuid());
GuiReaderFrame.this.selectedBook = null;
+ MetaData newMeta = story.getMeta();
+ if (!newMeta.getSource().equals(meta.getSource())) {
+ reader.changeType(newMeta.getLuid(),
+ meta.getSource());
+ }
}
}, "Removing old copy");
}
* @param onSuccess
* Action to execute on success
*/
- private void imprt(final String url, final Runnable onSuccess,
+ private void imprt(final String url, final StoryRunnable onSuccess,
String onSuccessPgName) {
final Progress pg = new Progress();
final Progress pgImprt = new Progress();
@Override
public void run() {
Exception ex = null;
+ Story story = null;
try {
- reader.getLibrary().imprt(BasicReader.getUrl(url), pgImprt);
+ story = reader.getLibrary().imprt(BasicReader.getUrl(url),
+ pgImprt);
} catch (IOException e) {
ex = e;
}
});
} else {
if (onSuccess != null) {
- onSuccess.run();
+ onSuccess.run(story);
}
}
pgOnSuccess.done();