From: Niki Roo Date: Sun, 26 Nov 2017 11:16:31 +0000 (+0100) Subject: Some fixes: output types, libraries, remote X-Git-Tag: fanfix-1.6.3~37 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=e604986c4208da0091d26bc0e1c4feb4ff3c588f;p=fanfix.git Some fixes: output types, libraries, remote --- diff --git a/src/be/nikiroo/fanfix/Instance.java b/src/be/nikiroo/fanfix/Instance.java index a06c975..df990d7 100644 --- a/src/be/nikiroo/fanfix/Instance.java +++ b/src/be/nikiroo/fanfix/Instance.java @@ -12,7 +12,6 @@ import be.nikiroo.fanfix.bundles.UiConfig; import be.nikiroo.fanfix.bundles.UiConfigBundle; import be.nikiroo.fanfix.library.BasicLibrary; import be.nikiroo.fanfix.library.LocalLibrary; -import be.nikiroo.fanfix.output.BasicOutput.OutputType; import be.nikiroo.utils.IOUtils; import be.nikiroo.utils.resources.Bundles; @@ -122,8 +121,7 @@ public class Instance { uiconfig = new UiConfigBundle(); trans = new StringIdBundle(getLang()); try { - lib = new LocalLibrary(getFile(Config.LIBRARY_DIR), - OutputType.INFO_TEXT, OutputType.CBZ); + lib = new LocalLibrary(getFile(Config.LIBRARY_DIR)); } catch (Exception e) { syserr(new IOException("Cannot create library for directory: " + getFile(Config.LIBRARY_DIR), e)); @@ -134,7 +132,7 @@ public class Instance { coverDir = getFile(Config.DEFAULT_COVERS_DIR); File tmp = getFile(Config.CACHE_DIR); readerTmp = getFile(UiConfig.CACHE_DIR_LOCAL_READER); - remoteDir = new File(getFile(Config.LIBRARY_DIR), "remote"); + remoteDir = new File(configDir, "remote"); if (checkEnv("NOUTF")) { trans.setUnicode(false); diff --git a/src/be/nikiroo/fanfix/Main.java b/src/be/nikiroo/fanfix/Main.java index 99ac119..c17a1d8 100644 --- a/src/be/nikiroo/fanfix/Main.java +++ b/src/be/nikiroo/fanfix/Main.java @@ -372,7 +372,7 @@ public class Main { */ public static int export(String luid, String typeString, String target, Progress pg) { - OutputType type = OutputType.valueOfNullOkUC(typeString); + OutputType type = OutputType.valueOfNullOkUC(typeString, null); if (type == null) { Instance.syserr(new Exception(trans(StringId.OUTPUT_DESC, typeString))); @@ -477,7 +477,7 @@ public class Main { sourceName = sourceName.substring("file://".length()); } - OutputType type = OutputType.valueOfAllOkUC(typeString); + OutputType type = OutputType.valueOfAllOkUC(typeString, null); if (type == null) { Instance.syserr(new IOException(trans( StringId.ERR_BAD_OUTPUT_TYPE, typeString))); diff --git a/src/be/nikiroo/fanfix/bundles/Config.java b/src/be/nikiroo/fanfix/bundles/Config.java index bd27edf..d2d189e 100644 --- a/src/be/nikiroo/fanfix/bundles/Config.java +++ b/src/be/nikiroo/fanfix/bundles/Config.java @@ -15,6 +15,11 @@ public enum Config { @Meta(description = "reader type (CLI = simple output to console, TUI = Text User Interface with menus and windows, GUI = a GUI with locally stored files)", format = Format.FIXED_LIST, list = { "CLI", "GUI", "TUI" }, info = "Select the default reader to use to read stories") READER_TYPE, // + @Meta(format = Format.COMBO_LIST, list = { "INFO_TEXT", "EPUB", "HTML", + "TEXT" }, info = "One of the known output type", description = "The type of output for the Local Reader for non-images documents") + NON_IMAGES_DOCUMENT_TYPE, // + @Meta(format = Format.COMBO_LIST, list = { "CBZ", "HTML" }, description = "The type of output for the Local Reader for images documents") + IMAGES_DOCUMENT_TYPE, // @Meta(description = "absolute path, $HOME variable supported, / is always accepted as dir separator", format = Format.DIRECTORY, info = "The directory where to store temporary files, defaults to directory 'tmp' in the conig directory (usually $HOME/.fanfix)") CACHE_DIR, // @Meta(description = "delay in hours, or 0 for no cache, or -1 for infinite time (default)", format = Format.INT, info = "The delay after which a cached resource that is thought to change ~often is considered too old and triggers a refresh") diff --git a/src/be/nikiroo/fanfix/bundles/UiConfig.java b/src/be/nikiroo/fanfix/bundles/UiConfig.java index 271abb3..a4d8439 100644 --- a/src/be/nikiroo/fanfix/bundles/UiConfig.java +++ b/src/be/nikiroo/fanfix/bundles/UiConfig.java @@ -12,10 +12,11 @@ import be.nikiroo.utils.resources.Meta.Format; public enum UiConfig { @Meta(format = Format.DIRECTORY, info = "absolute path, $HOME variable supported, / is always accepted as dir separator", description = "The directory where to store temporary files, defaults to directory 'tmp.reader' in the conig directory (usually $HOME/.fanfix)") CACHE_DIR_LOCAL_READER, // - @Meta(format = Format.COMBO_LIST, list = { "HTML", "CBZ" }, info = "One of the known output type", description = "The type of output for the Local Reader for non-images documents") - NON_IMAGES_DOCUMENT_TYPE, // - @Meta(format = Format.COMBO_LIST, list = { "HTML", "CBZ" }, description = "The type of output for the Local Reader for images documents") - IMAGES_DOCUMENT_TYPE, // + @Meta(format = Format.COMBO_LIST, list = { "INFO_TEXT", "EPUB", "HTML", + "TEXT" }, info = "One of the known output type", description = "The type of output for the GUI Reader for non-images documents") + GUI_NON_IMAGES_DOCUMENT_TYPE, // + @Meta(format = Format.COMBO_LIST, list = { "CBZ", "HTML" }, description = "The type of output for the GUI Reader for images documents") + GUI_IMAGES_DOCUMENT_TYPE, // @Meta(info = "A command to start", description = "The command launched for images documents -- default to the system default for the current file type") IMAGES_DOCUMENT_READER, // @Meta(info = "A command to start", description = "The command launched for non images documents -- default to the system default for the current file type") diff --git a/src/be/nikiroo/fanfix/bundles/config.properties b/src/be/nikiroo/fanfix/bundles/config.properties index 0c04e41..b6d8fa5 100644 --- a/src/be/nikiroo/fanfix/bundles/config.properties +++ b/src/be/nikiroo/fanfix/bundles/config.properties @@ -9,6 +9,14 @@ LANG = # (FORMAT: FIXED_LIST) Select the default reader to use to read stories # ALLOWED VALUES: "CLI" "GUI" "TUI" READER_TYPE = +# The type of output for the Local Reader for non-images documents +# (FORMAT: COMBO_LIST) One of the known output type +# ALLOWED VALUES: "INFO_TEXT" "EPUB" "HTML" "TEXT" +NON_IMAGES_DOCUMENT_TYPE = INFO_TEXT +# The type of output for the Local Reader for images documents +# (FORMAT: COMBO_LIST) +# ALLOWED VALUES: "CBZ" "HTML" +IMAGES_DOCUMENT_TYPE = CBZ # absolute path, $HOME variable supported, / is always accepted as dir separator # (FORMAT: DIRECTORY) The directory where to store temporary files, defaults to directory 'tmp' in the conig directory (usually $HOME/.fanfix) CACHE_DIR = @@ -78,4 +86,4 @@ LOGIN_FIMFICTION_APIKEY_CLIENT_SECRET = LOGIN_FIMFICTION_APIKEY_FORCE_HTML = # A token is required to use the beta APIv2 from FimFiction (see APIKEY_CLIENT_*) # (FORMAT: PASSWORD) -LOGIN_FIMFICTION_APIKEY_TOKEN = Bearer WnZ5oHlzQoDocv1GcgHfcoqctHkSwL-D +LOGIN_FIMFICTION_APIKEY_TOKEN = Bearer WnZ5oHlzQoDocv1GcgHfcoqctHkSwL-D diff --git a/src/be/nikiroo/fanfix/bundles/resources.properties b/src/be/nikiroo/fanfix/bundles/resources.properties index bdbb754..8d6bb1a 100644 --- a/src/be/nikiroo/fanfix/bundles/resources.properties +++ b/src/be/nikiroo/fanfix/bundles/resources.properties @@ -19,6 +19,7 @@ HELP_SYNTAX = Valid options:\n\ \t--list: list the stories present in the library\n\ \t--set-reader [reader type]: set the reader type to CLI, TUI or GUI for \n\ \t\tthis command\n\ +\t--server [port]: start a remote server on this port\n\ \t--remote [host] [port]: select this remote server to get \n\ \t\t(or update or...) the stories from\n\ \t--help: this help message\n\ diff --git a/src/be/nikiroo/fanfix/bundles/ui.properties b/src/be/nikiroo/fanfix/bundles/ui.properties index d98410a..80e0a24 100644 --- a/src/be/nikiroo/fanfix/bundles/ui.properties +++ b/src/be/nikiroo/fanfix/bundles/ui.properties @@ -5,14 +5,14 @@ # The directory where to store temporary files, defaults to directory 'tmp.reader' in the conig directory (usually $HOME/.fanfix) # (FORMAT: DIRECTORY) absolute path, $HOME variable supported, / is always accepted as dir separator CACHE_DIR_LOCAL_READER = -# The type of output for the Local Reader for non-images documents +# The type of output for the GUI Reader for non-images documents # (FORMAT: COMBO_LIST) One of the known output type -# ALLOWED VALUES: "HTML" "CBZ" -NON_IMAGES_DOCUMENT_TYPE = HTML -# The type of output for the Local Reader for images documents +# ALLOWED VALUES: "INFO_TEXT" "EPUB" "HTML" "TEXT" +GUI_NON_IMAGES_DOCUMENT_TYPE = HTML +# The type of output for the GUI Reader for images documents # (FORMAT: COMBO_LIST) -# ALLOWED VALUES: "HTML" "CBZ" -IMAGES_DOCUMENT_TYPE = CBZ +# ALLOWED VALUES: "CBZ" "HTML" +GUI_IMAGES_DOCUMENT_TYPE = CBZ # The command launched for images documents -- default to the system default for the current file type # (FORMAT: STRING) A command to start IMAGES_DOCUMENT_READER = diff --git a/src/be/nikiroo/fanfix/bundles/ui_description.properties b/src/be/nikiroo/fanfix/bundles/ui_description.properties index 147a5a6..99df88a 100644 --- a/src/be/nikiroo/fanfix/bundles/ui_description.properties +++ b/src/be/nikiroo/fanfix/bundles/ui_description.properties @@ -10,14 +10,14 @@ # The directory where to store temporary files, defaults to directory 'tmp.reader' in the conig directory (usually $HOME/.fanfix) # (FORMAT: DIRECTORY) absolute path, $HOME variable supported, / is always accepted as dir separator CACHE_DIR_LOCAL_READER = The directory where to store temporary files, defaults to directory 'tmp.reader' in the config directory (usually $HOME/.fanfix) -- this is an absolute path, $HOME variable supported, / is always accepted as dir separator -# The type of output for the Local Reader for non-images documents +# The type of output for the GUI Reader for non-images documents # (FORMAT: COMBO_LIST) One of the known output type -# ALLOWED VALUES: "HTML" "CBZ" -NON_IMAGES_DOCUMENT_TYPE = -# The type of output for the Local Reader for images documents +# ALLOWED VALUES: "INFO_TEXT" "EPUB" "HTML" "TEXT" +GUI_NON_IMAGES_DOCUMENT_TYPE = +# The type of output for the GUI Reader for images documents # (FORMAT: COMBO_LIST) -# ALLOWED VALUES: "HTML" "CBZ" -IMAGES_DOCUMENT_TYPE = +# ALLOWED VALUES: "CBZ" "HTML" +GUI_IMAGES_DOCUMENT_TYPE = # The command launched for images documents -- default to the system default for the current file type # (FORMAT: STRING) A command to start IMAGES_DOCUMENT_READER = diff --git a/src/be/nikiroo/fanfix/library/LocalLibrary.java b/src/be/nikiroo/fanfix/library/LocalLibrary.java index ab5a82b..d811d2b 100644 --- a/src/be/nikiroo/fanfix/library/LocalLibrary.java +++ b/src/be/nikiroo/fanfix/library/LocalLibrary.java @@ -40,15 +40,41 @@ public class LocalLibrary extends BasicLibrary { private OutputType text; private OutputType image; + /** + * Create a new {@link LocalLibrary} with the given back-end directory. + * + * @param baseDir + * the directory where to find the {@link Story} objects + */ + public LocalLibrary(File baseDir) { + this(baseDir, Instance.getConfig().getString( + Config.NON_IMAGES_DOCUMENT_TYPE), Instance.getConfig() + .getString(Config.IMAGES_DOCUMENT_TYPE), false); + } + + /** + * Create a new {@link LocalLibrary} with the given back-end directory. + * + * @param baseDir + * the directory where to find the {@link Story} objects + */ + public LocalLibrary(File baseDir, String text, String image, + boolean defaultIsHtml) { + this(baseDir, OutputType.valueOfNullOkUC(text, + defaultIsHtml ? OutputType.HTML : OutputType.INFO_TEXT), + OutputType.valueOfNullOkUC(image, + defaultIsHtml ? OutputType.HTML : OutputType.CBZ)); + } + /** * Create a new {@link LocalLibrary} with the given back-end directory. * * @param baseDir * the directory where to find the {@link Story} objects * @param text - * the {@link OutputType} to save the text-focused stories into + * the {@link OutputType} to use for non-image documents * @param image - * the {@link OutputType} to save the images-focused stories into + * the {@link OutputType} to use for image documents */ public LocalLibrary(File baseDir, OutputType text, OutputType image) { this.baseDir = baseDir; @@ -188,15 +214,24 @@ public class LocalLibrary extends BasicLibrary { pg = new Progress(); } - // Check if we can simply copy the files instead of the whole process + LocalLibrary otherLocalLibrary = null; + if (other instanceof RemoteLibrary) { + otherLocalLibrary = ((RemoteLibrary) other).getLocalLibrary(); + } + if (other instanceof LocalLibrary) { - LocalLibrary otherLibrary = (LocalLibrary) other; - MetaData meta = otherLibrary.getInfo(luid); - String expectedType = "" + (meta.isImageDocument() ? image : text); - if (meta.getType().equals(expectedType)) { - File from = otherLibrary.getExpectedDir(meta.getSource()); + otherLocalLibrary = (LocalLibrary) other; + } + + // Check if we can simply copy the files instead of the whole process + if (otherLocalLibrary != null) { + MetaData meta = otherLocalLibrary.getInfo(luid); + String expectedType = "" + + (meta != null && meta.isImageDocument() ? image : text); + if (meta != null && meta.getType().equals(expectedType)) { + File from = otherLocalLibrary.getExpectedDir(meta.getSource()); File to = this.getExpectedDir(meta.getSource()); - List sources = otherLibrary.getRelatedFiles(luid); + List sources = otherLocalLibrary.getRelatedFiles(luid); if (!sources.isEmpty()) { pg.setMinMax(0, sources.size()); } @@ -205,6 +240,7 @@ public class LocalLibrary extends BasicLibrary { File target = new File(source.getAbsolutePath().replace( from.getAbsolutePath(), to.getAbsolutePath())); if (!source.equals(target)) { + target.getParentFile().mkdirs(); InputStream in = null; try { in = new FileInputStream(source); @@ -232,6 +268,8 @@ public class LocalLibrary extends BasicLibrary { } super.imprt(other, luid, pg); + + clearCache(); } /** diff --git a/src/be/nikiroo/fanfix/library/RemoteLibrary.java b/src/be/nikiroo/fanfix/library/RemoteLibrary.java index 337e13f..63082ce 100644 --- a/src/be/nikiroo/fanfix/library/RemoteLibrary.java +++ b/src/be/nikiroo/fanfix/library/RemoteLibrary.java @@ -9,7 +9,6 @@ import java.util.List; import be.nikiroo.fanfix.Instance; import be.nikiroo.fanfix.data.MetaData; import be.nikiroo.fanfix.data.Story; -import be.nikiroo.fanfix.output.BasicOutput.OutputType; import be.nikiroo.utils.Progress; import be.nikiroo.utils.Version; import be.nikiroo.utils.serial.ConnectActionClient; @@ -44,8 +43,7 @@ public class RemoteLibrary extends BasicLibrary { this.baseDir = Instance.getRemoteDir(host); this.baseDir.mkdirs(); - this.lib = new LocalLibrary(baseDir, OutputType.INFO_TEXT, - OutputType.CBZ); + this.lib = new LocalLibrary(baseDir); } @Override @@ -61,7 +59,7 @@ public class RemoteLibrary extends BasicLibrary { metas = new ArrayList(); try { - new ConnectActionClient(host, port, true, null) { + new ConnectActionClient(host, port, true) { @Override public void action(Version serverVersion) throws Exception { try { @@ -77,6 +75,14 @@ public class RemoteLibrary extends BasicLibrary { } catch (IOException e) { Instance.syserr(e); } + + List test = new ArrayList(); + for (MetaData meta : metas) { + if (test.contains(meta.getLuid())) { + throw new RuntimeException("wwops"); + } + test.add(meta.getLuid()); + } } return metas; @@ -88,7 +94,7 @@ public class RemoteLibrary extends BasicLibrary { if (file == null) { final File[] tmp = new File[1]; try { - new ConnectActionClient(host, port, true, null) { + new ConnectActionClient(host, port, true) { @Override public void action(Version serverVersion) throws Exception { try { @@ -119,13 +125,30 @@ public class RemoteLibrary extends BasicLibrary { } @Override - public BufferedImage getCover(String luid) { - // Retrieve it from the network if needed: - if (lib.getInfo(luid) == null) { - getFile(luid); + public BufferedImage getCover(final String luid) { + // Retrieve it from the cache if possible: + if (lib.getInfo(luid) != null) { + return lib.getCover(luid); + } + + final BufferedImage[] result = new BufferedImage[1]; + try { + new ConnectActionClient(host, port, true) { + @Override + public void action(Version serverVersion) throws Exception { + try { + Object rep = send("GET_COVER " + luid); + result[0] = (BufferedImage) rep; + } catch (Exception e) { + Instance.syserr(e); + } + } + }.connect(); + } catch (IOException e) { + Instance.syserr(e); } - return lib.getCover(luid); + return result[0]; } @Override @@ -170,4 +193,13 @@ public class RemoteLibrary extends BasicLibrary { protected Story doSave(Story story, Progress pg) throws IOException { throw new java.lang.InternalError("Should not have been called"); } + + /** + * Return the backing local library. + * + * @return the library + */ + LocalLibrary getLocalLibrary() { + return lib; + } } diff --git a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java b/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java index 661bf54..221fbdf 100644 --- a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java +++ b/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java @@ -65,6 +65,10 @@ public class RemoteLibraryServer extends Server { if (args != null) { return Instance.getLibrary().getStory(args, null); } + } else if ("GET_COVER".equals(command)) { + if (args != null) { + return Instance.getLibrary().getCover(args); + } } return null; diff --git a/src/be/nikiroo/fanfix/output/BasicOutput.java b/src/be/nikiroo/fanfix/output/BasicOutput.java index 4607827..036a156 100644 --- a/src/be/nikiroo/fanfix/output/BasicOutput.java +++ b/src/be/nikiroo/fanfix/output/BasicOutput.java @@ -110,17 +110,19 @@ public abstract class BasicOutput { /** * Call {@link OutputType#valueOf(String)} after conversion to upper - * case but return NULL for NULL and empty instead of raising an + * case but return def for NULL and empty instead of raising an * exception. * * @param typeName * the possible type name + * @param def + * the default value * * @return NULL or the type */ - public static OutputType valueOfNullOkUC(String typeName) { + public static OutputType valueOfNullOkUC(String typeName, OutputType def) { if (typeName == null || typeName.isEmpty()) { - return null; + return def; } return OutputType.valueOfUC(typeName); @@ -128,19 +130,20 @@ public abstract class BasicOutput { /** * Call {@link OutputType#valueOf(String)} after conversion to upper - * case but return NULL in case of error instead of raising an - * exception. + * case but return def in case of error instead of raising an exception. * * @param typeName * the possible type name + * @param def + * the default value * * @return NULL or the type */ - public static OutputType valueOfAllOkUC(String typeName) { + public static OutputType valueOfAllOkUC(String typeName, OutputType def) { try { return OutputType.valueOfUC(typeName); } catch (Exception e) { - return null; + return def; } } } diff --git a/src/be/nikiroo/fanfix/reader/GuiReader.java b/src/be/nikiroo/fanfix/reader/GuiReader.java index 8559cf1..410e05e 100644 --- a/src/be/nikiroo/fanfix/reader/GuiReader.java +++ b/src/be/nikiroo/fanfix/reader/GuiReader.java @@ -18,7 +18,6 @@ import be.nikiroo.fanfix.bundles.UiConfig; import be.nikiroo.fanfix.data.MetaData; import be.nikiroo.fanfix.data.Story; import be.nikiroo.fanfix.library.LocalLibrary; -import be.nikiroo.fanfix.output.BasicOutput.OutputType; import be.nikiroo.utils.Progress; import be.nikiroo.utils.Version; import be.nikiroo.utils.ui.UIUtils; @@ -41,33 +40,9 @@ class GuiReader extends BasicReader { "Cannote create cache directory for local reader: " + dir); } - OutputType text = null; - OutputType images = null; - - try { - text = OutputType.valueOfNullOkUC(Instance.getUiConfig().getString( - UiConfig.NON_IMAGES_DOCUMENT_TYPE)); - if (text == null) { - text = OutputType.HTML; - } - - images = OutputType.valueOfNullOkUC(Instance.getUiConfig() - .getString(UiConfig.IMAGES_DOCUMENT_TYPE)); - if (images == null) { - images = OutputType.CBZ; - } - } catch (Exception e) { - UiConfig key = (text == null) ? UiConfig.NON_IMAGES_DOCUMENT_TYPE - : UiConfig.IMAGES_DOCUMENT_TYPE; - String value = Instance.getUiConfig().getString(key); - - throw new IOException( - String.format( - "The configuration option %s is not valid: %s", - key, value), e); - } - - localLibrary = new LocalLibrary(dir, text, images); + localLibrary = new LocalLibrary(dir, Instance.getUiConfig().getString( + UiConfig.GUI_NON_IMAGES_DOCUMENT_TYPE), Instance.getUiConfig() + .getString(UiConfig.GUI_IMAGES_DOCUMENT_TYPE), true); } @Override diff --git a/src/be/nikiroo/fanfix/reader/GuiReaderBook.java b/src/be/nikiroo/fanfix/reader/GuiReaderBook.java index 782481c..2ae04b4 100644 --- a/src/be/nikiroo/fanfix/reader/GuiReaderBook.java +++ b/src/be/nikiroo/fanfix/reader/GuiReaderBook.java @@ -381,18 +381,22 @@ class GuiReaderBook extends JPanel { BufferedImage resizedImage = null; String id = null; - if (meta.getLuid() != null) { - id = meta.getUuid() + ".thumb_" + SPINE_WIDTH + "x" + COVER_WIDTH - + "+" + SPINE_HEIGHT + "+" + COVER_HEIGHT + "@" + HOFFSET; - InputStream in = Instance.getCache().getFromCache(id); - if (in != null) { - try { - resizedImage = ImageUtils.fromStream(in); - in.close(); - in = null; - } catch (IOException e) { - Instance.syserr(e); - } + String key = meta.getUuid(); + if (key == null) { + // a fake meta (a source) + key = "source_" + meta.getSource(); + } + + id = key + ".thumb_" + SPINE_WIDTH + "x" + COVER_WIDTH + "+" + + SPINE_HEIGHT + "+" + COVER_HEIGHT + "@" + HOFFSET; + InputStream in = Instance.getCache().getFromCache(id); + if (in != null) { + try { + resizedImage = ImageUtils.fromStream(in); + in.close(); + in = null; + } catch (IOException e) { + Instance.syserr(e); } } @@ -426,7 +430,7 @@ class GuiReaderBook extends JPanel { ByteArrayOutputStream out = new ByteArrayOutputStream(); ImageIO.write(resizedImage, "png", out); byte[] imageBytes = out.toByteArray(); - InputStream in = new ByteArrayInputStream(imageBytes); + in = new ByteArrayInputStream(imageBytes); Instance.getCache().addToCache(in, id); in.close(); in = null; diff --git a/src/be/nikiroo/fanfix/reader/GuiReaderGroup.java b/src/be/nikiroo/fanfix/reader/GuiReaderGroup.java index 041e8bc..a087c4c 100644 --- a/src/be/nikiroo/fanfix/reader/GuiReaderGroup.java +++ b/src/be/nikiroo/fanfix/reader/GuiReaderGroup.java @@ -7,6 +7,7 @@ import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; +import javax.management.RuntimeErrorException; import javax.swing.JLabel; import javax.swing.JPanel;